xmas24: more work on wipe

This commit is contained in:
Vince Weaver 2024-12-20 23:37:48 -05:00
parent b173ba6b37
commit 6eb2c8be63
8 changed files with 8161 additions and 177 deletions

View File

@ -9,7 +9,7 @@ LINKER_SCRIPTS = ../../linker_scripts/
all: xmas_2024.dsk
xmas_2024.dsk: QBOOT QLOAD music.inc qload.inc \
MUSIC XMAS
MUSIC XMAS WIPE_STAR_DATA
cp $(EMPTY_DISK) xmas_2024.dsk
$(DOS33_RAW) xmas_2024.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) xmas_2024.dsk 0 2 QBOOT 1 1
@ -17,6 +17,8 @@ xmas_2024.dsk: QBOOT QLOAD music.inc qload.inc \
$(DOS33_RAW) xmas_2024.dsk 1 0 QLOAD 0 0
$(DOS33_RAW) xmas_2024.dsk 4 0 MUSIC 0 0
$(DOS33_RAW) xmas_2024.dsk 12 0 XMAS 0 0
$(DOS33_RAW) xmas_2024.dsk 16 0 WIPE_STAR_DATA 0 0
####
@ -121,18 +123,21 @@ music.o: music.s zp.inc \
###
XMAS: xmas.o
ld65 -o XMAS xmas.o -C $(LINKER_SCRIPTS)/apple2_8000.inc
ld65 -o XMAS xmas.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
xmas.o: xmas.s \
zp.inc hardware.inc qload.inc \
wipe_star.s \
graphics/gp_hgr.zx02
ca65 -o xmas.o xmas.s -l xmas.lst
####
###
WIPE_STAR_DATA: wipe_star_data.o
ld65 -o WIPE_STAR_DATA wipe_star_data.o -C $(LINKER_SCRIPTS)/apple2_8100.inc
graphics/tree01.gr.zx02:
cd graphics && make
wipe_star_data.o: wipe_star_data.s
ca65 -o wipe_star_data.o wipe_star_data.s -l wipe_star_data.lst
###

View File

@ -6,6 +6,7 @@
hgr_make_tables:
.if 0
;=====================
; make /7 %7 tables
;=====================
@ -42,7 +43,7 @@ mod7_loop:
mod7_not7:
iny
bne mod7_loop
.endif
; Hposn table

View File

@ -4,7 +4,7 @@
.include "hardware.inc"
.include "music.inc"
;.include "common_defines.inc"
.include "common_defines.inc"
.include "qboot.inc"
qload_start:
@ -163,22 +163,22 @@ error_string:
.endif
which_disk_array:
.byte 1,1 ; MUSIC, XMAS
.byte 1,1,1 ; MUSIC, XMAS, WIPE_STAR_DATA
load_address_array:
.byte $D0,$80 ; MUSIC, XMAS
.byte $D0,$60,$81 ; MUSIC, XMAS, WIPE_STAR_DATA
start_address:
.byte $D0,$80 ; MUSIC, XMAS
.byte $D0,$60,$81 ; MUSIC, XMAS, WIPE_STAR_DATA
track_array:
.byte 4,12 ; MUSIC, XMAS
.byte 4,12,16 ; MUSIC, XMAS, WIPE_STAR_DATA
sector_array:
.byte 0,0 ; MUSIC, XMAS
.byte 0,0,0 ; MUSIC, XMAS, WIPE_STAR_DATA
length_array:
.byte 32,32 ; MUSIC, XMAS
.byte 32,32,60 ; MUSIC, XMAS, WIPE_STAR_DATA
PT3_ENABLE_APPLE_IIC = 1
@ -196,11 +196,6 @@ PT3_ENABLE_APPLE_IIC = 1
.include "pt3_lib_detect_model.s"
.include "pt3_lib_mockingboard_detect.s"
mod7_table = $1c00
div7_table = $1d00
hposn_low = $1e00
hposn_high = $1f00
.include "hgr_table.s"
qload_end:

View File

@ -126,6 +126,14 @@ done_set_message:
;=======================
load_xmas:
; load from disk
lda #2 ; load WIPE_DATA_STAR from disk
sta WHICH_LOAD ; to $8100
jsr load_file
; load from disk
lda #1 ; XMAS
@ -140,7 +148,7 @@ load_xmas:
; cli ; start music
jsr $8000
jsr $6000

407
demos/xmas_2024/wipe_star.s Normal file
View File

