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, savRet($sp); body: ldiq $a0, CALLSYS_GETCHAR; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block getChar // 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, savRet($sp); body: mov $a0, $a1; ldiq $a0, CALLSYS_PUTCHAR; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block putChar // void exit( int 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, savRet($sp); body: mov $a0, $a1; ldiq $a0, CALLSYS_EXIT; call_pal CALL_PAL_CALLSYS; return: // Never reach here ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block exit // int getInfo( int setKind, int storageKind, int storageIndex ) { // // Set debugging information for memory or register; // } public block getInfo uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRet($sp); body: mov $a4, $a5; mov $a3, $a4; mov $a2, $a3; mov $a1, $a2; mov $a0, $a1; ldiq $a0, CALLSYS_GETINFO; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block getInfo // void setInfo( int setKind, int storageKind, int storageIndex, int dataValue ) { // // Set debugging information for memory or register; // } public block setInfo uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRet($sp); body: mov $a4, $a5; mov $a3, $a4; mov $a2, $a3; mov $a1, $a2; mov $a0, $a1; ldiq $a0, CALLSYS_SETINFO; call_pal CALL_PAL_CALLSYS; return: ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block setInfo // void breakpoint() { // temporarily stop a program executing // } public block breakpoint uses proc, CALLSYS { code { public enter: lda $sp, -sav0($sp); stq $ra, savRet($sp); body: call_pal CALL_PAL_BPT; return: ldq $ra, savRet($sp); lda $sp, +sav0($sp); ret; } code } block breakpoint } block Sys