Ignore the pushed value in interrupts and exceptions
Also handle more types of exceptions. *** First commit compatible with the C rewrite!! ***
This commit is contained in:
parent
e5dea368b0
commit
2720d0ddff
|
@ -158,6 +158,7 @@ stop_audio:
|
|||
ret
|
||||
|
||||
refill_buffer_0:
|
||||
add rsp, 4
|
||||
push r0
|
||||
push r1
|
||||
push r31
|
||||
|
@ -181,6 +182,7 @@ refill_buffer_0_loop:
|
|||
reti
|
||||
|
||||
refill_buffer_1:
|
||||
add rsp, 4
|
||||
push r0
|
||||
push r1
|
||||
push r31
|
||||
|
@ -204,6 +206,7 @@ refill_buffer_1_loop:
|
|||
reti
|
||||
|
||||
refill_buffer_2:
|
||||
add rsp, 4
|
||||
push r0
|
||||
push r1
|
||||
push r31
|
||||
|
@ -227,6 +230,7 @@ refill_buffer_2_loop:
|
|||
reti
|
||||
|
||||
refill_buffer_3:
|
||||
add rsp, 4
|
||||
push r0
|
||||
push r1
|
||||
push r31
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
; exception handling routines
|
||||
|
||||
; called if a divide by zero occurs
|
||||
; does not return, calls panic
|
||||
system_div_zero_handler:
|
||||
mov r0, system_div_zero_str
|
||||
jmp panic
|
||||
system_div_zero_str: data.str "Divide by zero" data.8 10 data.8 0
|
||||
|
||||
; called if an invalid opcode is executed
|
||||
; does not return, calls panic
|
||||
system_invalid_op_handler:
|
||||
mov r0, system_invalid_op_str
|
||||
jmp panic
|
||||
system_invalid_op_str: data.str "Invalid opcode" data.8 10 data.8 0
|
||||
|
||||
; called if a page fault occurs
|
||||
; does not return, calls panic
|
||||
system_page_fault_handler:
|
||||
|
@ -7,3 +21,15 @@ system_page_fault_handler:
|
|||
pop r1
|
||||
jmp panic
|
||||
system_page_fault_str: data.str "Page fault at virtual address r1" data.8 10 data.8 0
|
||||
|
||||
; called upon execution of a `brk` instruction
|
||||
system_breakpoint_handler:
|
||||
add rsp, 4
|
||||
push r0
|
||||
|
||||
mov r0, system_breakpoint_str
|
||||
call debug_print
|
||||
|
||||
pop r0
|
||||
reti
|
||||
system_breakpoint_str: data.str "Breakpoint reached!" data.8 10 data.8 0
|
||||
|
|
11
main.asm
11
main.asm
|
@ -4,7 +4,7 @@
|
|||
|
||||
const FOX32ROM_VERSION_MAJOR: 0
|
||||
const FOX32ROM_VERSION_MINOR: 5
|
||||
const FOX32ROM_VERSION_PATCH: 0
|
||||
const FOX32ROM_VERSION_PATCH: 2
|
||||
|
||||
const SYSTEM_STACK: 0x01FFF800
|
||||
const BACKGROUND_COLOR: 0xFF674764
|
||||
|
@ -39,12 +39,21 @@ entry_seed_done:
|
|||
; set the interrupt vector for interrupt 0xFF - vsync
|
||||
mov [0x000003FC], system_vsync_handler
|
||||
|
||||
; set the exception vector for exception 0x00 - divide by zero
|
||||
mov [0x00000400], system_div_zero_handler
|
||||
|
||||
; set the exception vector for exception 0x01 - invalid opcode
|
||||
mov [0x00000404], system_invalid_op_handler
|
||||
|
||||
; set the exception vector for exception 0x02 - page fault read
|
||||
mov [0x00000408], system_page_fault_handler
|
||||
|
||||
; set the exception vector for exception 0x03 - page fault write
|
||||
mov [0x0000040C], system_page_fault_handler
|
||||
|
||||
; set the exception vector for exception 0x04 - breakpoint
|
||||
mov [0x0000040C], system_breakpoint_handler
|
||||
|
||||
; enable interrupts
|
||||
ise
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
; debug monitor vsync routine
|
||||
|
||||
monitor_vsync_handler:
|
||||
add rsp, 4
|
||||
push r0
|
||||
push r1
|
||||
push r2
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
; outputs:
|
||||
; none, does not return
|
||||
panic:
|
||||
brk
|
||||
cmp r0, 0
|
||||
ifz mov r0, panic_string
|
||||
call debug_print
|
||||
|
|
Loading…
Reference in New Issue
Block a user