Fixed bug in loader

This commit is contained in:
blondie7575 2023-06-18 18:14:41 -07:00
parent e1d1e86258
commit 730bce2601
2 changed files with 35 additions and 9 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcdebugger /GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcdebugger
/loader.lst /loader.lst
/terrain_e1.lst /terrain_e1.lst
/gscats.2mg

View File

@ -24,11 +24,26 @@ main:
.addr fileOpenCode .addr fileOpenCode
bne ioError bne ioError
; Load the code into bank 0 ; Load first half of code into bank 0
jsr PRODOS jsr PRODOS
.byte $ca .byte $ca
.addr fileRead .addr fileRead
bne ioError bne ioError
NATIVE
; Copy code into bank 2
ldx fileReadLen
lda #2
ldy #0
jsr copyBytes
EMULATION
; Load rest of code into bank 0 (needed if code size exceeds BUFFERSIZE)
; jsr PRODOS
; .byte $ca
; .addr fileRead
; bne ioError
; Close the file ; Close the file
jsr PRODOS jsr PRODOS
@ -37,11 +52,11 @@ main:
NATIVE NATIVE
; Copy code into bank 2 ; Copy rest code into bank 2 (needed if code size exceeds BUFFERSIZE)
ldx fileReadLen ; ldx fileReadLen
lda #2 ; lda #2
ldy #0 ; ldy #0
jsr copyBytes ; jsr copyBytes
EMULATION EMULATION
@ -156,12 +171,18 @@ vramRowInvertedSpanLookupEnd:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; copyBytes ; copyBytes
; Copy data from read buffer in bank 0 to ; Copy data from read buffer in bank 0 to
; bottom of any other bank. Must be in native mode. ; offset any other bank. Must be in native mode.
; ;
; X = Length of data in bytes ; X = Length of data in bytes
; Y = Origin within bank ; Y = Origin within bank
; A = Bank number of destination ; A = Bank number of destination
; loadOffet : offset to start of copy destination
; ;
;TODO: Make this work for copying ALL of a 64k bank of code
;in chunks, as required by loader (which is using a bank 00 buffer)
copyBytes: copyBytes:
sty copyBytesDest+1 sty copyBytesDest+1
sty copyBytesDest2+1 sty copyBytesDest2+1
@ -187,7 +208,8 @@ copyBytesDest:
sta $010000,x sta $010000,x
dex dex
dex dex
bpl copyBytesLoop cpx #$fffe ; X will wrap when we're done
bne copyBytesLoop
rts rts
copyBytesOdd: copyBytesOdd:
@ -199,6 +221,9 @@ copyBytesDest2:
BITS16 BITS16
bra copyBytesEven bra copyBytesEven
loadOffet:
.word 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fileOpenCode: fileOpenCode:
@ -239,4 +264,4 @@ codePath:
codePathE1: codePathE1:
pstring "/GSAPP/CODEBANKE1" pstring "/GSAPP/CODEBANKE1"
spritePath: spritePath:
pstring "/GSAPP/SPRITEBANK00" pstring "/GSAPP/SPRITEBANK"