Replace bios with bootloader, don't use bootsector
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.
This commit is contained in:
60
sw/bootloader/devices/conio.s
Normal file
60
sw/bootloader/devices/conio.s
Normal file
@@ -0,0 +1,60 @@
|
||||
.importzp sp, sreg
|
||||
|
||||
.import _uart_txb_block
|
||||
.import _lastchar
|
||||
|
||||
.export _cputc
|
||||
.export gotoxy
|
||||
.export _clrscr
|
||||
.export _cgetc
|
||||
|
||||
.autoimport on
|
||||
|
||||
.code
|
||||
|
||||
; void __fastcall__ cputc (char c);
|
||||
_cputc:
|
||||
jsr _uart_txb_block
|
||||
cmp #$0a
|
||||
bne @1
|
||||
lda #$0d
|
||||
jsr _uart_txb_block
|
||||
@1: rts
|
||||
|
||||
; void __fastcall__ gotoxy (unsigned char x, unsigned char y);
|
||||
gotoxy:
|
||||
phx
|
||||
phy
|
||||
tay ; Move y position to y
|
||||
lda (sp)
|
||||
tax ; Move x position to x
|
||||
lda #$1b
|
||||
jsr _uart_txb_block
|
||||
lda #'['
|
||||
jsr _uart_txb_block
|
||||
tya
|
||||
jsr _uart_txb_block
|
||||
lda #';'
|
||||
jsr _uart_txb_block
|
||||
txa
|
||||
jsr _uart_txb_block
|
||||
lda #'H'
|
||||
jsr _uart_txb_block
|
||||
ply
|
||||
plx
|
||||
rts
|
||||
|
||||
_clrscr:
|
||||
phx
|
||||
lda #$1b
|
||||
jsr _uart_txb_block
|
||||
lda #'c'
|
||||
jsr _uart_txb_block
|
||||
pla
|
||||
rts
|
||||
|
||||
_cgetc:
|
||||
@2: lda _lastchar
|
||||
beq @2
|
||||
stz _lastchar
|
||||
rts
|
||||
Reference in New Issue
Block a user