work on interrupts

This commit is contained in:
Kyle Cardoza 2024-03-31 14:25:39 -04:00
parent a93843b997
commit 2bb0e917bc
1 changed files with 17 additions and 20 deletions

View File

@ -6,11 +6,23 @@
#include "macros.h"
; Return from a COP interrupt
cop_rti .macro
plb
rti
.endm
; Set the data bank register to 0.
set_dbr_0 .macro
pha
lda ##0
short_a
pha
plb
long_a
pla
.endm
; -----------------------------------------------------------------------------
.section near
@ -121,18 +133,11 @@ cop_handler_native:
phb
long_a
; Set the data bank register to 0.
pha
lda ##0
short_a
pha
plb
long_a
pla
set_dbr_0
; First, we multiply the function number by 2, to get the jump
; table offset.
pha
txa
asl a
tax
@ -182,8 +187,6 @@ cop_jump_table:
.word .word0 cop_exec
.word .word0 cop_exit
.word .word0 cop_volume_initialize
.word .word0 cop_get_environment_value
.word .word0 cop_set_environment_value
.word .word0 cop_ioctl
; -----------------------------------------------------------------------------
@ -592,9 +595,9 @@ cop_set_working_directory:
; Given an open file handle, load the file into memory as a PGZ-format binary,
; and branch to its entry point. The user program will replace any user program
; already loaded and running, and will inherit the current environment and
; file handles. This function is used by the shell, which suspends itself and
; waits for the exit system call to pick up with the exit code of the user
; program.
; file handles. This call enters the user program by replacing the "return" vector
; in the stack with the entry point of the user program, altering where the RTI
; instruction "returns" to. The user program exits via a different system call.
;
; Arguments:
; A: File handle
@ -635,11 +638,5 @@ cop_exit:
cop_volume_initialize:
cop_rti
cop_get_environment_value:
cop_rti
cop_set_environment_value:
cop_rti
cop_ioctl:
cop_rti