@ -0,0 +1,407 @@
;license:MIT
;(c) 2019-2024 by 4am/qkumba
; star wipe
Coordinates2Bit=$8100
EndCoordinates2Bit = Coordinates2Bit+15360
.include "common_defines.inc"
copymasks1bit = $BE00 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0
copymasks2bit = copymasks1bit ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00,$20,$40,$60,$80
copymasks3bit = copymasks1bit ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0,$E0
mirror_copymasks1bit = copymasks1bit+1
mirror_copymasks2bit = copymasks2bit+1
mirror_cols = hposn_low+$c0 ; $28 bytes
;=================================
; do star wipe
;=================================
wipe_star:
InitOnce:
bit Start
lda #$4C ; patch with jmp after first time through
sta InitOnce
; from code.hgr.precomputed.2bit
jsr BuildHGRMirrorCols
jsr BuildHGRSparseBitmasks2Bit
; ???
lda #$00
sta EndCoordinates2Bit
Start:
;!macro COPY_BIT .src1, .dest1, .copymasks {
.macro COPY_BIT src1, dest1, copymasks
lda (src1),y
eor (dest1),y ; merge source and destination bits
and copymasks,x ; isolate the bits to replace, zero the rest
eor (dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
sta (dest1),y ; write the result
;}
.endmacro
;!macro HIGH_3_LOW_5 .input {
.macro HIGH_3_LOW_5 input
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
tax
eor (<input), y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
tay
;}
.endmacro
;!macro COPY_TO_0 .start, .end {
.macro COPY_TO_0 start, end
; out: X=0
; Z=1
.Local m1
ldx #(end-start)
m1: lda start-1, x
sta $FF, x
dex
bne m1
;}
.endmacro
;!macro ROW_X_TO_2BIT_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 {
.macro ROW_X_TO_2BIT_BASE_ADDRESSES src1, src2, dest1, dest2
; X = $01..$C0, mapping to row 0..191
lda hposn_low-1, x
sta <dest1
sta <src1
lda hposn_high-1, x
sta <dest1+1
eor #$60
sta <src1+1
lda hposn_low, x
sta <dest2
sta <src2
lda hposn_high, x
sta <dest2+1
eor #$60
sta <src2+1
;}
.endmacro
HGRPrecomputed2Bit:
; jsr iBuildHGRTables
; jsr iBuildHGRMirrorCols
; jsr iBuildHGRSparseBitmasks2Bit
COPY_TO_0 start, end
jmp InputLoop
start:
.org $00
;!pseudopc 0 {
Exit2Bit:
rts
InputLoop:
ldy #0
input=*+1
;input_smc:
ldx Coordinates2Bit ; first value: HGR row + 1
beq Exit2Bit ; if 0 then we're done
ROW_X_TO_2BIT_BASE_ADDRESSES src1, src2, dest1, dest2
inc <input
lda (<input), Y
HIGH_3_LOW_5 input
; main 2x2 block in left half
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks2bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks2bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
COPY_BIT src1, dest1, mirror_copymasks2bit
COPY_BIT src2, dest2, mirror_copymasks2bit
inc <input
bne InputLoop
bit KEYPRESS
bmi Exit2Bit
inc <input+1
bne InputLoop ; always branches
;}
;.end
.reloc
end:
BuildHGRMirrorCols:
; in: none
; out: mirror_cols populated with lookup table to get $27-y for y in $00..$27
; all registers and flags clobbered
ldx #$27
ldy #$00
bhmc_m1:
tya
sta mirror_cols, X
iny
dex
bpl bhmc_m1
rts
BuildHGRSparseBitmasks2Bit:
lda #%10000011
sta copymasks2bit
sta mirror_copymasks2bit+$E0
lda #%10001100
sta copymasks2bit+$20
sta mirror_copymasks2bit+$C0
lda #%10110000
sta copymasks2bit+$40
sta mirror_copymasks2bit+$A0
lda #%11000000
sta copymasks2bit+$60
sta mirror_copymasks2bit+$80
lda #%10000001
sta copymasks2bit+$80
sta mirror_copymasks2bit+$60
lda #%10000110
sta copymasks2bit+$A0
sta mirror_copymasks2bit+$40
lda #%10011000
sta copymasks2bit+$C0
sta mirror_copymasks2bit+$20
lda #%11100000
sta copymasks2bit+$E0
sta mirror_copymasks2bit
rts
.if 0
ReverseCoordinates2Bit:
ldy #0 ; <Coordinates2Bit
sty $f0
lda #>Coordinates2Bit
sta $f1
lda #<(EndCoordinates2Bit - 2)
sta $f2
lda #>(EndCoordinates2Bit - 2)
sta $f3
ldx #$1E ; #$3C/2
clc
.byte $24 ; bit ZP
rc2_m:
sec
rc2_mm:
lda ($f0), Y
pha
lda ($f2), Y
sta ($f0), Y
pla
sta ($f2), Y
iny
bcc rc2_m
ldy #0
.byte $24
rc2_m2:
clc
inc $f0
bne rc2_p
inc $f1
dex
beq rc2_pp
rc2_p:
lda $f2
bne rc2_p2
dec $f3
rc2_p2:
dec $f2
bcs rc2_m2
bcc rc2_mm ; always branches
rc2_pp:
rts
.endif
.if 0
RippleCoordinates2Bit:
ldy #0
ldx #$33
ric2_m:
lda ric2_ptrtbl, X
sta $c0, X
dex
bpl ric2_m
lda #$9b
sta $fe
iny
sty $ff
ldx #6
ric2_m2:
lda Coordinates2Bit + 1, X
sta $7f, X
lda Coordinates2Bit + 9, X
sta $85, X
lda Coordinates2Bit + 17, X
sta $8b, X
lda Coordinates2Bit + 65, X
sta $9b, X
dex
bne ric2_m2
lda Coordinates2Bit + 28
sta $92
lda Coordinates2Bit + 29
sta $93
ldx #4
ric2_m3:
lda Coordinates2Bit + 33, X
sta $93, X
lda Coordinates2Bit + 41, X
sta $97, X
lda Coordinates2Bit + 83, X
sta $a1, X
dex
bne ric2_m3
ldx #2
ric2_m4:
lda Coordinates2Bit + 125, X
sta $a5, X
lda Coordinates2Bit + 131, X
sta $a7, X
lda Coordinates2Bit + 139, X
sta $a9, X
lda Coordinates2Bit + 169, X
sta $ab, X
lda Coordinates2Bit + 237, X
sta $ad, X
lda Coordinates2Bit + 2193, X
sta $af, X
lda Coordinates2Bit + 6581, X
sta $b1, X
dex
bne ric2_m4
ric2_mmm:
ldx #$34
ric2_mm:
lda $be, X
tay
ora $bf, X
beq ric2_p
lda $bf, X
jsr ric2_aslmod
sty $be, X
sta $bf, X
sty $fc
clc
adc #>Coordinates2Bit
sta $fd
ldy #0
.byte $24
ric2_m5:
sec
lda ($fc), Y
pha
lda $7e, X
sta ($fc), Y
pla
sta $7e, X
inx
iny
bcc ric2_m5
dex
dex
ric2_p:
dex
dex
bne ric2_mm
ldy #1
lda $fe
eor #<(411 - 2)
beq ric2_p2
ldy #9
eor #(<(411 - 2) ^ <(411 - 136))
bne ric2_pp
ric2_p2:
ric2_m6:
ldx ric2_zerotbl, Y
sta $0, X
sta $1, X
dey
bpl ric2_m6
ric2_pp:
dec $fe
bne ric2_mmm
dec $ff
bpl ric2_mmm
bmi ric2_exit ; always branches
ric2_aslmod:
jsr ric2_p3
ric2_p3:
cmp #$1E
bcc ric2_p4
iny
ric2_p4:
pha
tya
asl
tay
pla
rol
cmp #$3C
bcc ric2_exit
sbc #$3C
ric2_exit:
rts
ric2_ptrtbl:
.word 2, 4, 6, 10, 12, 14, 18, 20
.word 22, 28, 34, 36, 42, 44, 66, 68
.word 70, 84, 86, 126, 132, 140, 170, 238
.word 2194, 6582
ric2_zerotbl:
.byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee
.endif

File diff suppressed because it is too large Load Diff

View File

@ -37,36 +37,10 @@ xmas_main:
cli
; jsr fireplace_opener
jsr wipe_star
repeat:
;======================================
; 3D tree
;======================================
; jsr regular_tree
;======================================
; plasma tree
;======================================
; jsr plasma_tree
;======================================
; snowflakes
;======================================
; jsr do_snow
;======================================
; fireplace without vapor lock
;======================================
; jsr fireplace_restart
finished:
jmp repeat
@ -74,5 +48,7 @@ finished:
.include "wait_keypress.s"
.include "irq_wait.s"
.include "wipe_star.s"
gp_hat_graphics:
.incbin "graphics/gp_hgr.zx02"

View File

@ -4,6 +4,8 @@
;==================
;==================
;00..71 for effect? blurgh
; ZX0 decompression addresses
ZX0_src = $00
@ -39,45 +41,45 @@ COLOR = $30
;==========================
; $70-$7F for PT3 Player
; $80-$8F for PT3 Player
;==========================
AY_REGISTERS = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
B_FINE_TONE = $72
B_COARSE_TONE = $73
C_FINE_TONE = $74
C_COARSE_TONE = $75
NOISE = $76
ENABLE = $77
PT3_MIXER_VAL = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
PATTERN_L = $7E
PATTERN_H = $7F
AY_REGISTERS = $80
A_FINE_TONE = $80
A_COARSE_TONE = $81
B_FINE_TONE = $82
B_COARSE_TONE = $83
C_FINE_TONE = $84
C_COARSE_TONE = $85
NOISE = $86
ENABLE = $87
PT3_MIXER_VAL = $87
A_VOLUME = $88
B_VOLUME = $89
C_VOLUME = $8A
ENVELOPE_FINE = $8B
ENVELOPE_COARSE = $8C
ENVELOPE_SHAPE = $8D
PATTERN_L = $8E
PATTERN_H = $8F
;============================
; $80-$8D rest of pt3_player
; $90-$9D rest of pt3_player
;============================
PT3_TEMP = $80
ORNAMENT_L = $81
ORNAMENT_H = $82
SAMPLE_L = $83
SAMPLE_H = $84
LOOP = $85
MB_VALUE = $86
MB_ADDR_L = $87
MB_ADDR_H = $88
DONE_PLAYING = $89
DONE_SONG = $8A
APPLEII_MODEL = $8B
SOUND_STATUS = $8C
PT3_TEMP = $90
ORNAMENT_L = $91
ORNAMENT_H = $92
SAMPLE_L = $93
SAMPLE_H = $94
LOOP = $95
MB_VALUE = $96
MB_ADDR_L = $97
MB_ADDR_H = $98
DONE_PLAYING = $99
DONE_SONG = $9A
APPLEII_MODEL = $9B
SOUND_STATUS = $9C
SOUND_DISABLED = $80
SOUND_IN_LC = $01 ; $01 sound effects in language card
SOUND_MOCKINGBOARD = $02 ; mockingboard detected
@ -86,12 +88,12 @@ SOUND_STATUS = $8C
; not sure why these are here
;=============================
DISP_PAGE = $8D
DRAW_PAGE = $8E
TOTAL_RAM = $8F
DISP_PAGE = $9D
DRAW_PAGE = $9E
TOTAL_RAM = $9F
;=============================
; $90-$CF currently free
; $A0-$CF currently free
;=============================
;=============================
@ -146,75 +148,6 @@ RR = $FA
BACKUP_OUTL = $F2
BACKUP_OUTH = $F3
; Nuts/ opener
SPRITE_Y = $F2
SPRITE_X = $F3
CURRENT_ROW = $F4
; PLASMACUBE
OUT1 = $F0
OUT1H = $F1
OUT2 = $F2
OUT2H = $F3
COMPT1 = $F4
COMPT2 = $F5
PARAM1 = $F6
PARAM2 = $F7
PARAM3 = $F8
PARAM4 = $F9
GRLINE = $FA
GRLINEH = $FB
; PLASMA
; CUBE
SAVEX = $F3
SAVEY = $F4
SUM = $F5
; CIRCLES/DRAW_BOXES
COLOR2 = $F3
X1 = $F4
X2 = $F5
Y1 = $F6
Y2 = $F7
SCENE_COUNT = $F8
LAST_TYPE = $F9
; lens
LENS_X = $F0
LENS_Y = $F1
XADD = $F2
YADD = $F3
; rotozoom
NUM1L = $F0
NUM1H = $F1
NUM2L = $F2
NUM2H = $F3
RESULT = $F4 ; F5,F6,F7
SCALE_I = $F8
SCALE_F = $F9
ANGLE = $FA
; credits
SCROLL_X = $F0
; polar
SCROLL_START = $F0
YDEST = $F1
; hgr_copy
HGR_COPY_Y1 = $F1
HGR_COPY_Y2 = $F2
FIRE_COLOR = $F3
SCROLL_LENGTH = $F4
OFFSET = $F5
TREE_COUNT = $F6
;==============================================
; $FC-$FF we use for in/out pointers
@ -224,28 +157,3 @@ INL = $FC
INH = $FD
OUTL = $FE
OUTH = $FF
; read any file slot 6 version
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
; modified to assembled with ca64 -- vmw
; added code to patch it to run from current disk slot -- vmw
adrlo = $26 ; constant from boot prom
adrhi = $27 ; constant from boot prom
tmpsec = $3c ; constant from boot prom
reqsec = $3d ; constant from boot prom
sizelo = $44
sizehi = $45
secsize = $46
ldsizel = $f0
ldsizeh = $f1
namlo = $fb
namhi = $fc
step = $fd ; state for stepper motor
tmptrk = $fe ; temporary copy of current track
phase = $ff ; current phase for /seek