diff --git a/mode7/scroller.c b/mode7/scroller.c index c5ff93b2..c134dc00 100644 --- a/mode7/scroller.c +++ b/mode7/scroller.c @@ -1,6 +1,8 @@ #include #include #include +#include +#include static unsigned char font[256][9]={ {0,0,0,0,0,0,0,0,0}, // 0 @@ -662,5 +664,17 @@ int main(int argc, char **argv) { printf("; Compressed size = %d bytes\n",new_size); + int fd; + + fd=open("scroll.raw",O_CREAT|O_WRONLY,0666); + if (fd<0) { + fprintf(stderr,"Error opening\n"); + exit(1); + } + for(y=0;y<4;y++) { + write(fd,&row[y],256); + } + close(fd); + return 0; } diff --git a/xmas_2018/Makefile b/xmas_2018/Makefile index 7b6a058f..3c61d669 100644 --- a/xmas_2018/Makefile +++ b/xmas_2018/Makefile @@ -27,7 +27,7 @@ xmas2018.o: xmas2018.s \ vapor_lock.s delay_a.s wait_keypress.s \ play_music.s mockingboard.s rts.s \ wreath.s wreath.img.lz4 sprites.inc \ - ball.s ball.img.lz4 greets.inc gr_scroll.s \ + ball.s ball.img.lz4 greets.raw.lz4 gr_scroll.s \ merry.s merry.img.lz4 ca65 -o xmas2018.o xmas2018.s -l xmas2018.lst diff --git a/xmas_2018/README b/xmas_2018/README index 7d8e38dc..057e5b78 100644 --- a/xmas_2018/README +++ b/xmas_2018/README @@ -4,11 +4,15 @@ Memory Map: 01 Stack 02-03 Reserved 04-07 GR PAGE0 - 08-0b GR PAGE1 + 08-0b GR PAGE1 (scroll text) 0c-1f CODE (5k) 20-3f HGR PAGE0 (wreath) 40-5f HGR PAGE1 (ball) 60-7f (merry) 80-9f (music) - a0-bf (staging) + a0-bf (music) c0-ff RESERVED/ROM + +SIZE: + 3903 -- 12/18 + 3647 -- use LZ4 encryption on scroll text diff --git a/xmas_2018/ball.s b/xmas_2018/ball.s index 40b36100..f0122c0d 100644 --- a/xmas_2018/ball.s +++ b/xmas_2018/ball.s @@ -31,13 +31,25 @@ ball: ;============================= ; decompress scroll image to $800 - lda #>a2_scroll - sta INH - lda #greets + sta LZ4_SRC+1 - jsr decompress_scroll + lda #<(greets_end-8) ; skip checksum at end + sta LZ4_END + lda #>(greets_end-8) ; skip checksum at end + sta LZ4_END+1 + lda #<$800 + sta LZ4_DST + lda #>$800 + sta LZ4_DST+1 + + jsr lz4_decode + + lda #237 + sta SCROLL_LENGTH ;============================== ; setup graphics for vapor lock @@ -231,4 +243,6 @@ ball_done: .include "gr_scroll.s" -.include "greets.inc" +greets: +.incbin "greets.raw.lz4",11 +greets_end: diff --git a/xmas_2018/gr_scroll.s b/xmas_2018/gr_scroll.s index aa3fb483..3b78fb6b 100644 --- a/xmas_2018/gr_scroll.s +++ b/xmas_2018/gr_scroll.s @@ -63,83 +63,3 @@ no_wrap: done_wrap: rts ; 6 - ;======================= - ; decompress scroll - ;======================= -decompress_scroll: - ldy #0 - jsr scroll_load_and_increment - sta SCROLL_LENGTH - - lda #scroll_row1 - sta OUTH - -decompress_scroll_loop: - jsr scroll_load_and_increment ; load compressed value - - cmp #$A1 ; EOF marker - beq done_decompress_scroll ; if EOF, exit - - pha ; save - - and #$f0 ; mask - cmp #$a0 ; see if special AX - beq decompress_scroll_special - - pla ; note, PLA sets flags! - - ldx #$1 ; only want to print 1 - bne decompress_scroll_run - -decompress_scroll_special: - pla - - and #$0f ; check if was A0 - - bne decompress_scroll_color ; if A0 need to read run, color - -decompress_scroll_large: - jsr scroll_load_and_increment ; get run length - -decompress_scroll_color: - tax ; put runlen into X - jsr scroll_load_and_increment ; get color - -decompress_scroll_run: - sta (OUTL),Y - pha - - clc ; increment 16-bit pointer - lda OUTL - adc #$1 - sta OUTL - lda OUTH - adc #$0 - sta OUTH - - pla - - dex ; repeat for X times - bne decompress_scroll_run - - beq decompress_scroll_loop ; get next run - -done_decompress_scroll: - rts - - -scroll_load_and_increment: - lda (INL),Y ; load and increment 16-bit pointer - pha - clc - lda INL - adc #$1 - sta INL - lda INH - adc #$0 - sta INH - pla - rts - diff --git a/xmas_2018/greets.raw.lz4 b/xmas_2018/greets.raw.lz4 new file mode 100644 index 00000000..40530a02 Binary files /dev/null and b/xmas_2018/greets.raw.lz4 differ