megademo: more fussing with the loader

This commit is contained in:
Vince Weaver 2018-10-13 14:42:51 -04:00
parent 66985e6a1d
commit d8b6bb8898
5 changed files with 67 additions and 35 deletions

View File

@ -1,10 +1,10 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $2000, size = $7E00, file = %O;
RAM: start = $2000, size = $A000, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro, align=$1000;
CODE: load = RAM, type = ro, align=$100;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;

View File

@ -7,9 +7,10 @@ PNG_TO_RLE = ../gr-utils/png2rle
all: megademo.dsk
megademo.dsk: MEGADEMO MEGALOAD
megademo.dsk: MEGADEMO MEGALOAD c64.img
$(DOS33) -y megademo.dsk BSAVE -a 0x4000 MEGADEMO
$(DOS33) -y megademo.dsk BSAVE -a 0x800 MEGALOAD
$(DOS33) -y megademo.dsk BSAVE -a 0x2000 c64.img C64.IMG
# $(DOS33) -y megademo.dsk RAWWRITE -t 27 -s 0 MEGADEMO MEGA2
# $(DOS33) -y megademo.dsk BSAVE -a 0x4000 D_HGRC.BIN
# $(DOS33) -y megademo.dsk BSAVE -a 0x4000 FS_HGRC.BIN

View File

@ -24,24 +24,24 @@ c64_opener:
bit HIRES ; hires mode !!!
bit SET_GR ; graphics mode
lda #<c64
sta LZ4_SRC
lda #>c64
sta LZ4_SRC+1
; lda #<c64
; sta LZ4_SRC
; lda #>c64
; sta LZ4_SRC+1
lda #<(c64_end-8) ; skip checksum at end
sta LZ4_END
lda #>(c64_end-8) ; skip checksum at end
sta LZ4_END+1
; lda #<(c64_end-8) ; skip checksum at end
; sta LZ4_END
; lda #>(c64_end-8) ; skip checksum at end
; sta LZ4_END+1
lda #<$2000
sta LZ4_DST
lda #>$2000
sta LZ4_DST+1
; lda #<$2000
; sta LZ4_DST
; lda #>$2000
; sta LZ4_DST+1
jsr lz4_decode
; jsr lz4_decode
jsr wait_until_keypress
@ -370,11 +370,11 @@ done_c64:
;===================
; graphics
; c64 graphic, load at $2000-$4000 to start with
;===================
c64:
.incbin "c64.img.lz4",11
c64_end:
;c64:
;.incbin "c64.img"
;c64_end:
;=========================================================

View File

@ -6,6 +6,16 @@
.include "hardware.inc"
;===================
; graphics
;===================
;c64: ; this should end up at $2000-$4000
;.incbin "c64.img"
;c64_end:
real_start: ; this should end up at $4000
;===================
; Check for Apple II and patch
;===================
@ -25,8 +35,6 @@ apple_iie:
;===================
jsr HOME
jsr waterfall
; C64 Opening Sequence
jsr c64_opener
@ -49,7 +57,7 @@ apple_iie:
; Leaving house
; Riding bird
; jsr bird_mountain
jsr bird_mountain
; Waterfall
jsr waterfall
@ -58,7 +66,7 @@ apple_iie:
jsr rocket_takeoff
; mode7 (???)
; jsr mode7_flying
jsr mode7_flying
; Fly in space
@ -66,7 +74,7 @@ apple_iie:
; Fireworks
; jsr fireworks
jsr fireworks
; Game over
game_over_man:
@ -95,11 +103,11 @@ loop_forever:
.align $100
.include "fireworks.s"
.include "hgr.s"
; .include "bird_mountain.s"
.include "bird_mountain.s"
.include "move_letters.s"
.align $100
.include "gr_putsprite.s"
; .include "mode7.s"
.include "mode7.s"
.include "takeoff.s"
.include "waterfall.s"

View File

@ -18,15 +18,30 @@
step = $fd ; state for stepper motor
tmptrk = $fe ; temporary copy of current track
phase = $ff ; current phase for /seek
dirbuf = $400
dirbuf = $1e00 ; note, don't put this immediately below
; the value being read as destaddr-4
; is temporarily overwritten during read
; process
; note also, can't load file bigger than $8000 (32k) in size?
; seems to break things?
start:
jsr init ; unhook DOS, init nibble table
; open and read a file
lda #<file_to_read
lda #<megademo_filename
sta namlo
lda #>file_to_read
lda #>megademo_filename
sta namhi
jsr opendir ; open and read entire file into memory
; open and read a file
lda #<c64_filename
sta namlo
lda #>c64_filename
sta namhi
jsr opendir ; open and read entire file into memory
@ -34,12 +49,18 @@ start:
; filename to open is 30-character Apple text:
file_to_read: ;.byte "MEGADEMO "
megademo_filename: ;.byte "MEGADEMO "
.byte 'M'|$80,'E'|$80,'G'|$80,'A'|$80,'D'|$80,'E'|$80,'M'|$80,'O'|$80
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0
c64_filename: ;.byte "C64.IMG "
.byte 'C'|$80,'6'|$80,'4'|$80,'.'|$80,'I'|$80,'M'|$80,'G'|$80,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0
;unhook DOS and build nibble table
@ -159,6 +180,7 @@ foundname:
lda filbuf
sbc #4
sta adrlo
lda filbuf+1
sbc #0
sta adrhi
@ -183,6 +205,7 @@ L5:
adc #3
sta sizelo
sta secsize
lda filbuf+3
adc #0
sta sizehi
@ -462,7 +485,7 @@ sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f
; From $BA96 of DOS33
nibtbl = *
nibtbl: .res 128 ; = *
; .byte $00,$01,$98,$99,$02,$03,$9C,$04 ; $BA96 ; 00
; .byte $05,$06,$A0,$A1,$A2,$A4,$A4,$A5 ; $BA9E ; 08
; .byte $07,$08,$A8,$A9,$AA,$09,$0A,$0B ; $BAA6 ; 10
@ -481,7 +504,7 @@ nibtbl = *
; .byte $00,$00,$00,$00,$00,$00,$00,$00
bit2tbl = nibtbl+128
filbuf = bit2tbl+86
dataend = filbuf+4
bit2tbl: .res 86 ; = nibtbl+128
filbuf: .res 4 ; = bit2tbl+86
;dataend = filbuf+4