;M/C Kernal Disk loader system ;with Koalapaint multicolour bitmap and ;flashing border, by ;Richard Bayliss picvid = $2f40 ;Where the picture video RAM data is read piccol = $3328 ;Where the picture colour RAM data is read bgrcol = $3710 ;Where the bitmap background colour lies RunAddress = $080d ;SYS2061 - Exomizer/PuCrunch decrunch run address FileSize = FileNameEnd-FileName ;Length of file to load !to "loader.prg",cbm ;Generate BASIC SYS call *=$0801 !basic $c000 ;SYS 49152 ;Starting address where to relocate the bitmap from *=$1000 BitmapSource !bin "bin\zappic.prg",,2 ;Importing Koalapaint multicolour bitmap ;Generate main code *=$c000 ;SYS 49152 called - or $c000 set as jump address ;with Exomizer. sei ;Optional - LOCK OUT Action Replay/Retro ;replay fastload system. If you want your game to ;use it, remove the command jsr $ff8a jsr $ff8a lda #$7b ;Switch off screen for a little bit sta $d011 ;and black out! lda #$00 sta $d020 ;Set black border lda bgrcol ;Set bitmap default sta $d021 ;background colour lda #$01 ;Set VIC2 bank #$01 sta $dd00 ;bitmap will be moved at $a000-$bf40 lda #$18 ;Set VIC2 screen RAM charset+multicolour sta $d018 ;-Screen RAM $8400-$87e8 :) sta $d016 ;-Screen multicolour on ;One time relocation code. Basically, the ;loading picture's bitmap data MUST relocate ;to high memory. lda #$36 ;All KERNAL RAM set sta $01 ;Relocate low-mem picture bitmap data and shunt it RelocPic ;all the way to $a000 ldx #$00 RelSource lda BitmapSource,x ;Grab bitmap source address RelDest sta $a000,x ;Put to bitmap target address inx bne RelSource inc RelSource+2 ;Shift hibyte 1 address of bitmap source inc RelDest+2 ;Shift hibyte 2 address of bitmap destination lda RelSource+2 ;Check if source overrides $4000? cmp #$30 bne RelocPic ;Draw picture data to screen ldx #$00 DrawPicture lda picvid,x ;Fetch video RAM data and sta $8400,x ;place to VIDEO SCREEN RAM at $8400-$87e8 lda picvid+$100,x sta $8500,x lda picvid+$200,x sta $8600,x lda picvid+$2e8,x sta $86e8,x lda piccol,x ;Fetch colour RAM data and sta $d800,x ;place to COLOUR RAM at $d800-$dbe8 lda piccol+$100,x sta $d900,x lda piccol+$200,x sta $da00,x lda piccol+$2e8,x sta $dae8,x inx bne DrawPicture lda #$3b ;Switch to bitmap mode sta $d011 ;Main disk loader code (Based on one of the Codebase examples) DiskLoaderCode lda #BorderFlash ;press command sta $0329 lda #FileSize ;Set file size ldx #FileName ;Hibye address where filename text is relocated to jsr $ffbd ;Set filename lda #$01 ldx $ba ;Check existing device bne Default ;Default source device ldx #$08 ;Device set Default ldy #$00 ; jsr $ffba ;Call command SETLFS ldx #<$0801 ;Call BASIC load address lobyte ldy #>$0801 ;Call BASIC load address hibyte lda #$00 ;Grab default program load address jsr $ffd5 ;Load program bcs DiskOrLoadError sei ;Loading is finished. Default the C64's screen+char memort jsr $ff81 ;fast screen clear lda #$03 ;default VIC2 RAM sta $dd00 lda #$00 ;Black screen + border sta $d020 sta $d021 lda #$37 ;Restore basic Kernal vectors sta $01 cli jmp RunAddress ;Run the loaded program ;Load error has occurred. Switch the screen off ;and flash the screen. DiskOrLoadError lda #$00 sta $d011 inc $d020 jmp *-3 ;Loading flashing border effect (This ;can also be edited to add different ;loading stripes features. I have ;gone for the thin stripes method for ;a more professional look :) BorderFlash inc $d020 ;Thin stripes! dec $d020 jmp $f6fe BorderFlashEnd ;Filename of the program (Zap Fight 2 used as an example) !ct SCR FileName !text "ZAPFIGHT2" FileNameEnd