Files
chibi-firmware/src/reset.s

48 lines
1.1 KiB
ArmAsm

; CHIBI PC-09 Prototype #1 Boot ROM -- Reset Handler
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
; Licensed under MIT
INCLUDE "hardware.inc"
INCLUDE "serial.inc"
INCLUDE "memtest.inc"
INCLUDE "version.inc"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Hardware Initialization Routines
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SECTION RESET
EXPORT RESET
RESET
orcc #$50 ; Mask IRQ and FIRQ
CLRSTACK
; Initialize the system stack
lda #$00 ; Initialize A & X to zero out the stack
ldx #$0000
NEXT@
sta STACK_BOTTOM,x ; Write a zero and progress to the next byte
leax 1,x
cmpx #STACK_DEPTH ; See if we're at the top of the stack yet
blo NEXT@ ; Loop if we aren't at the end yet
lds #STACK_TOP ; Set S to top of newly cleared stack
BOOTSCR
lda #13 ; 9600 baud
ldb #%11 ; 8N1
jsr INITUART ; Initialize serial console
ldx #VERMSG ; Print version information
jsr POUTZSTR
; Progress to POST
POST
jsr RAMTEST
HALT
sync ; Halt and wait for interrupts
bra HALT