Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :BasicUpstart2(_start_)
- * = $080d "main code"
- .const LOADER_ADDR = 828
- .const srcPntr = $fb
- .const dstPntr = $fd
- _start_: {
- jsr displayScreen
- jsr relocateLoader
- jmp LOADER_ADDR
- }
- relocateLoader: {
- lda #<_loader_start
- sta srcPntr+0
- lda #>_loader_start
- sta srcPntr+1
- lda #<LOADER_ADDR
- sta dstPntr+0
- lda #>LOADER_ADDR
- sta dstPntr+1
- ldx #_loader_end-_loader_start
- ldy #0
- loaderLoop:
- lda (srcPntr),y
- sta (dstPntr),y
- inc srcPntr+0
- bne !+
- inc srcPntr+1
- !:
- inc dstPntr+0
- bne !+
- inc dstPntr+1
- !:
- dex
- bne loaderLoop
- rts
- }
- clearScreen: {
- lda #0
- ldx #$00
- clearLoop:
- sta $d800,x
- sta $d900,x
- sta $da00,x
- sta $db00,x
- inx
- bne clearLoop
- rts
- }
- displayScreen: {
- jsr clearScreen
- lda #$0b
- sta $d011
- lda #$00
- sta $d020
- lda $4710
- sta $d021
- ldx #$00
- copyLoop:
- lda $3f40,x
- sta $0400,x
- lda $4040,x
- sta $0500,x
- lda $4140,x
- sta $0600,x
- lda $4240,x
- sta $0700,x
- lda $4328,x
- sta $d800,x
- lda $4428,x
- sta $d900,x
- lda $4528,x
- sta $da00,x
- lda $4628,x
- sta $db00,x
- inx
- bne copyLoop
- lda #$3b
- sta $d011
- lda #$18
- sta $d018
- lda #$d8
- sta $d016
- rts
- }
- _loader_start:
- .pseudopc LOADER_ADDR {
- loadAndRunGame:
- lda #fileName_end - fileName
- ldx #<fileName
- ldy #>fileName
- jsr $FFBD // call SETNAM
- lda #$01
- ldx $BA // last used device number
- bne skip
- ldx #$08 // default to device 8
- skip:
- ldy #$01 // not $01 means: load to address stored in file
- jsr $FFBA // call SETLFS
- lda #$00 // $00 means: load to memory (not verify)
- jsr $FFD5 // call LOAD
- bcs error // if carry set, a load error has happened
- // start program
- jmp $080d
- error:
- sta $d020
- // Accumulator contains BASIC error code;
- // most likely errors:
- // A = $05 (DEVICE NOT PRESENT)
- // A = $04 (FILE NOT FOUND)
- // A = $1D (LOAD ERROR)
- // A = $00 (BREAK, RUN/STOP has been pressed during loading)
- rts
- fileName:
- .encoding "ascii"
- .text "ROGUEISH"
- fileName_end:
- }
- _loader_end:
- * = $2000 "image"
- image:{
- .import binary "graphics/ROGUEish titlescreen.koa",2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement