From a55dd470777a2ed79a9be33d71e0090f347dd686 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 24 Jan 2023 00:17:57 -0500 Subject: [PATCH] lovebyte2023: work on 128 byte entry --- demos/lovebyte2023/parallax_128/Makefile | 46 +++++ .../parallax_128/apple2_80_zp.inc | 12 ++ demos/lovebyte2023/parallax_128/file_id.diz | 8 + demos/lovebyte2023/parallax_128/hello.bas | 9 + demos/lovebyte2023/parallax_128/par_tiny.s | 180 ++++++++++++++++++ 5 files changed, 255 insertions(+) create mode 100644 demos/lovebyte2023/parallax_128/Makefile create mode 100644 demos/lovebyte2023/parallax_128/apple2_80_zp.inc create mode 100644 demos/lovebyte2023/parallax_128/file_id.diz create mode 100644 demos/lovebyte2023/parallax_128/hello.bas create mode 100644 demos/lovebyte2023/parallax_128/par_tiny.s diff --git a/demos/lovebyte2023/parallax_128/Makefile b/demos/lovebyte2023/parallax_128/Makefile new file mode 100644 index 00000000..c9e4ee40 --- /dev/null +++ b/demos/lovebyte2023/parallax_128/Makefile @@ -0,0 +1,46 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +EMPTYDISK = ../../../empty_disk/empty.dsk + +all: parallax128.dsk + +parallax128.dsk: HELLO PAR_TINY + cp $(EMPTYDISK) parallax128.dsk + $(DOS33) -y parallax128.dsk SAVE A HELLO + $(DOS33) -y parallax128.dsk BSAVE -a 0x80 PAR_TINY + +### + +submit: pied.zip + +pied32.zip: PAR_TINY par_tiny.s file_id.diz parallax128.dsk + mkdir -p lovebyte2022_pied + cp PAR_TINY ./lovebyte2022_pied + cp par_tiny.s ./lovebyte2022_pied + cp file_id.diz ./lovebyte2022_pied + cp parallax128.dsk ./lovebyte2022_pied + cp pied_720p.mp4 ./lovebyte2022_pied + zip -r pied32.zip lovebyte2022_pied + +#### + + +#### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +### + +PAR_TINY: pied57.o + ld65 -o PAR_TINY pied57.o -C ./apple2_80_zp.inc + +pied57.o: par_tiny.s + ca65 -o pied57.o par_tiny.s -l pied57.lst + +#### + +clean: + rm -f *~ *.o *.lst HELLO PAR_TINY *.zip diff --git a/demos/lovebyte2023/parallax_128/apple2_80_zp.inc b/demos/lovebyte2023/parallax_128/apple2_80_zp.inc new file mode 100644 index 00000000..af4af039 --- /dev/null +++ b/demos/lovebyte2023/parallax_128/apple2_80_zp.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $80, size = $80, type = rw; + RAM: start = $90, size = $8E00, file = %O; +} + +SEGMENTS { +CODE: load = RAM, type = ro; +RODATA: load = RAM, type = ro; +DATA: load = RAM, type = rw; +BSS: load = RAM, type = bss, define = yes; +ZEROPAGE: load = ZP, type = ro; +} diff --git a/demos/lovebyte2023/parallax_128/file_id.diz b/demos/lovebyte2023/parallax_128/file_id.diz new file mode 100644 index 00000000..efaf3a17 --- /dev/null +++ b/demos/lovebyte2023/parallax_128/file_id.diz @@ -0,0 +1,8 @@ +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + PARALLAX128 +------------------------------------- +Lo-res multi-directional parallax +116-byte Intro for Apple II +Lovebyte 2023 +by Deater / dSr + diff --git a/demos/lovebyte2023/parallax_128/hello.bas b/demos/lovebyte2023/parallax_128/hello.bas new file mode 100644 index 00000000..c0cfd938 --- /dev/null +++ b/demos/lovebyte2023/parallax_128/hello.bas @@ -0,0 +1,9 @@ +5 HOME +10 PRINT " PARALLAX -- A 116 BYTE APPLE II INTRO" +12 PRINT " FOR LOVEBYTE 2023" +15 PRINT " BY DEATER / DSR" +20 PRINT CHR$(4)"CATALOG" +25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN PAR_TINY'" +30 GET A$ +35 PRINT +40 PRINT CHR$(4)"BRUN PAR_TINY" diff --git a/demos/lovebyte2023/parallax_128/par_tiny.s b/demos/lovebyte2023/parallax_128/par_tiny.s new file mode 100644 index 00000000..65178d2b --- /dev/null +++ b/demos/lovebyte2023/parallax_128/par_tiny.s @@ -0,0 +1,180 @@ +; Lo-res Parallax + +; by deater (Vince Weaver) + +; 127 bytes -- initial +; 124 bytes -- remove un-needed jmp at end +; 122 bytes -- remove extraneous load +; 120 bytes -- switch to HGR2 for setting graphics +; 111 bytes -- calc graphics in a loop +; 106 bytes -- move to zero page +; 102 bytes -- make page value self-modifying code +; 101 bytes -- overlap some constants +; 99 bytes -- merge frame +; 116 bytes -- code to change direction + +; Zero Page +GBASL = $26 +GBASH = $27 + +X2 = $FC +COLORS = $FD +PAGE = $FE +YY = $FF + +; Soft Switches +SET_GR = $C050 ; Enable graphics +FULLGR = $C052 ; Full screen, no text +PAGE1 = $C054 ; Page1 +PAGE2 = $C055 ; Page2 +LORES = $C056 ; Enable LORES graphics + +; ROM routines +HGR2 = $F3D8 +GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) +SETGR = $FB40 + +.zeropage +.globalzp frames +.globalzp colors +.globalzp masks +.globalzp offsets +.globalzp page_smc +.globalzp horiz_smc + +parallax: + + ;=================== + ; init screen + +; jsr HGR2 ; set hires, full-screen + ; A/Y are 0 + ; note! Only can do this if $E6 is free + +; bit LORES ; set lores + + ; have to do it this way as above messes with $E7 + + jsr SETGR + bit FULLGR + +parallax_forever: + + inc frames ; next frame + + lda frames ; save frame values + lsr + sta frames+1 ; frame/2 + lsr + sta frames+2 ; frame/4 + lsr + lsr + lsr + and #$3 + tax + lda dir_horiz_lookup,X + sta horiz_smc +; lda dir_vert_lookup,X +; sta vert_smc + ;========================== + ; flip page + + lda page_smc+1 + lsr + lsr + tay + lda PAGE1,Y + + lda page_smc+1 + eor #$4 + sta page_smc+1 + + + ;======================== + ; setup for 23 lines + + lda #23 ; start YY at 23 + sta YY +yloop: + + ;===================================== + ; point GBASL/GBSAH to current line + + lda YY + jsr GBASCALC + + ; adjust for current draw page + + lda GBASH + clc +page_smc: + adc #0 ; PAGE + sta GBASH + + ;============== + ; current column (work backwards) + + ldy #39 ; set XX to 39 +xloop: + + lda #0 ; reset color to black + sta COLORS + + ldx #2 ; 3 layers of parallax + + ; calculate colors + ; color = (XX-FRAME)^(YY) + +color_loop: + ;=========================== + ; vertical scroll + + sec ; subtract frame from Y + tya +horiz_smc: + sbc frames,X + sta X2 ; store interim result + + lda YY ; get YY and adjust offset to look nicer + clc + adc offsets,X + adc frames,X + eor X2 + + and masks,X ; do the mask + + beq skip_color ; skip update if 0 + + lda colors,X ; load color + sta COLORS ; save for later +skip_color: + dex + bpl color_loop + + + + ;======================== + ; actually draw color + + lda COLORS + sta (GBASL),Y + + + dey ; loop XX from 39..0 + bpl xloop + + dec YY ; loop YY from 23..0 + bpl yloop + + bmi parallax_forever ; bra + + +masks: .byte $8,$4 ;,$2 ; overlap +offsets:.byte $2,$1,$0 +colors: .byte $1b,$26,$4c + +; ADC,X BIT,X SBC,X BIT,X +dir_horiz_lookup: .byte $75,$24,$F5,$24 + + +frames: