diff --git a/xmas_2018/Makefile b/xmas_2018/Makefile index 6ce0c275..916ec05f 100644 --- a/xmas_2018/Makefile +++ b/xmas_2018/Makefile @@ -7,13 +7,13 @@ PNG_TO_RLE = ../gr-utils/png2rle all: xmas2018.dsk -xmas2018.dsk: HELLO XMAS2018 wreath.img.lz4t ball.img.lz4 merry.img.lz4 MUSIC.lz4 +xmas2018.dsk: HELLO XMAS2018 wreath.img.lz4t ball.img.lz4 merry.img.lz4t MUSIC.lz4t $(DOS33) -y xmas2018.dsk SAVE A HELLO $(DOS33) -y xmas2018.dsk BSAVE -a 0x1000 XMAS2018 $(DOS33) -y xmas2018.dsk BSAVE -a 0xa000 wreath.img.lz4t WREATH.LZ4 $(DOS33) -y xmas2018.dsk BSAVE -a 0xa000 ball.img.lz4 BALL.LZ4 - $(DOS33) -y xmas2018.dsk BSAVE -a 0xa000 merry.img.lz4 MERRY.LZ4 - $(DOS33) -y xmas2018.dsk BSAVE -a 0x6000 MUSIC.lz4 MUSIC.LZ4 + $(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 merry.img.lz4t MERRY.LZ4 + $(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 MUSIC.lz4t MUSIC.LZ4 # $(DOS33) -y xmas2018.dsk BSAVE -a 0x2000 wreath.img WREATH.IMG $(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 ball.img BALL.IMG @@ -33,6 +33,10 @@ xmas2018.o: xmas2018.s \ #### +MUSIC.lz4t: MUSIC.lz4 + dd if=MUSIC.lz4 of=MUSIC.lz4t bs=1 skip=11 + truncate MUSIC.lz4t -s -8 + MUSIC.lz4: MUSIC lz4 -16 -f MUSIC @@ -49,6 +53,10 @@ HELLO: hello.bas #### +merry.img.lz4t: merry.img.lz4 + dd if=merry.img.lz4 of=merry.img.lz4t bs=1 skip=11 + truncate merry.img.lz4t -s -8 + merry.img.lz4: merry.img lz4 -f -16 merry.img diff --git a/xmas_2018/README b/xmas_2018/README index cee8f1a2..23cd060f 100644 --- a/xmas_2018/README +++ b/xmas_2018/README @@ -19,3 +19,4 @@ SIZE: 3903 -- add in support for all 5 candles 3647 -- make sprites non-transparent 3903 -- turn all flames back on + 3853 -- stop padding filenames diff --git a/xmas_2018/rts.s b/xmas_2018/rts.s index 5c1c31b4..89f25bf5 100644 --- a/xmas_2018/rts.s +++ b/xmas_2018/rts.s @@ -4,7 +4,10 @@ ; modified to assembled with ca64 -- vmw ; added code to patch it to run from current disk slot -- vmw -; also stores filesize in ldsizel:ldsizeh +; USAGE: +; file to load in namlo:namhi +; Loads file contents to addr from filesystem +; also stores filesize in ldsizel:ldsizeh dirbuf = $900 ; note, don't put this immediately below @@ -12,55 +15,21 @@ ; is temporarily overwritten during read ; process - - ; note also, can't load file bigger than $8000 (32k) in size? - ; seems to break things? - ;====================== - ; open and read a file -; lda #md000_filename -; sta namhi -; jsr opendir ; open and read entire file into memory - ; filename to open is 30-character Apple text: -;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 - -;m1000_filename: ;.byte "MUSIC.1000 " -; .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'1'|$80,'0'|$80 -; .byte '0'|$80,'0'|$80,$A0,$A0,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0 - -;md000_filename: ;.byte "MUSIC.D000 " -; .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'D'|$80,'0'|$80 -; .byte '0'|$80,'0'|$80,$A0,$A0,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0 - -;md000x2_filename: ;.byte "MUSIC.D000X2 " -; .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'D'|$80,'0'|$80 -; .byte '0'|$80,'0'|$80,'X'|$80,'2'|$80,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 -; .byte $A0,$A0,$A0,$A0,$A0,$A0 - +filename: + .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,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0 +;======================================================= +;======================================================= +;======================================================= ;unhook DOS and build nibble table - rts_init: ; patch to use current drive @@ -129,6 +98,45 @@ L3: inx ; increment x x=4, a=0f rts + +;======================================================= +;======================================================= +;======================================================= + + ; filename in OUTL:OUTH + +opendir_filename: + + ; clear out the filename with $A0 (space) + + lda #filename + sta namhi + + ldy #29 +wipe_filename_loop: + lda #$A0 + sta (namlo),Y + dey + bpl wipe_filename_loop + + ldy #0 +copy_filename_loop: + lda (OUTL),Y + beq copy_filename_done + sta (namlo),Y + iny + bne copy_filename_loop + +copy_filename_done: + + ; fallthrough + +;======================================================= +;======================================================= +;======================================================= + ;=========================== ; opendir ;=========================== diff --git a/xmas_2018/xmas2018.s b/xmas_2018/xmas2018.s index 7c53f058..7dc5fcc8 100644 --- a/xmas_2018/xmas2018.s +++ b/xmas_2018/xmas2018.s @@ -5,14 +5,7 @@ .include "zp.inc" .include "hardware.inc" -; external routines - -;play_music=$1000 -;mockingboard_init=$1100 -;mockingboard_mute=$11a1 - - -xmas2018_start: ; this should end up at $4000 +xmas2018_start: ;=================== ; Check for Apple II and patch @@ -22,7 +15,7 @@ xmas2018_start: ; this should end up at $4000 cmp #6 beq apple_iie -; lda #$54 ; patch the check_email font code +; lda #$54 ; ; sta ce_patch+1 @@ -39,15 +32,14 @@ apple_iie: ;=================== ; load WREATH.LZ4 to $a000 + ; then decompress it to $2000 (HGR PAGE0) lda #wreath_filename - sta namhi - jsr opendir ; open and read entire file into memory + sta OUTH + jsr opendir_filename ; open and read entire file into memory - ; decompress to $2000 - ; decompress from $a000 ; size in ldsizeh:ldsizel (f1/f0) clc @@ -73,31 +65,61 @@ apple_iie: jsr lz4_decode + ; load MERRY.LZ4 to $4000 + ; then decompress it to $6000 + + lda #merry_filename + sta OUTH + jsr opendir_filename ; open and read entire file into memory + + ; size in ldsizeh:ldsizel (f1/f0) + + clc + lda #<($4000) + sta LZ4_SRC + adc ldsizel + sta LZ4_END + + lda #>($4000) + sta LZ4_SRC+1 + adc ldsizeh + sta LZ4_END+1 + + lda #<$6000 + sta LZ4_DST + lda #>$6000 + sta LZ4_DST+1 + + jsr lz4_decode + + ;=================== ; Load music ;=================== - ; load MUSIC.LZ4 to $6000 + ; load MUSIC.LZ4 to $4000 lda #music_filename - sta namhi - jsr opendir ; open and read entire file into memory + sta OUTH + jsr opendir_filename ; open and read entire file into memory ; decompress to $8000 - ; decompress from $8000 - ; size in ??? + ; decompress from $4000 + ; size in ldsizeh:ldsizel (f1/f0) - - lda #<($6000+11) + clc + lda #<($4000) sta LZ4_SRC - lda #>($6000+11) - sta LZ4_SRC+1 - - lda #<($6000+865-8) ; skip checksum at end + adc ldsizel sta LZ4_END - lda #>($6000+865-8) ; skip checksum at end + + lda #>($4000) + sta LZ4_SRC+1 + adc ldsizeh sta LZ4_END+1 lda #<$8000 @@ -110,10 +132,10 @@ apple_iie: ; load BALL.IMG to $4000 lda #ball_filename - sta namhi - jsr opendir ; open and read entire file into memory + sta OUTH + jsr opendir_filename ; open and read entire file into memory ;================== ; Init mockingboard @@ -161,71 +183,23 @@ game_over_man: .include "vapor_lock.s" .include "delay_a.s" .include "wait_keypress.s" -; .include "random16.s" -; .include "hgr.s" -; .include "move_letters.s" .include "gr_putsprite.s" ; .include "text_print.s" -; .include "screen_split.s" - .include "play_music.s" -;============================ -; Include Sprites -;============================ -;.align $100 -; .include "tfv_sprites.inc" -; .include "mode7_sprites.inc" - - - -;================================= -; Include Text for Sliding Letters -; *DONT CROSS PAGES* -;================================= -;.include "letters.s" - -;============================ -; Include Lores Graphics -; No Alignment Needed -;============================ - -;============================ -; Include Hires Graphics -; No Alignment Needed -; FIXME: we can save 8 bytes per file by stripping checksums off end -;============================ - -;wreath_hgr: -;.incbin "wreath.img.lz4",11 -;wreath_hgr_end: - -;ball_hgr: -;.incbin "ball.img.lz4",11 -;ball_hgr_end: - -;merry_hgr: -;.incbin "merry.img.lz4",11 -;merry_hgr_end: - - - ; filename to open is 30-character Apple text: -wreath_filename: ;.byte "WREATH.LZ4 " - .byte 'W'|$80,'R'|$80,'E'|$80,'A'|$80,'T'|$80,'H'|$80,'.'|$80,'L'|$80 - .byte 'Z'|$80,'4'|$80,$A0,$A0,$A0,$A0,$A0,$A0 - .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 - .byte $A0,$A0,$A0,$A0,$A0,$A0 +wreath_filename: ; .byte "WREATH.LZ4",0 + .byte 'W'|$80,'R'|$80,'E'|$80,'A'|$80,'T'|$80,'H'|$80,'.'|$80,'L'|$80 + .byte 'Z'|$80,'4'|$80,$00 -ball_filename: ;.byte "BALL.IMG " +merry_filename: ;.byte "MERRY.LZ4",0 + .byte 'M'|$80,'E'|$80,'R'|$80,'R'|$80,'Y'|$80,'.'|$80,'L'|$80,'Z'|$80 + .byte '4'|$80,$00 + +ball_filename: ;.byte "BALL.IMG",0 .byte 'B'|$80,'A'|$80,'L'|$80,'L'|$80,'.'|$80,'I'|$80,'M'|$80,'G'|$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 + .byte $00 - -music_filename: ;.byte "MUSIC.LZ4 " +music_filename: ;.byte "MUSIC.LZ4",0 .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'L'|$80,'Z'|$80 - .byte '4'|$80,$A0,$A0,$A0,$A0,$A0,$A0,$A0 - .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 - .byte $A0,$A0,$A0,$A0,$A0,$A0 + .byte '4'|$80,$0