Rename boot to bios, add sd call
Adds a call that you can make to the BIOS to read sd blocks. Useful for the bootloader where there is not much space
This commit is contained in:
@@ -2,12 +2,8 @@ CC=cl65
|
|||||||
CFLAGS=-T -t none -I. --cpu "65C02"
|
CFLAGS=-T -t none -I. --cpu "65C02"
|
||||||
test: CFLAGS=-T -t sim65c02 -I.
|
test: CFLAGS=-T -t sim65c02 -I.
|
||||||
LDFLAGS=-C link.ld -m $(NAME).map
|
LDFLAGS=-C link.ld -m $(NAME).map
|
||||||
SIM=sim65
|
NAME=bios
|
||||||
SIMARGS=-v -c -x 1000000
|
|
||||||
|
|
||||||
NAME=bootrom
|
|
||||||
|
|
||||||
TEST_BIN=test.bin
|
|
||||||
BIN=$(NAME).bin
|
BIN=$(NAME).bin
|
||||||
HEX=$(NAME).hex
|
HEX=$(NAME).hex
|
||||||
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
; We need to to read the boot sector from the
|
|
||||||
; SD card, verify the last 2 bytes, then jump to the
|
|
||||||
; beginning of it.
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
|
|
||||||
|
.export _init
|
||||||
.import _load_bootsect
|
.import _load_bootsect
|
||||||
|
|
||||||
_init: ldx #$ff
|
_init: ldx #$ff
|
||||||
55
sw/bios/devices/interrupt.s
Normal file
55
sw/bios/devices/interrupt.s
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
.include "io.inc65"
|
||||||
|
|
||||||
|
.export _irq_int, _nmi_int
|
||||||
|
|
||||||
|
.importzp sreg, ptr1
|
||||||
|
|
||||||
|
.segment "CODE"
|
||||||
|
|
||||||
|
; IRQ
|
||||||
|
_irq_int:
|
||||||
|
jmp (irqmap,x)
|
||||||
|
|
||||||
|
_nmi_int:
|
||||||
|
rti
|
||||||
|
|
||||||
|
irqmap:
|
||||||
|
.addr handle_invalid
|
||||||
|
.addr handle_sd_read
|
||||||
|
|
||||||
|
handle_invalid:
|
||||||
|
rti
|
||||||
|
|
||||||
|
; sreg is the pointer to store the data
|
||||||
|
; a/y is the block address
|
||||||
|
; send command 17 with the block address of 00/y/a
|
||||||
|
handle_sd_read:
|
||||||
|
sta SD_ARG ; send command
|
||||||
|
sty SD_ARG+1
|
||||||
|
stz SD_ARG+2
|
||||||
|
stz SD_ARG+3
|
||||||
|
lda #$11
|
||||||
|
sta SD_CMD
|
||||||
|
|
||||||
|
@1: lda SD_CMD ; wait for status flag
|
||||||
|
and #$01
|
||||||
|
beq @1
|
||||||
|
|
||||||
|
@2: lda SD_CMD ; wait for data
|
||||||
|
and #$02
|
||||||
|
beq @2
|
||||||
|
|
||||||
|
ldy #$00
|
||||||
|
@loop: lda SD_DATA ; copy first 256 bytes
|
||||||
|
sta (sreg),y
|
||||||
|
iny
|
||||||
|
bne @loop
|
||||||
|
|
||||||
|
ldy #$00 ; copy second 256 bytes
|
||||||
|
inc sreg+1
|
||||||
|
@loop2: lda SD_DATA
|
||||||
|
sta (sreg),y
|
||||||
|
iny
|
||||||
|
bne @loop2
|
||||||
|
|
||||||
|
rti
|
||||||
@@ -14,5 +14,6 @@ SEGMENTS {
|
|||||||
ONCE: load = ROM, type = ro, optional = yes;
|
ONCE: load = ROM, type = ro, optional = yes;
|
||||||
CODE: load = ROM, type = ro;
|
CODE: load = ROM, type = ro;
|
||||||
RODATA: load = ROM, type = ro;
|
RODATA: load = ROM, type = ro;
|
||||||
|
VECTORS: load = ROM, type = ro, start = $FFFA;
|
||||||
}
|
}
|
||||||
|
|
||||||
14
sw/bios/vectors.s
Normal file
14
sw/bios/vectors.s
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; vectors.s
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Defines the interrupt vector table.
|
||||||
|
|
||||||
|
.import _init
|
||||||
|
.import _nmi_int, _irq_int
|
||||||
|
|
||||||
|
.segment "VECTORS"
|
||||||
|
|
||||||
|
.addr _nmi_int ; NMI vector
|
||||||
|
.addr _init ; Reset vector
|
||||||
|
.addr _irq_int ; IRQ/BRK vector
|
||||||
Reference in New Issue
Block a user