From b59e4f43643f94e23fa15c5a9a6a5264a6432ec0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 23 Dec 2023 01:28:27 -0500 Subject: [PATCH] xmas_2023: hook up scroll text --- demos/xmas_2023/Makefile | 5 ++- demos/xmas_2023/fireplace.s | 47 +++++++++++++++++-- demos/xmas_2023/gr_scroll.s | 67 ++++++++++++++++++++++++++++ demos/xmas_2023/graphics/Makefile | 7 ++- demos/xmas_2023/graphics/greets.raw | Bin 0 -> 1024 bytes demos/xmas_2023/zp.inc | 5 +++ graphics/gr/scroll_text/scroller.c | 38 ++++++++-------- 7 files changed, 143 insertions(+), 26 deletions(-) create mode 100644 demos/xmas_2023/gr_scroll.s create mode 100644 demos/xmas_2023/graphics/greets.raw diff --git a/demos/xmas_2023/Makefile b/demos/xmas_2023/Makefile index b049d87d..6fa6445c 100644 --- a/demos/xmas_2023/Makefile +++ b/demos/xmas_2023/Makefile @@ -125,9 +125,10 @@ XMAS: xmas.o xmas.o: xmas.s plasma_tree.s fireplace.s \ zp.inc hardware.inc qload.inc \ - vapor_lock.s \ + vapor_lock.s gr_scroll.s \ graphics/merry.hgr.zx02 \ - graphics/tree01.gr.zx02 + graphics/tree01.gr.zx02 \ + graphics/greets.raw.zx02 ca65 -o xmas.o xmas.s -l xmas.lst diff --git a/demos/xmas_2023/fireplace.s b/demos/xmas_2023/fireplace.s index 245ba90f..d8af2991 100644 --- a/demos/xmas_2023/fireplace.s +++ b/demos/xmas_2023/fireplace.s @@ -17,9 +17,6 @@ fireplace: lda #160 sta HGR_COPY_Y2 - lda #$DD - sta FIRE_COLOR - bit SET_GR bit LORES bit FULLGR @@ -80,6 +77,11 @@ early_out: bit PAGE1 + lda #$DD + sta FIRE_COLOR + + + ; attempt vapor lock jmp pad_skip @@ -255,7 +257,7 @@ do_flicker: ; 8 lda FIRE_COLOR ; 3 - eor #$00 ; 2 + eor #$0D ; 2 sta FIRE_COLOR ; 3 sta $9A8+34 ; 4 sta $9A8+35 ; 4 @@ -344,6 +346,12 @@ done_cycle_count: no_music: + ;========================= + ; main fireplace loop + + lda #$DD + sta FIRE_COLOR + new_loop: ; bring in wait_until_interrupt @@ -371,8 +379,39 @@ frame_noflo2: totally_done_fireplace: bit KEYRESET + + + ;================================= + ; scroller + + lda #0 + sta OFFSET + + lda #greets_raw_zx02 + sta zx_src_h+1 + lda #$20 + jsr zx02_full_decomp + + bit FULLGR +do_scroll: + + jsr scroll_loop + + lda #255 + jsr wait + + jmp do_scroll + rts + +.include "gr_scroll.s" + +greets_raw_zx02: +.incbin "graphics/greets.raw.zx02" + fireplace_data: .byte SET_COLOR | YELLOW diff --git a/demos/xmas_2023/gr_scroll.s b/demos/xmas_2023/gr_scroll.s new file mode 100644 index 00000000..14c44617 --- /dev/null +++ b/demos/xmas_2023/gr_scroll.s @@ -0,0 +1,67 @@ +scroll_row1 = $2000 +scroll_row2 = $2100 +scroll_row3 = $2200 +scroll_row4 = $2300 + +;SCROLL_LENGTH = $63 +;OFFSET = $62 + + + ; 5 + (45*40) +4 + 13 + 7 + 6 = 1835 + +scroll_loop: + + ldx #0 ; 2 + ldy OFFSET ; 3 + +draw_loop: + + lda scroll_row1,Y ; 4 + sta $A50,X ; 5 + lda scroll_row2,Y ; 4 + sta $Ad0,X ; 5 + lda scroll_row3,Y ; 4 + sta $B50,X ; 5 + lda scroll_row4,Y ; 4 + sta $Bd0,X ; 5 + + iny ; 2 + inx ; 2 + cpx #40 ; 2 + bne draw_loop ; 2nt/3 + ;=============== + ; 45 + + + ; -1 + inc OFFSET ; 5 + ;============ + ; 4 + ;================== + ; wrap scrolltext + ;================== + clc ; 2 + lda OFFSET ; 3 + adc #40 ; 2 + cmp SCROLL_LENGTH ; 3 + + bne no_wrap ; 3 + ;============ + ; 13 + + ; -1 + lda #0 ; 2 + sta OFFSET ; 3 + jmp done_wrap ; 3 +no_wrap: + lda $0 ; 3 + nop ; 2 + nop ; 2 + ;=========== + ; 7 + +done_wrap: + rts ; 6 + + +;.assert >scroll_loop = >done_wrap, error, "gr_scroll crosses page" diff --git a/demos/xmas_2023/graphics/Makefile b/demos/xmas_2023/graphics/Makefile index c2eb57a8..7ad409c1 100644 --- a/demos/xmas_2023/graphics/Makefile +++ b/demos/xmas_2023/graphics/Makefile @@ -8,7 +8,12 @@ all: tree01.gr.zx02 tree03.gr.zx02 \ tree05.gr.zx02 tree07.gr.zx02 \ tree09.gr.zx02 tree11.gr.zx02 \ tree13.gr.zx02 tree15.gr.zx02 \ - merry.hgr.zx02 + merry.hgr.zx02 greets.raw.zx02 + +#### + +greets.raw.zx02: greets.raw + $(ZX02) greets.raw greets.raw.zx02 #### diff --git a/demos/xmas_2023/graphics/greets.raw b/demos/xmas_2023/graphics/greets.raw new file mode 100644 index 0000000000000000000000000000000000000000..a30afaf69596fe567dd7395dc1053e5037164277 GIT binary patch literal 1024 zcmchVF|LC^5JOj5i7FBsrTHZl=SV?G?uwKHgh-T>{{U39T;V@^Abs>DMj4OC_Cka< zrElsH;fB$qh7!OHNGdclwuTOqd5D@ekP0O*W!0o*7&MNEV?YFCUq4hwPN?oTKEPTn z)tXkl5ik>2@caZ0kz^H)r_Z51^$6g(Lmsjv);vhtBVmK#N+0|8_1%x6XVv}Db$7jN zb8mGGt?MPgD#jw=2tX8Y!8bWFckQJ|07H5)1#Tm&T+R=%J7x)W?58=+)43m@{KSoG z`2%fgb?u=rfqp8jqPt9}3Y~NX=NR`tw3{5@mU1as%nh;uTy{FAaw`$Dq(k#`0WW-n G|J5IZxLI@n literal 0 HcmV?d00001 diff --git a/demos/xmas_2023/zp.inc b/demos/xmas_2023/zp.inc index 0424efda..04cf43f5 100644 --- a/demos/xmas_2023/zp.inc +++ b/demos/xmas_2023/zp.inc @@ -248,6 +248,11 @@ HGR_COPY_Y1 = $F1 HGR_COPY_Y2 = $F2 FIRE_COLOR = $F3 +SCROLL_LENGTH = $F4 +OFFSET = $F5 + + + ;============================================== ; $FC-$FF we use for in/out pointers ;============================================== diff --git a/graphics/gr/scroll_text/scroller.c b/graphics/gr/scroll_text/scroller.c index c134dc00..75e92cf7 100644 --- a/graphics/gr/scroll_text/scroller.c +++ b/graphics/gr/scroll_text/scroller.c @@ -104,28 +104,27 @@ static unsigned char font[256][9]={ 0x80, // ** 0xe0, // ****** }, - + {4, + 0x00, + 0xC0, // **** + 0x20, // ** + 0x20, // ** + 0x40, // ** + 0x20, // ** + 0x20, // ** + 0xC0, // **** + }, /* -**** ** ** ****** **** ****** - ** ** ** ** ** ** - ** ** ** ** ** ** - ** ****** **** **** ** - ** ** ** ** ** ** - ** ** ** ** ** ** -**** ** **** ** ** +** ** ****** **** ****** +** ** ** ** ** +** ** ** ** ** +****** **** **** ** + ** ** ** ** ** + ** ** ** ** ** + ** **** ** ** */ - {4, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - }, {4,0,0,0,0,0,0,0,0}, {4,0,0,0,0,0,0,0,0}, {4,0,0,0,0,0,0,0,0}, @@ -541,7 +540,8 @@ int main(int argc, char **argv) { // char string[]=" \001DEATER \002WAS \003HERE!!! "; // char string[]=" \001BY DEATER... \002A \010 PRODUCTION "; // char string[]=" \003\011APPLE ][ FOREVER\011 "; - char string[]=" \012 \001MERRY XMAS 2018 \003FROM DEATER \013 "; +// char string[]=" \012 \001MERRY XMAS 2018 \003FROM DEATER \013 "; + char string[]=" \012 \001MERRY XMAS 2023 \003FROM DESIRE \013 "; int length=0,width=0,x,y,i,j; int color,color1,color2; int which_color=0;