; stdio.h -- Standard interface definitons for the Hawk monitor I/O support. ; language: SMAL32 assembly language, intended as an include file ; author: Douglas W. Jones ; date: Dec 1, 2019 ; Linkage conventions: ; R1 -- used for return address linkage by all support routines. ; R2 -- available for use as an activation record pointer. ; R3 -- typically the first parameter and function return value ; R4 -- typically the second parameter, if there is one. ;------------------------------- ; linkage to monitor display management routines EXT PUTAT ; set display text coordinates ; takes R3=X R4=Y (origin in top left) ; wipes out R3-7 EXT PUTCHAR ; output one character (same as std C) ; takes R3=character ; wipes out R4-5, increments X ; C equivalent: putchar( ch ) EXT PUTS ; output one null terminated string (std C, adds LF) ; takes R3=string pointer ; wipes out R3-7, increments X ; C equivalent: puts( strptr ) EXT PUTSTR ; output one null terminated string (without LF) ; takes R3=string pointer ; wipes out R3-7, increments X ; C equivalent: fputs( strptr, stdout ) EXT PUTHEX ; output integer in hexadecimal ; takes R3=integer to print ; takes R4=field width ; wipes out R3-7, increments X ; uses 1 word of stack ; C equivalent: fprintf( "%*X", width, integer ) EXT PUTDEC ; output signed integer in decimal EXT PUTDECU ; output unsigned integer in decimal ; takes R3=integer to print ; takes R4=field width ; wipes out R3-6, increments X ; uses up to 11 words of stack ; C equivalent: fprintf( "%*d", width, integer ) ;------------------------------- ; linkage to monitor keyboard interface EXT GETCHAR ; get a character from the keyboard (std C) ; returns R3=character ; wipes out R4 ; C equivalent: getchar() EXT GETS ; get null-terminated string from keyboard (std C) ; takes R3=pointer to string buffer ; wipes out R3-7 ; C equivalent: gets() ;------------------------------- ; terminal info block EXT TERMINFO; global address of info block TERMROWS= 0 ; number of rows on the terminal TERMCOLS= 4 ; number of columns on the terminal ;------------------------------- ; strange accident that NULL is defined here (as in the C standard library) NULL = 0