From 4df26c413d3fd51b5f633285991af758985d1837 Mon Sep 17 00:00:00 2001 From: Kyle Cardoza Date: Sat, 30 Mar 2024 14:48:24 -0400 Subject: [PATCH] work on interrupts --- src/interrupts.s | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/interrupts.s b/src/interrupts.s index c271652..2037986 100644 --- a/src/interrupts.s +++ b/src/interrupts.s @@ -65,16 +65,15 @@ cop_handler_native: pla ; When we get here, the X register contains the function number. - ; A and Y may or may not contain parameters. None of those are - ; expected to be preserved. The job here is just to jump to the - ; right handler for the particular function being called, without - ; modifying anything but the X register. - - ; Note that if a COP function takes a single 8/16-bit argument, it will be - ; in A; if it takes two 8/16-bit arguments, they will be in A and Y. - ; If the function takes more arguments, then the arguments will be packed - ; into a structure, with the bank of the structure in A, and the - ; address in that bank of the structure in Y. + ; A/C, Y, and _Dp[0..7] may or may not contain parameters. None of + ; those are expected to be preserved. The job here is just to jump + ; to the right handler for the particular function being called, + ; without modifying anything but the X register. + ; + ; Note that, other than using the X register specifically for the + ; function number, arguments are passed into COP functions following + ; function-specific protocols. Each function's arguments and return + ; values are listed near the function itself. ; Now, we do an indirect, indexed jump through the jump table. jmp (.kbank(cop_jump_table),x) @@ -87,13 +86,30 @@ cop_jump_table: .extern __program_start +; Exit the calling program, effectively soft-rebooting the system. +; +; Arguments: None +; Return value: None cop_exit: jmp long:__program_start ; ----------------------------------------------------------------------------- +; Function 0: Exit +; +; Return the version number for the running kernel. +; +; Arguments: None +; Return value: Version number in C +; +; Note: +; The return value is divided into three fields. +; The low-order byte is the "micro" or "patch" +; number, while the low-order nybble of the high +; byte is the "minor" number, and the high nybble +; is the major number. This allows versions to be +; compared using 16-bit math operations. .extern version_number - cop_get_version: lda long:version_number cop_rti