
THE BUFFALO INPUT/OUTPUT SUBROUTINE INTERFACE
Input from the terminal keyboard and output to the terminal display can be done using the built-in
Buffalo monitor input-output subroutines. Since the actual location of these utilities may change with
revisions of the Buffalo monitor, these routines are called by using a jump table that has a fixed ROM
location containing the jumps to the actual subroutine locations in the Buffalo ROM.
Use the EQUate assembler directive to associate the ROM address with a mnemonic label. [A list of the
jump table addresses of some of the Buffalo subroutines is in the document "Buffalo Input/Output
Utilitiy Subroutines."] The following sample program demonstrates how to use the subroutines. Run this
to see what happens. Debug as needed.
*****************************************************************
* KEYBOARD INPUT and DISPLAY OUTPUT Demonstration Program
* Revision 000407
*****************************************************************
* EQUATES
OUTSTRG EQU $FFC7 prints string
INCHAR EQU $FFCD waits for keyboard input
ORG $6000
* PROGRAM SECTION
MAIN EQU *
LDX #FIRST
JSR OUTSTRG
JSR INCHAR waits indefinitely for until a character is typed
STAA CHAR+1 store in right byte
LDAB #$20
STAB CHAR blank left byte
CMPA #$20 $20 and above are printable except for DEL = $7F
BHS PRINT
* CONTROL CODE e.g., CR = $0D displays as "^M" = $5E $4D
CMPA #$1B ESC = $1B is used to exit the infinite loop
BEQ DONE without being displayed
LDAB #'^
STAB CHAR
ADDA #$40
STAA CHAR+1
* PRINT
PRINT LDX #TEXT
JSR OUTSTRG
BRA MAIN
* DONE
DONE SWI return to BUFFALO monitor
* DATA SECTION
FIRST FCC "Type any key. Use ESC to exit program."
FCB 4
TEXT FCC "The keyboard character is "
CHAR RMB 2
FCC ". Type ESC to quit."
Computer Components and Operations