[Index] [Previous] [Next]

1.6 Terminal I/O


Prints a character to the terminal. On entry, the char to be printed is on the stack and A holds TERMINAL_X. If the current line is up to the maximum width then we print a new line and update the terminal position. Then we print the character - to do this we loop until the device is ready to receive a char and then write it out.

If terminal width reached then print new line. Note that NewLine returns with A=0, so TERMINAL_X gets reset properly.
036E FE4E OutChar_tail CPI 48
0370 CC8A05 CZ NewLine
0373 3C INR A
0374 322700 STA TERMINAL_X
Wait for terminal device to become ready for output.
0377 DB00 WaitTermReady IN 00
0379 E680 ANI 80
037B C27703 JNZ WaitTermReady
Get char off stack and write it out.
037F D301 OUT 01
0381 C9 RET



Gets one char of input from the user.

Firstly loop until device ready
0382 DB00 InputChar IN 00  
0384 E601 ANI 01  
0386 C28203 JNZ InputChar
Read char from IO bus, reset bit 7, and return.
0389 DB01 IN 01  
038B E67F ANI 7F  
038D C9 RET


[Index] [Previous] [Next]