Using BUFFALO to interact with terminal

/* Using BUFFALO to interact with terminal
 */

/* To print a single byte, need to have
 * X register point to byte, then call
 * OUT1BYT at 0xFFBB.
 * It is easiest to do this with a function
 * which automatically makes X point to i.
 */

void out1byte(char i)
{
	asm("  jsr 0xffbb");
}

/* The following assembly code is generated:
 *
 * out1byte:
 *         psha           ; put i on stack
 *         tsx            ; X points to i
 *         ldaa 0,x
 *         jsr  0xffbb    ; jump to routine to print [X]
 *         pula
 *         rts
 */
 
/* To print an integer (two bytes), need to have
 * X register point to interger, then call
 * OUT2BSP at 0xFFC1.
 */

void out2bytes(int i)
{
	asm("  jsr 0xffc1");
}

/* To print a new line, need to call
 * OUTCRLF at 0xFFC4
 * You don't need to use a function to do this.
 */
    asm("  jsr 0xffc4");

/*
 * Useful BUFFALO routines and addresses:
 *
 * ROUTINE   ADDR    DESC
 * -------   ----    ------------------------------
 * OUTA      FFB8    output ASCII char in ACCA
 * OUT1BYT   FFBB    output hex value of byte at X
 * OUT1BSP   FFBE    output hex value of byte at X then a space
 * OUT2BSP   FFC1    output hex value of 2 bytes at X then a space
 * OUTCRLF   FFC4    output new line
 * OUTSTR    FFC7    output new line, then ASCII string at X (until 0x04)
 * OUTSTRG0  FFCA    output ASCII string at X (until 0x04)
 * INCHAR    FFCD    read char from keyboard (wait until char available)
 */