Get super simple kernel code running

This commit is contained in:
Byron Lathi
2023-08-26 13:09:02 -07:00
parent 3487f35af8
commit 0247565f49
5 changed files with 205 additions and 382 deletions

View File

@@ -11,7 +11,7 @@
fatbuf = $A000
filebuf = $B000
.zeropage
.bss
tbase: .res 2
tlen: .res 2
@@ -20,6 +20,11 @@ dlen: .res 2
olen: .res 1
otype: .res 1
filesiz: .res 1
cluster: .res 2
.zeropage
userptr: .res 2
.segment "BOOTLOADER"
@@ -283,8 +288,6 @@ _start:
ldy #$4
jsr _cprintf
;void* __fastcall__ memcpy (void* dest, const void* src, size_t count);
lda tbase
ldx tbase + 1
jsr pushax
@@ -299,12 +302,39 @@ _start:
ldx #>$1000
jsr _SD_printBuf
lda userptr + 1
adc tlen + 1
tax
lda userptr
adc tlen
bcc @7
inx
@7: sta userptr
stx userptr + 1
lda #<word_str
ldx #>word_str
jsr pushax
lda userptr
ldx userptr + 1
jsr pushax
ldy #$4
jsr _cprintf
lda dbase
ldx dbase + 1
jsr pushax
lda userptr
ldx userptr + 1
jsr pushax
lda dlen
ldx dlen + 1
jsr _memcpy
jmp $1000
@end: bra @end
filesiz: .res 1
cluster: .res 2
str: .asciiz "boot2\r\n"
kernel_str: .asciiz "KERNEL O65"
_good: .asciiz "Found KERNEL\r\n"

View File

@@ -5,7 +5,7 @@
; Startup code for cc65 (Single Board Computer version)
.export _init, _exit
.import _main
.import _main, _cputc
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import __STACKSTART__, __STACKSIZE__ ; Linker generated
@@ -22,7 +22,12 @@
; ---------------------------------------------------------------------------
; A little light 6502 housekeeping
_init: LDX #$FF ; Initialize stack pointer to $01FF
_init:
lda #'A'
jsr _cputc
@1: jmp @1
LDX #$FF ; Initialize stack pointer to $01FF
TXS
CLD ; Clear decimal mode