work on interrupts

This commit is contained in:
Kyle Cardoza 2024-03-30 14:48:24 -04:00
parent aa35098cdd
commit 4df26c413d
1 changed files with 27 additions and 11 deletions

View File

@ -65,16 +65,15 @@ cop_handler_native:
pla pla
; When we get here, the X register contains the function number. ; When we get here, the X register contains the function number.
; A and Y may or may not contain parameters. None of those are ; A/C, Y, and _Dp[0..7] may or may not contain parameters. None of
; expected to be preserved. The job here is just to jump to the ; those are expected to be preserved. The job here is just to jump
; right handler for the particular function being called, without ; to the right handler for the particular function being called,
; modifying anything but the X register. ; without modifying anything but the X register.
;
; Note that if a COP function takes a single 8/16-bit argument, it will be ; Note that, other than using the X register specifically for the
; in A; if it takes two 8/16-bit arguments, they will be in A and Y. ; function number, arguments are passed into COP functions following
; If the function takes more arguments, then the arguments will be packed ; function-specific protocols. Each function's arguments and return
; into a structure, with the bank of the structure in A, and the ; values are listed near the function itself.
; address in that bank of the structure in Y.
; Now, we do an indirect, indexed jump through the jump table. ; Now, we do an indirect, indexed jump through the jump table.
jmp (.kbank(cop_jump_table),x) jmp (.kbank(cop_jump_table),x)
@ -87,13 +86,30 @@ cop_jump_table:
.extern __program_start .extern __program_start
; Exit the calling program, effectively soft-rebooting the system.
;
; Arguments: None
; Return value: None
cop_exit: cop_exit:
jmp long:__program_start 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 .extern version_number
cop_get_version: cop_get_version:
lda long:version_number lda long:version_number
cop_rti cop_rti