work on interrupts
This commit is contained in:
parent
4df26c413d
commit
963256a5c9
|
@ -15,6 +15,14 @@
|
|||
|
||||
#define long_reg rep #0b00110000
|
||||
|
||||
int .macro f
|
||||
php
|
||||
long_reg
|
||||
ldx ##\f
|
||||
cop #\f
|
||||
plp
|
||||
.endm
|
||||
|
||||
#ifdef __CALYPSI_CODE_MODEL_SMALL__
|
||||
|
||||
#define libcode code
|
||||
|
|
|
@ -31,18 +31,92 @@ internal_stack_pointer:
|
|||
.public interrupts_init
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
; Initialize the interrupt handler vectors.
|
||||
.extern __program_start
|
||||
interrupts_init:
|
||||
long_a
|
||||
sei
|
||||
|
||||
lda ##.near(null_handler)
|
||||
|
||||
; Emulation mode interrupt vectors.
|
||||
sta long:0x00FFFE
|
||||
sta long:0x00FFFA
|
||||
sta long:0x00FFF8
|
||||
sta long:0x00FFF4
|
||||
sta long:0x00FFEE
|
||||
sta long:0x00FFEC
|
||||
sta long:0x00FFEA
|
||||
sta long:0x00FFE8
|
||||
sta long:0x00FFE6
|
||||
sta long:0x00FFE4
|
||||
sta long:0x00FFE2
|
||||
sta long:0x00FFE0
|
||||
sta long:0x00FFDE
|
||||
sta long:0x00FFDC
|
||||
sta long:0x00FFDA
|
||||
sta long:0x00FFD8
|
||||
sta long:0x00FFD6
|
||||
sta long:0x00FFD4
|
||||
sta long:0x00FFD2
|
||||
sta long:0x00FFD0
|
||||
sta long:0x00FFCE
|
||||
sta long:0x00FFCC
|
||||
sta long:0x00FFCA
|
||||
sta long:0x00FFC8
|
||||
sta long:0x00FFC6
|
||||
sta long:0x00FFC4
|
||||
sta long:0x00FFC2
|
||||
sta long:0x00FFC0
|
||||
|
||||
; Native mode interrupt vectors.
|
||||
sta long:0x00FFB8
|
||||
sta long:0x00FFB6
|
||||
sta long:0x00FFAE
|
||||
sta long:0x00FFAC
|
||||
sta long:0x00FFAA
|
||||
sta long:0x00FFA8
|
||||
sta long:0x00FFA6
|
||||
sta long:0x00FFA4
|
||||
sta long:0x00FFA2
|
||||
sta long:0x00FFA0
|
||||
sta long:0x00FF9C
|
||||
sta long:0x00FF9A
|
||||
sta long:0x00FF98
|
||||
sta long:0x00FF96
|
||||
sta long:0x00FF94
|
||||
sta long:0x00FF92
|
||||
sta long:0x00FF92
|
||||
sta long:0x00FF8E
|
||||
sta long:0x00FF8C
|
||||
sta long:0x00FF8A
|
||||
sta long:0x00FF88
|
||||
sta long:0x00FF86
|
||||
sta long:0x00FF84
|
||||
sta long:0x00FF82
|
||||
sta long:0x00FF80
|
||||
|
||||
lda ##.near(__program_start)
|
||||
sta long:0x00FFFC
|
||||
|
||||
lda ##.near(cop_handler_native)
|
||||
sta long:0x00FFB4
|
||||
|
||||
rts
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Null interrupt handler
|
||||
;
|
||||
; This handler intentionally does nothing. It is used to populate interrupt
|
||||
; vectors that do nothing, without wasting space on multiple such functions.
|
||||
null_handler:
|
||||
rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; The COP handler is the primary interface to the kernel from user code. The
|
||||
; user program loads the function number into X, and any appropriate arguments
|
||||
; are loaded in a function-defined manner, and the COP interrupt (with an ignored)
|
||||
; argument byte) is triggered.
|
||||
cop_handler_native:
|
||||
phb
|
||||
long_a
|
||||
|
@ -76,25 +150,26 @@ cop_handler_native:
|
|||
; values are listed near the function itself.
|
||||
|
||||
; Now, we do an indirect, indexed jump through the jump table.
|
||||
jmp (.kbank(cop_jump_table),x)
|
||||
jmp (.kbank cop_jump_table,x)
|
||||
|
||||
cop_jump_table:
|
||||
.word .word0(cop_exit)
|
||||
.word .word0(cop_get_version)
|
||||
.word .word0 cop_exit
|
||||
.word .word0 cop_get_version
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
.extern __program_start
|
||||
|
||||
; Function 0: Exit
|
||||
;
|
||||
; Exit the calling program, effectively soft-rebooting the system.
|
||||
;
|
||||
; Arguments: None
|
||||
; Return value: None
|
||||
|
||||
.extern __program_start
|
||||
cop_exit:
|
||||
jmp long:__program_start
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 0: Exit
|
||||
; Function 1: Get Version Number
|
||||
;
|
||||
; Return the version number for the running kernel.
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue