parallax: update par_tiny

This commit is contained in:
Vince Weaver 2023-01-24 21:16:14 -05:00
parent 5534e639fd
commit 9c7b188263

View File

@ -11,6 +11,7 @@
; 102 bytes -- make page value self-modifying code ; 102 bytes -- make page value self-modifying code
; 101 bytes -- overlap some constants ; 101 bytes -- overlap some constants
; 99 bytes -- merge frame ; 99 bytes -- merge frame
; 115 bytes -- code to change direction
; Zero Page ; Zero Page
GBASL = $26 GBASL = $26
@ -39,17 +40,24 @@ SETGR = $FB40
.globalzp masks .globalzp masks
.globalzp offsets .globalzp offsets
.globalzp page_smc .globalzp page_smc
.globalzp horiz_smc
.globalzp dir_horiz_lookup
parallax: parallax:
;=================== ;===================
; init screen ; init screen
jsr HGR2 ; set hires, full-screen ; jsr HGR2 ; set hires, full-screen
; A/Y are 0 ; A/Y are 0
; note! Only can do this if $E6 is free ; note! Only can do this if $E6 is free
bit LORES ; set lores ; bit LORES ; set lores
; have to do it this way as above messes with $E7
jsr SETGR
bit FULLGR
parallax_forever: parallax_forever:
@ -60,7 +68,15 @@ parallax_forever:
sta frames+1 ; frame/2 sta frames+1 ; frame/2
lsr lsr
sta frames+2 ; frame/4 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 ; flip page
@ -112,16 +128,18 @@ xloop:
color_loop: color_loop:
;=========================== ;===========================
; SMALL ; vertical scroll
sec ; subtract frame from Y sec ; subtract frame from Y
tya tya
horiz_smc:
sbc frames,X sbc frames,X
sta X2 ; store interim result sta X2 ; store interim result
lda YY ; get YY and adjust offset to look nicer lda YY ; get YY and adjust offset to look nicer
clc clc
adc offsets,X adc offsets,X
adc frames,X
eor X2 eor X2
and masks,X ; do the mask and masks,X ; do the mask
@ -134,6 +152,8 @@ skip_color:
dex dex
bpl color_loop bpl color_loop
;======================== ;========================
; actually draw color ; actually draw color
@ -154,4 +174,8 @@ masks: .byte $8,$4 ;,$2 ; overlap
offsets:.byte $2,$1,$0 offsets:.byte $2,$1,$0
colors: .byte $1b,$26,$4c colors: .byte $1b,$26,$4c
; ADC,X BIT,X SBC,X BIT,X
dir_horiz_lookup: .byte $75,$24,$F5,$24
frames: frames: