block Sys { // char getChar() { // // read a character from the simple terminal; // } public block getChar uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRA($sp); body: ldiq $a0, CALLSYS_GETCHAR; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRA($sp); lda $sp, +sav0($sp); ret; } } // void putChar( char c ) { // // write a character to the simple terminal; // } public block putChar uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRA($sp); body: mov $a0, $a1; ldiq $a0, CALLSYS_PUTCHAR; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRA($sp); lda $sp, +sav0($sp); ret; } } // void exit( long status ) { // // terminate the process with the specified exit status; // // 0 => okay, else => error // } public block exit uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRA($sp); body: mov $a0, $a1; ldiq $a0, CALLSYS_EXIT; call_pal CALL_PAL_CALLSYS; return: // Never reach here ldq $ra, savRA($sp); lda $sp, +sav0($sp); ret; } } }