Add default page fault exception handler, bump version to 0.3.3

This commit is contained in:
Ry 2022-08-15 17:32:50 -07:00
parent 594284cd0c
commit f307c55bdd
2 changed files with 20 additions and 1 deletions

9
exception.asm Normal file
View File

@ -0,0 +1,9 @@
; exception handling routines
; called if a page fault occurs
; does not return, calls panic
system_page_fault_handler:
mov r0, system_page_fault_str
pop r1
jmp panic
system_page_fault_str: data.str "Page fault at virtual address r1" data.8 10 data.8 0

View File

@ -4,7 +4,7 @@
const FOX32ROM_VERSION_MAJOR: 0 const FOX32ROM_VERSION_MAJOR: 0
const FOX32ROM_VERSION_MINOR: 3 const FOX32ROM_VERSION_MINOR: 3
const FOX32ROM_VERSION_PATCH: 2 const FOX32ROM_VERSION_PATCH: 3
const SYSTEM_STACK: 0x01FFF800 const SYSTEM_STACK: 0x01FFF800
const BACKGROUND_COLOR: 0xFF674764 const BACKGROUND_COLOR: 0xFF674764
@ -12,6 +12,10 @@ const TEXT_COLOR: 0xFFFFFFFF
; initialization code ; initialization code
entry: entry:
; disable the MMU
mcl
; set the stack pointer
mov rsp, SYSTEM_STACK mov rsp, SYSTEM_STACK
; disable audio playback ; disable audio playback
@ -34,6 +38,11 @@ entry_seed_done:
; set the interrupt vector for interrupt 0xFF - vsync ; set the interrupt vector for interrupt 0xFF - vsync
mov [0x000003FC], system_vsync_handler mov [0x000003FC], system_vsync_handler
; set the exception vector for exception 0x02 - page fault
mov [0x00000408], system_page_fault_handler
; enable interrupts
ise ise
; clear the interrupt vector for interrupt 0xFE - audio buffer switch ; clear the interrupt vector for interrupt 0xFE - audio buffer switch
@ -138,6 +147,7 @@ get_rom_version:
#include "draw_text.asm" #include "draw_text.asm"
#include "draw_tile.asm" #include "draw_tile.asm"
#include "event.asm" #include "event.asm"
#include "exception.asm"
#include "integer.asm" #include "integer.asm"
#include "keyboard.asm" #include "keyboard.asm"
#include "memory.asm" #include "memory.asm"