Work on interrupts
This commit is contained in:
parent
607674ff8d
commit
718668b8f8
|
@ -6,32 +6,6 @@
|
||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
irq_enter .macro
|
|
||||||
phb
|
|
||||||
phd
|
|
||||||
rep #0b00110000
|
|
||||||
sta long:tmp_register_a
|
|
||||||
tsc
|
|
||||||
sta long:external_stack_pointer
|
|
||||||
lda long:internal_stack_pointer
|
|
||||||
tcs
|
|
||||||
lda long:tmp_register_a
|
|
||||||
.endm
|
|
||||||
|
|
||||||
irq_exit .macro
|
|
||||||
sta long:tmp_register_a
|
|
||||||
tsc
|
|
||||||
sta long:internal_stack_pointer
|
|
||||||
lda long:external_stack_pointer
|
|
||||||
tcs
|
|
||||||
lda long:tmp_register_a
|
|
||||||
pld
|
|
||||||
plb
|
|
||||||
rti
|
|
||||||
.endm
|
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
|
||||||
.section near
|
.section near
|
||||||
|
@ -65,7 +39,25 @@ interrupts_init:
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
|
||||||
cop_handler_native:
|
cop_handler_native:
|
||||||
irq_enter
|
phd
|
||||||
|
phb
|
||||||
|
|
||||||
|
pha
|
||||||
|
short_a
|
||||||
|
lda #0
|
||||||
|
pha
|
||||||
|
plb
|
||||||
|
pha
|
||||||
|
pld
|
||||||
|
long_a
|
||||||
|
|
||||||
|
; First, we multiply the function number by 2, to get the jump
|
||||||
|
; table offset.
|
||||||
|
|
||||||
|
txa
|
||||||
|
asl a
|
||||||
|
tax
|
||||||
|
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 and Y may or may not contain parameters. None of those are
|
||||||
|
@ -73,19 +65,13 @@ cop_handler_native:
|
||||||
; right handler for the particular function being called, without
|
; right handler for the particular function being called, without
|
||||||
; modifying anything but the X register.
|
; modifying anything but the X register.
|
||||||
|
|
||||||
; First, we multiply the function number by 2, to get the jump
|
|
||||||
; table offset.
|
|
||||||
pha
|
|
||||||
txa
|
|
||||||
asl a
|
|
||||||
tax
|
|
||||||
pla
|
|
||||||
|
|
||||||
; Now, we do an indirect, indexed jump through the jump table.
|
; Now, we do an indirect, indexed jump through the jump table.
|
||||||
jsr (cop_jump_table,x)
|
jsr (cop_jump_table,x)
|
||||||
|
|
||||||
; And we're done.
|
; And we're done.
|
||||||
irq_exit
|
plb
|
||||||
|
pld
|
||||||
|
rti
|
||||||
|
|
||||||
cop_jump_table:
|
cop_jump_table:
|
||||||
.word .near(cop_reset)
|
.word .near(cop_reset)
|
||||||
|
|
Loading…
Reference in New Issue