Instead of using the bootsector to load a bootloader, just put the bootloader in the ROM and call it a day. It looks for a file on the SD card in the root directory named `kernel.bin` and loads it into memory. This is not a perfect solution, as the kernel will grow larger and the kernel load address will have to change. At this point I could add back the bootloader, but that is for later. Also the bootloader is just a copy of the kernel, so that can be trimmed down a lot.
71 lines
1.3 KiB
ArmAsm
71 lines
1.3 KiB
ArmAsm
.include "io.inc65"
|
|
|
|
.importzp sp, sreg
|
|
|
|
.export _hex_set_8
|
|
.export _hex_set_16
|
|
.export _hex_set_24
|
|
.export _hex_enable
|
|
.export _sw_read
|
|
.export _led_set
|
|
|
|
.autoimport on
|
|
|
|
.code
|
|
|
|
; @in A: idx Stack[0]: val
|
|
; @out A: 0 for success, 1 for failure.
|
|
; Sets one of the 3 pairs of hex digits.
|
|
_hex_set_8:
|
|
phx
|
|
cmp #$3 ; If idx >= 3 then fail
|
|
bcc @1
|
|
plx
|
|
lda #$1
|
|
rts
|
|
@1: tax ; Move idx into x
|
|
jsr popa ; put val into a
|
|
sta SEVEN_SEG,x ; write to val
|
|
lda #$0
|
|
plx
|
|
rts
|
|
|
|
; @in A/X: val
|
|
; @out A: 0 for success, 1 for failure
|
|
; Sets the low 2 pairs of hex digits
|
|
_hex_set_16:
|
|
sta SEVEN_SEG
|
|
stx SEVEN_SEG+1
|
|
lda #$0
|
|
rts
|
|
|
|
; @in A/X/sreg: val
|
|
; @out A: 0 for success, 1 for failure
|
|
; Sets the 3 pairs of hex digits for a 24 bit value
|
|
_hex_set_24:
|
|
sta SEVEN_SEG
|
|
stx SEVEN_SEG+1
|
|
lda sreg
|
|
sta SEVEN_SEG+2
|
|
lda #$0
|
|
rts
|
|
|
|
; @in A: mask
|
|
; Set the mask for seven seg enables
|
|
_hex_enable:
|
|
sta SEVEN_SEG+3
|
|
rts
|
|
|
|
; @out A: The Value of the switches
|
|
; Reads the current values of the switches.
|
|
_sw_read:
|
|
lda SW
|
|
ldx #$0
|
|
rts
|
|
|
|
; @in A: val
|
|
; @out A: 0 for success, 1 for failure
|
|
; Sets the LEDs
|
|
_led_set:
|
|
sta LED
|
|
rts |