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
; 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