1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-06-12 14:29:54 +00:00

Add some terminal control to Apple1 emulation

This commit is contained in:
David Schmenk 2024-03-12 13:57:15 -07:00
parent 82a1632bfd
commit 31d5b8a5ec
2 changed files with 33 additions and 23 deletions

View File

@ -156,9 +156,16 @@ int cout(M6502 *mpu, word addr, byte data) { if (mpu->registers->a == 0x8D) putc
unsigned keypending = 0;
unsigned char keypressed(void)
{
unsigned char cin;
unsigned char cin, cext[2];
if (read(STDIN_FILENO, &cin, 1) > 0)
{
if (cin == 0x1B) // Look for left arrow
{
if (read(STDIN_FILENO, cext, 2) == 2 && cext[0] == '[' && cext[1] == 'D')
cin = 0x08;
}
keypending = cin | 0x80;
}
return keypending & 0x80;
}
unsigned char keyin(void)

View File

@ -788,6 +788,9 @@ def rdstr(prompt)#1
if ^inbuff
cout('\\')
cout(^(inbuff + ^inbuff))
cout($08); cout($08); cout($08) // backspace if supported
prstr(" ")
cout($08); cout($08); cout($08)
inbuff.0--
fin
break