outline: demo: more tuning

This commit is contained in:
Vince Weaver 2021-05-10 23:02:15 -04:00
parent e9de194951
commit 9e91a61a7c
13 changed files with 170 additions and 1702 deletions

View File

@ -19,7 +19,7 @@ outline2021.dsk: QBOOT QLOAD OUTLINE
$(DOS33_RAW) outline2021.dsk 0 2 QBOOT 1 1
$(DOS33_RAW) outline2021.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) outline2021.dsk 1 0 QLOAD 0 14
$(DOS33_RAW) outline2021.dsk 2 0 OUTLINE 0 96
$(DOS33_RAW) outline2021.dsk 2 0 OUTLINE 0 0
@ -61,5 +61,5 @@ outline.o: outline.s zp.inc \
###
clean:
rm -f *~ *.o *.lst HELLO OUTLINE
rm -f *~ *.o *.lst HELLO OUTLINE QLOAD QBOOT

View File

@ -21,7 +21,9 @@ rocket.inc: \
ashore13.lzsa ashore14.lzsa ashore15.lzsa ashore16.lzsa \
ashore17.lzsa ashore18.lzsa ashore19.lzsa ashore20.lzsa \
ashore21.lzsa ashore22.lzsa ashore23.lzsa ashore24.lzsa \
clock_n.lzsa tree5_n.lzsa tree4_n.lzsa tree2_n.lzsa tree1_n.lzsa \
clock_e.lzsa blank.lzsa \
clock_n.lzsa \
tree5_n.lzsa tree4_n.lzsa tree2_n.lzsa tree1_n.lzsa \
pool_n.lzsa step_top_n.lzsa pad_n.lzsa spaceship_path_w.lzsa \
spaceship_far_n.lzsa spaceship_switch_n.lzsa spaceship_door_n.lzsa \
spaceship_door_open.lzsa \
@ -62,6 +64,8 @@ rocket.inc: \
echo "ashore22_lzsa: .incbin \"ashore22.lzsa\"" >> rocket.inc
echo "ashore23_lzsa: .incbin \"ashore23.lzsa\"" >> rocket.inc
echo "ashore24_lzsa: .incbin \"ashore24.lzsa\"" >> rocket.inc
echo "clock_e_lzsa: .incbin \"clock_e.lzsa\"" >> rocket.inc
echo "blank_lzsa: .incbin \"blank.lzsa\"" >> rocket.inc
echo "clock_n_lzsa: .incbin \"clock_n.lzsa\"" >> rocket.inc
echo "tree5_n_lzsa: .incbin \"tree5_n.lzsa\"" >> rocket.inc
echo "tree4_n_lzsa: .incbin \"tree4_n.lzsa\"" >> rocket.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

View File

@ -36,43 +36,45 @@ another_mist:
another_sequence:
.byte 255 ; load to bg
.word ootw_uboot_bg_lzsa ; this
.byte 128+5 ; .word ootw_uboot_flash1_lzsa ; (3)
.byte 128+5 ; .word ootw_uboot_flash2_lzsa ; (3)
.byte 128+8 ; .word swim01_lzsa ; (3)
.byte 128+8 ; .word swim02_lzsa ; (3)
.byte 128+8 ; .word swim03_lzsa ; (3)
.byte 128+8 ; .word swim04_lzsa ; (3)
.byte 128+8 ; .word swim05_lzsa ; (3)
.byte 128+8 ; .word swim06_lzsa ; (3)
.byte 128+5 ; .word ootw_uboot_flash1_lzsa ; (3)
.byte 128+5 ; .word ootw_uboot_flash2_lzsa ; (3)
.byte 128+30 ; .word swim01_lzsa ; (3)
.byte 128+20 ; .word swim02_lzsa ; (3)
.byte 128+20 ; .word swim03_lzsa ; (3)
.byte 128+20 ; .word swim04_lzsa ; (3)
.byte 128+20 ; .word swim05_lzsa ; (3)
.byte 128+20 ; .word swim06_lzsa ; (3)
.byte 255 ; load to bg
.word another_pool_lzsa ; this
.byte 128+50; .word ashore01
.byte 128+50; .word ashore02
.byte 128+50; .word ashore03
.byte 128+50; .word ashore04
.byte 128+50; .word ashore05
.byte 128+50; .word ashore06
.byte 128+50; .word ashore07
.byte 128+50; .word ashore08
.byte 128+50; .word ashore09
.byte 128+50; .word ashore10
.byte 128+50; .word ashore11
.byte 128+50; .word ashore12
.byte 128+50; .word ashore13
.byte 128+50; .word ashore14
.byte 128+50; .word ashore15
.byte 128+50; .word ashore16
.byte 128+50; .word ashore17
.byte 128+50; .word ashore18
.byte 128+50; .word ashore19
.byte 128+50; .word ashore20
.byte 128+50; .word ashore21
.byte 128+50; .word ashore22
.byte 128+50; .word ashore23
.byte 128+50; .word ashore24
.byte 128+40; .word ashore01
.byte 128+40; .word ashore02
.byte 128+40; .word ashore03
.byte 128+40; .word ashore04
.byte 128+40; .word ashore05
.byte 128+40; .word ashore06
.byte 128+40; .word ashore07
.byte 128+40; .word ashore08
.byte 128+40; .word ashore09
.byte 128+40; .word ashore10
.byte 128+40; .word ashore11
.byte 128+40; .word ashore12
.byte 128+40; .word ashore13
.byte 128+40; .word ashore14
.byte 128+40; .word ashore15
.byte 128+40; .word ashore16
.byte 128+40; .word ashore17
.byte 128+40; .word ashore18
.byte 128+40; .word ashore19
.byte 128+40; .word ashore20
.byte 128+40; .word ashore21
.byte 128+40; .word ashore22
.byte 128+40; .word ashore23
.byte 128+40; .word ashore24
.byte 255 ; load to bg
.word clock_n_lzsa ; this
.word clock_e_lzsa ; this
.byte 128+90; .word blank
.byte 128+90; .word clock_n
.byte 128+90; .word tree5_n
.byte 128+80; .word tree4_n
.byte 128+70; .word tree2_n

View File

@ -4,7 +4,7 @@ MEMORY {
}
SEGMENTS {
CODE: load = RAM, type = ro, align=$100;
CODE: load = RAM, type = ro, align=$1000;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;

View File

@ -399,7 +399,7 @@ next_credit:
write_credits:
lda which_credit
cmp #7
cmp #8
beq done_credits
ldx #4
@ -464,42 +464,49 @@ credits_table:
.word credits5
.word credits6
.word credits7
.word credits8
credits1:
.byte " CODE: "
.byte " CODE: "
.byte " "
.byte " DEATER "
.byte " DEATER "
credits2:
.byte " MUSIC: "
.byte " MUSIC: "
.byte " "
.byte " MAZE "
.byte " MA2E "
credits3:
.byte " EFFECTS: "
.byte " EFFECTS: "
.byte " J. WARWICK "
.byte " D. MCKELLAR "
credits4:
.byte " MAGIC: "
.byte " QKUMBA "
.byte " 4 A.M. "
.byte " MAGIC: "
.byte " QKUMBA "
.byte " 4 A.M. "
credits5:
.byte " GREETS: "
.byte " FRENCH TOUCH "
.byte " IMPHOBIA "
.byte "GREETS: "
.byte "--> FRENCH TOUCH"
.byte "--> IMPHOBIA "
credits6:
.byte " GROUIK "
.byte " FENARINARSA "
.byte " WIZ21 "
.byte "--> GROUIK "
.byte "--> FENARINARSA "
.byte "--> WIZ21 "
credits7:
.byte "SCOTT MANLEY "
.byte " "
.byte " ",34,"FLY SAFE",34," "
credits8:
.byte " APPLE ][ "
.byte " "
.byte " FOREVER "
which_credit:
.byte $0

View File

@ -1,353 +0,0 @@
;=============================================
; put_sprite_crop
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
; FIXME: force YPOS to be even?
put_sprite_crop:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
clc
adc XPOS
sta XMAX
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
iny ; 2
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_sprite_crop_loop:
sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
bpl put_sprite_crop_pos ; if < 0, skip to next
clc ; skip line in sprite too
lda TEMP
adc CH
tay
bne crop_increment_y
put_sprite_crop_pos:
cpy #48 ; bge if >= 48, done sprite
bcs crop_sprite_done
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
clc ; never wraps, handle negative
lda gr_offsets+1,Y ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx XPOS ; load xposition into x ; 3
;===========
; 34
crop_put_sprite_pixel:
lda (INL),Y ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
sty TEMP ; save sprite pointer ; 3
cpx #0 ; if off-screen left, skip draw
bmi skip_drawing
cpx #40
bcs skip_drawing ; if off-screen right, skip draw
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq crop_put_sprite_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne crop_put_sprite_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi crop_put_sprite_mask ; always? ; 3
;=============
; 8
crop_put_sprite_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne crop_put_sprite_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
crop_put_sprite_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp crop_put_sprite_done_draw ; we are done ; 3
;===========
; 20
crop_put_sprite_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
crop_put_sprite_done_draw:
skip_drawing:
ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
inx ; increment x counter ; 2
cpx XMAX
bne crop_put_sprite_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
crop_increment_y:
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
dec CV ; decemenet total y count ; 5
bne put_sprite_crop_loop ; loop if not done ; 2nt/3
;==============
; 17/18
crop_sprite_done:
rts ; return ; 6
; 0,0 = 400+0
; -1,0 = 400+ff=4ff, inc=400
; sprite: 5x4
;
; -2,0 Xstart=0, sprite_offset=2, xsize=3
; -1,0, Xstart=0, sprite_offset=1, xsize=4
; 0,0, Xstrat=0, sprite_offset=0, xsize=5
; 1,0, Xstart=1, sprite_offset=0, xsize=5
;
; 39,0 Xstart=39, sprite_offset=0, xsize=1
;
;
;
;
;=============================================
; put_sprite_flipped_crop
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
put_sprite_flipped_crop:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
dey ; make Y zero again ; 2
lda INH ; ???
sta ppfc_smc+2
clc
lda INL
adc #1 ; add one (not two) because X counts
; from CH to 1 (not CH-1 to 0)
sta ppfc_smc+1
bcc psfc16
inc ppfc_smc+2
psfc16:
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_spritefc_loop:
; sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
bmi fcrop_increment_y ; if < 0, skip to next
cpy #48 ; bge if >= 48, done sprite
bcs fcrop_sprite_done
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
; ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
;===========
; 34
put_spritefc_pixel:
clc
txa ; want (CH-X-1)+XPOS
eor #$ff
adc CH
adc XPOS
bmi cskip_drawing
cmp #40
bcs cskip_drawing ; if off-screen right, skip draw
ppfc_smc:
lda $C000,X ; get sprite colors ; 5
; iny ; increment sprite pointer ; 2
; sty TEMP ; save sprite pointer ; 3
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq put_spritefc_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne put_spritefc_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi put_spritefc_mask ; always? ; 3
;=============
; 8
put_spritefc_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne put_spritefc_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
put_spritefc_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp put_spritefc_done_draw ; we are done ; 3
;===========
; 20
put_spritefc_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
put_spritefc_done_draw:
cskip_drawing:
; ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
dex ; decrement x counter ; 2
bne put_spritefc_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
fcrop_increment_y:
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
lda CH
clc
adc ppfc_smc+1
sta ppfc_smc+1
bcc psfco
inc ppfc_smc+2
psfco:
dec CV ; decemenet total y count ; 5
beq fcrop_sprite_done ; loop if not done ; 2nt/3
jmp put_spritefc_loop
;==============
; 17/18
fcrop_sprite_done:
rts ; return ; 6

View File

@ -1,157 +0,0 @@
;=============================================
; put_sprite_flipped
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
put_sprite_flipped:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
dey ; make Y zero again ; 2
lda INH
sta ppf_smc+2
clc
lda INL
adc #1 ; add one (not two) because X counts
; from CH to 1 (not CH-1 to 0)
sta ppf_smc+1
bcc psf16
inc ppf_smc+2
psf16:
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_spritef_loop:
sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
;===========
; 34
put_spritef_pixel:
ppf_smc:
lda $C000,X ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
sty TEMP ; save sprite pointer ; 3
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq put_spritef_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne put_spritef_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi put_spritef_mask ; always? ; 3
;=============
; 8
put_spritef_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne put_spritef_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
put_spritef_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp put_spritef_done_draw ; we are done ; 3
;===========
; 20
put_spritef_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
put_spritef_done_draw:
ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
dex ; decrement x counter ; 2
bne put_spritef_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
lda CH
clc
adc ppf_smc+1
sta ppf_smc+1
bcc psfo
inc ppf_smc+2
psfo:
dec CV ; decemenet total y count ; 5
bne put_spritef_loop ; loop if not done ; 2nt/3
;==============
; 17/18
rts ; return ; 6

View File

@ -31,67 +31,6 @@
; Note: DOS3.3 starts at $9600
; I/O starts at $c000
square1_lo = $B600
square1_hi = $B800
square2_lo = $BA00
square2_hi = $BC00
; for(i=0;i<512;i++) {
; square1_lo[i]=((i*i)/4)&0xff;
; square1_hi[i]=(((i*i)/4)>>8)&0xff;
; square2_lo[i]=( ((i-255)*(i-255))/4)&0xff;
; square2_hi[i]=(( ((i-255)*(i-255))/4)>>8)&0xff;
; }
; note, don't run these more than once?
; why not? oh, smc that we don't reset
init_multiply_tables:
; Build the add tables
ldx #$00
txa
.byte $c9 ; CMP #immediate - skip TYA and clear carry flag
lb1: tya
adc #$00 ; 0
ml1: sta square1_hi,x ; square1_hi[0]=0
tay ; y=0
cmp #$40 ; subtract 64 and update flags (c=0)
txa ; a=0
ror ; rotate
ml9: adc #$00 ; add 0
sta ml9+1 ; update add value
inx ; x=1
ml0: sta square1_lo,x ; square1_lo[0]=1
bne lb1 ; if not zero, loop
inc ml0+2 ; increment values
inc ml1+2 ; increment values
clc ; c=0
iny ; y=1
bne lb1 ; loop
; Build the subtract tables based on the existing one
ldx #$00
ldy #$ff
second_table:
lda square1_hi+1,x
sta square2_hi+$100,x
lda square1_hi,x
sta square2_hi,y
lda square1_lo+1,x
sta square2_lo+$100,x
lda square1_lo,x
sta square2_lo,y
dey
inx
bne second_table
rts
; Fast 16x16 bit unsigned multiplication, 32-bit result

View File

@ -0,0 +1,96 @@
; Fast mutiply
; Note for our purposes we only care about 8.8 x 8.8 fixed point
; with 8.8 result, which means we only care about the middle two bytes
; of the 32 bit result. So we disable generation of the high and low byte
; to save some cycles.
;
; The old routine took around 700 cycles for a 16bitx16bit=32bit mutiply
; This routine, at an expense of 2kB of looku tables, takes around 250
; If you reuse a term the next time this drops closer to 200
; This routine was described by Stephen Judd and found
; in The Fridge and in the C=Hacking magazine
; http://codebase64.org/doku.php?id=base:seriously_fast_multiplication
; The key thing to note is that
; (a+b)^2 (a-b)^2
; a*b = ------- - --------
; 4 4
; So if you have tables of the squares of 0..511 you can lookup and subtract
; instead of multiplying.
; Table generation: I:0..511
; square1_lo = <((I*I)/4)
; square1_hi = >((I*I)/4)
; square2_lo = <(((I-255)*(I-255))/4)
; square2_hi = >(((I-255)*(I-255))/4)
; Note: DOS3.3 starts at $9600
; I/O starts at $c000
square1_lo = $1600
square1_hi = $1800
square2_lo = $1A00
square2_hi = $1C00
; for(i=0;i<512;i++) {
; square1_lo[i]=((i*i)/4)&0xff;
; square1_hi[i]=(((i*i)/4)>>8)&0xff;
; square2_lo[i]=( ((i-255)*(i-255))/4)&0xff;
; square2_hi[i]=(( ((i-255)*(i-255))/4)>>8)&0xff;
; }
; note, don't run these more than once?
; why not? oh, smc that we don't reset
init_multiply_tables:
; Build the add tables
ldx #$00
txa
.byte $c9 ; CMP #immediate - skip TYA and clear carry flag
lb1: tya
adc #$00 ; 0
ml1: sta square1_hi,x ; square1_hi[0]=0
tay ; y=0
cmp #$40 ; subtract 64 and update flags (c=0)
txa ; a=0
ror ; rotate
ml9: adc #$00 ; add 0
sta ml9+1 ; update add value
inx ; x=1
ml0: sta square1_lo,x ; square1_lo[0]=1
bne lb1 ; if not zero, loop
inc ml0+2 ; increment values
inc ml1+2 ; increment values
clc ; c=0
iny ; y=1
bne lb1 ; loop
; Build the subtract tables based on the existing one
ldx #$00
ldy #$ff
second_table:
lda square1_hi+1,x
sta square2_hi+$100,x
lda square1_hi,x
sta square2_hi,y
lda square1_lo+1,x
sta square2_lo+$100,x
lda square1_lo,x
sta square2_lo,y
dey
inx
bne second_table
rts

View File

@ -12,6 +12,10 @@ outline_demo:
.include "shimmer.s"
.include "a2_inside.s"
.include "rotoplasma_tiny.s"
.include "rotozoom_texture.s"
.include "rotozoom.s"
.include "multiply_init.s"
.align $1000
@ -71,15 +75,15 @@ mockingboard_not_found:
;=============================
jsr a2_inside
; jsr a2_inside
jsr wires
; jsr wires
jsr rotoplasma
; jsr rotoplasma
jsr drops
; jsr drops
jsr mode7_flying
; jsr mode7_flying
jsr another_mist
@ -103,14 +107,10 @@ forever:
.include "pt3_lib_mockingboard_detect.s"
.include "tfv_flying.s"
.include "drops.s"
.include "wires.s"
.include "credits.s"
.include "rotoplasma_tiny.s"
.include "rotozoom_texture.s"
.include "rotozoom.s"
.include "plasma.s"
.include "gr_putsprite.s"

View File

@ -1,696 +0,0 @@
;=======================================
; Move physicist based on current state
;
move_physicist:
lda PHYSICIST_STATE
cmp #P_WALKING
beq move_physicist_walking
cmp #P_RUNNING
beq move_physicist_running
rts
;======================
; walking
move_physicist_walking:
inc GAIT ; cycle through animation
lda GAIT
and #$7
cmp #$4 ; only walk roughly 1/8 of time
bne no_move_walk
lda DIRECTION
beq p_walk_left
inc PHYSICIST_X ; walk right
rts
p_walk_left:
dec PHYSICIST_X ; walk left
no_move_walk:
rts
;======================
; running
move_physicist_running:
; inc GAIT ; cycle through animation
inc GAIT ; cycle through animation
lda GAIT
and #$3
cmp #$2 ; only run roughly 1/4 of time
bne no_move_run
lda DIRECTION
beq p_run_left
inc PHYSICIST_X ; run right
rts
p_run_left:
dec PHYSICIST_X ; run left
no_move_run:
rts
;======================
; standing
move_physicist_standing:
pstate_table_lo:
.byte <physicist_standing ; 00
.byte <physicist_walking ; 01
.byte <physicist_running ; 02
.byte <physicist_crouching ; 03
.byte <physicist_kicking ; 04
.byte <physicist_jumping ; 05
.byte <physicist_collapsing ; 06
.byte <physicist_falling_sideways; 07
.byte <physicist_standing ; 08 swinging
.byte <physicist_standing ; 09 elevator up
.byte <physicist_standing ; 0A elevator down
.byte <physicist_shooting ; 0B
.byte <physicist_falling_down ; 0C
.byte <physicist_impaled ; 0D
.byte <physicist_crouch_shooting; 0E
.byte <physicist_crouch_kicking ; 0F
.byte <physicist_disintegrating ; 10
pstate_table_hi:
.byte >physicist_standing
.byte >physicist_walking
.byte >physicist_running
.byte >physicist_crouching
.byte >physicist_kicking
.byte >physicist_jumping
.byte >physicist_collapsing
.byte >physicist_falling_sideways
.byte >physicist_standing ; 08 swinging
.byte >physicist_standing ; 09 elevator up
.byte >physicist_standing ; 0A elevator down
.byte >physicist_shooting ; 0B
.byte >physicist_falling_down ; 0C
.byte >physicist_impaled ; 0D
.byte >physicist_crouch_shooting; 0E
.byte >physicist_crouch_kicking ; 0F
.byte >physicist_disintegrating ; 10
; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug
.align 2
pjump:
.word $0000
.align 1
;======================================
; draw physicist
;======================================
draw_physicist:
lda PHYSICIST_STATE
and #$1f ; mask off high state bits
tax
lda pstate_table_lo,x
sta pjump
lda pstate_table_hi,x
sta pjump+1
jmp (pjump)
;==================================
; STANDING
;==================================
physicist_standing:
lda #<phys_stand
sta INL
lda #>phys_stand
sta INH
jmp finally_draw_him
;==================================
; SHOOTING
;==================================
physicist_shooting:
lda #<shooting1
sta INL
lda #>shooting1
sta INH
jmp finally_draw_him
;==================================
; KICKING
;==================================
physicist_kicking:
lda #<kick1
sta INL
lda #>kick1
sta INH
; If kicking long enough, return to standing
dec GAIT
bne short_draw
lda #P_STANDING
sta PHYSICIST_STATE
short_draw:
jmp finally_draw_him
;===================================
; CROUCHING
;===================================
physicist_crouching:
; FIXME: we have an animation?
; if we have some gait left, slide a bit
lda GAIT
beq crouch_done_slide
dec GAIT
bne crouch_done_slide
lda DIRECTION
beq p_slide_left
inc PHYSICIST_X
jmp crouch_done_slide
p_slide_left:
dec PHYSICIST_X
crouch_done_slide:
lda #<crouch2
sta INL
lda #>crouch2
sta INH
jmp finally_draw_him
;===================================
; CROUCH KICKING
;===================================
physicist_crouch_kicking:
dec GAIT
lda GAIT
bpl still_kicking
lda #P_CROUCHING
sta PHYSICIST_STATE
still_kicking:
lda #<crouch_kicking
sta INL
lda #>crouch_kicking
sta INH
jmp finally_draw_him
;===================================
; CROUCH SHOOTING
;===================================
physicist_crouch_shooting:
lda #<crouch_shooting
sta INL
lda #>crouch_shooting
sta INH
jmp finally_draw_him
;===================================
; JUMPING
;===================================
physicist_jumping:
lda GAIT
cmp #32
bcc still_jumping ; blt
; done juming
lda #STATE_RUNNING
bit PHYSICIST_STATE
beq jump_to_stand
jump_to_run:
lda #0
sta GAIT
lda #P_RUNNING
sta PHYSICIST_STATE
jmp physicist_running
jump_to_stand:
lda #0
sta GAIT
lda #P_STANDING
sta PHYSICIST_STATE
jmp physicist_standing
still_jumping:
lsr
and #$fe
tax
lda phys_jump_progression,X
sta INL
lda phys_jump_progression+1,X
sta INH
inc GAIT
lda #STATE_RUNNING
bit PHYSICIST_STATE
beq jump_change_x_regular
jump_change_x_running:
lda GAIT
; 1/4 not enough, 1/2 too much
; 3/8?
and #$7
cmp #5
bcc jump_no_move
jmp jump_change_x
; only change X every 8th frame
jump_change_x_regular:
lda GAIT
and #$7
bne jump_no_move
jump_change_x:
lda DIRECTION
beq jump_left
jump_right:
inc PHYSICIST_X
jmp finally_draw_him
jump_left:
dec PHYSICIST_X
jump_no_move:
jmp finally_draw_him
;===============================
; Walking
;================================
physicist_walking:
lda GAIT
cmp #40
bcc gait_fine ; blt
lda #0
sta GAIT
gait_fine:
lsr
and #$fe
tax
lda phys_walk_progression,X
sta INL
lda phys_walk_progression+1,X
sta INH
jmp finally_draw_him
;===============================
; Running
;================================
physicist_running:
lda GAIT
cmp #40
bcc run_gait_fine ; blt
lda #0
sta GAIT
run_gait_fine:
lsr
and #$fe
tax
lda phys_run_progression,X
sta INL
lda phys_run_progression+1,X
sta INH
jmp finally_draw_him
;==================================
; COLLAPSING
;==================================
physicist_collapsing:
lda GAIT
cmp #18
bne collapse_not_done
really_dead:
lda #$ff
sta GAME_OVER
jmp finally_draw_him
collapse_not_done:
ldx GAIT
lda collapse_progression,X
sta INL
lda collapse_progression+1,X
sta INH
lda FRAME
and #$1f
bne no_collapse_progress
inc GAIT
inc GAIT
no_collapse_progress:
jmp finally_draw_him
;==================================
; DISINTEGRATING
;==================================
physicist_disintegrating:
lda GAIT
cmp #28
bne disintegrate_not_done
disintegrate_really_dead:
lda #$ff
sta GAME_OVER
jmp finally_draw_him
disintegrate_not_done:
ldx GAIT
lda disintegrate_progression,X
sta INL
lda disintegrate_progression+1,X
sta INH
lda FRAME
and #$7
bne no_disintegrate_progress
inc GAIT
inc GAIT
no_disintegrate_progress:
jmp finally_draw_him
;==================================
; FALLING SIDEWAYS
;==================================
physicist_falling_sideways:
lda FRAME
and #$3
bne no_fall_progress
inc PHYSICIST_X
inc PHYSICIST_Y ; must me mul of 2
inc PHYSICIST_Y
no_fall_progress:
lda PHYSICIST_Y
fall_sideways_destination_smc:
cmp #22
bne still_falling
done_falling:
; lda #0
; sta GAIT
lda #P_CROUCHING
sta PHYSICIST_STATE
jmp physicist_crouching
still_falling:
lda #<phys_falling
sta INL
lda #>phys_falling
sta INH
jmp finally_draw_him
;==================================
; FALLING DOWN
;==================================
physicist_falling_down:
falling_stop_smc: ; $2C to fall, $4C for not
bit still_falling_down
lda FRAME
and #$1
bne no_fall_down_progress
inc PHYSICIST_Y ; must be mul of 2
inc PHYSICIST_Y
no_fall_down_progress:
lda PHYSICIST_Y
fall_down_destination_smc:
cmp #22
bne still_falling_down
done_falling_down:
jsr recalc_walk_collision
lda #P_CROUCHING
sta PHYSICIST_STATE
jmp physicist_crouching
still_falling_down:
lda #<phys_stand
sta INL
lda #>phys_stand
sta INH
jmp finally_draw_him
;==================================
; IMPALED
;==================================
physicist_impaled:
lda GAIT
cmp #$80
bne impale_not_done
impale_really_dead:
lda #$ff
sta GAME_OVER
jmp finally_draw_him
impale_not_done:
cmp #2 ; slide down one more
bne impale_enough
inc PHYSICIST_Y
inc PHYSICIST_Y
impale_enough:
inc GAIT
lda #<physicist_spike_sprite
sta INL
lda #>physicist_spike_sprite
sta INH
jmp finally_draw_him
;=============================
; Actually Draw Him
;=============================
finally_draw_him:
lda PHYSICIST_X
sta XPOS
lda PHYSICIST_Y
sec
sbc EARTH_OFFSET ; adjust for earthquakes
sta YPOS
lda DIRECTION
bne facing_right
facing_left:
jmp put_sprite_crop
facing_right:
jmp put_sprite_flipped_crop
;======================================
;======================================
; Check screen limits
;======================================
;======================================
; If too far right or left, stop at boundary
; If also > 39 or < -4 then exit room
check_screen_limit:
clc
lda PHYSICIST_X
adc #$80
cmp LEFT_WALK_LIMIT
bcs just_fine_left ; (bge==bcs)
left_on_screen:
; if limit was -4, means we are off screen
; otherwise, stop physicist at limit
lda LEFT_WALK_LIMIT
cmp #($80 - 4)
beq too_far_left
left_stop_at_barrier:
lda #0
sta PHYSICIST_STATE
lda LEFT_WALK_LIMIT
sec
sbc #$7f
sta PHYSICIST_X
rts
too_far_left:
lda #1
sta GAME_OVER
rts
just_fine_left:
; Check right edge of screen
; lda PHYSICIST_X
cmp RIGHT_WALK_LIMIT
bcc just_fine_right ; blt
right_on_screen:
; if limit was 39, means we are off screen
; otherwise, stop physicist at limit
lda RIGHT_WALK_LIMIT
cmp #($80 + 39)
beq too_far_right
right_stop_at_barrier:
lda #0
sta PHYSICIST_STATE
lda RIGHT_WALK_LIMIT
clc
adc #$7f
sta PHYSICIST_X
rts
too_far_right:
lda #2
sta GAME_OVER
just_fine_right:
rts
; LIMIT VALUE FLAGS
; 0 10 -----
; 0 0 Z----
; 0 FF
; 1 -> 129
; 0 -> 128
; -1 -> 127 FF + 80 = 7f
; XPOS XSIZE XMAX
; -5 8 3
; -4 4
; -3 5
; -2 6
; -1 7
; 0 8
; 1 9
; 2
; 3
; 4
; 5

View File

@ -1,374 +0,0 @@
; sierpinski-like demo
; based on the code from Hellmood's Memories demo
; by Vince `deater` Weaver <vince@deater.net>
; the simple sierpinski you more or less just plot
; X AND Y
; Hellmood's you plot something more or less like
; COLOR = ( (Y-(X*T)) & (X+(Y*T) ) & 0xf0
; where T is an incrementing frame value
; to get speed on 6502/Apple II we change the multiplies to
; a series of 16-bit 8.8 fixed point adds
; TODO:
; HPLOT: roughly 30s / frame
; MOVERIGHT: roughly 14s / frame
; MOVERIGHT NO COLORSHIFT:roughly 11s / frame
; MOVERIGHT MOVEDOWN roughly 11s / frame
; INLINE HPLOT roughly 9s / frame
; INLINE EVERYTHING roughly 7s / frame
; XT/YT lookup tables roughly 6s / frame
; only write 1/7 of time roughly 3s / frame
; only draw 128 lines roughly 2s / frame
; zero page
HGR_BITS = $1C
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
MASK = $2E
COLOR = $30
HGR_HMASK = $30
HGR_X = $E0
HGR_Y = $E2
HGR_COLOR = $E4
HGR_HORIZ = $E5
HGR_SCALE = $E7
DRAW_PAGE = $04
FRAME = $05
SEVEN = $06
NEXTCOL = $07
XX_TH = $08
XX_TL = $09
YY = $0A
YY_TH = $0B
YY_TL = $0C
T_L = $0D
T_H = $0E
SAVED = $0F
; Soft switches
FULLGR = $C052
PAGE1 = $C054
PAGE2 = $C055
; ROM routines
HGR = $F3E2
HGR2 = $F3D8
HPOSN = $F411
HPLOT0 = $F457
HPLOT1 = $F45A ; skip the HPOSN call
COLOR_SHIFT = $F47E ; shift color for odd/even Y (0..7 or 7..13)
MOVE_RIGHT = $F48A ; move next plot location one to the right
MOVE_DOWN = $F504 ; clc at f504, needed?
; f505 is applesoft entry point but assumes c?
; move next plot location one to the right
; note moveright/movedown respect HGR_PAGE
XDRAW0 = $F65D
COLORTBL = $F6F6
BASCALC = $FBC1
HOME = $FC58
CLREOLZ = $FC9E ; clear (BASL),Y to end of line
XT_LOOKUP_TABLE = $1000
YT_LOOKUP_TABLE = $1100
;.zeropage
;.globalzp T_L,T_H
;================================
; Clear screen and setup graphics
;================================
sier:
jsr HGR ; returns with A=0
sta T_L ; start with multiplier 0
sta T_H
;=============================
sier_outer:
ldx #24
jsr xdraw_desire ; draw desire
ldx #216
jsr xdraw_desire ; draw desire
ldx #0 ; get X 0 for later
stx YY ; YY starts at 0
; create XX_T and YY_T lookup tables
stx XX_TL ; always start at 0
stx XX_TH
; calc XX*T
; only really care about XX_TH
xt_table_loop:
clc ; 2
lda XX_TL ; 3
adc T_L ; 2
sta XX_TL ; 3
lda XX_TH ; 3
adc T_H ; 3
sta XX_TH ; 3
sta YT_LOOKUP_TABLE,X ; 5
eor #$ff ; negate, as we subtract ; 2
sta XT_LOOKUP_TABLE,X ; 5
inx ; 2
bne xt_table_loop ; 3/2
; inc T
; clc
lda T_L
speed_smc:
adc #2
sta T_L
bcc no_carry
inc T_H
no_carry:
; speed up the zoom as it goes
inc speed_smc+1
; set initial position on screen at line 32
lda #$0 ;
sta GBASL
lda #$20 ; start on page2 line 32 ($4200)
sta GBASH
sier_yloop:
; GBASH is in A here
; lda GBASH ; update output pointer
sta gb_smc+2
lda GBASL ; adjust so centered
clc
adc #10
sta gb_smc+1
; YY*T only needs to be updated once per line
; so do it here and then self-modify into place
ldx YY ; 3
stx add_yy_smc+1 ; 4
lda YT_LOOKUP_TABLE,X ; 4
sta yy_th_smc+1 ; 4
; reset XX to 0
ldx #0 ; XX
seven_loop:
ldy #7 ; apple ii 7 pixels per byte
sier_xloop:
; want (YY-(XX*T)) & (XX+(YY*T)
; SAVED = XX+(Y*T)
clc ; needed for proper colors ; 2
txa ; XX ; 2
yy_th_smc:
adc #$dd ; 2
sta SAVED ; 3
lda XT_LOOKUP_TABLE,X ; ~(XX*T) ; 4
; calc (YY-XX*T)
sec ; 2
add_yy_smc:
adc #$dd ; 2
; want (YY-(XX*T)) & (XX+(YY*T)
and SAVED ; 3
;============
; 20
clc ; 2
beq black ; 2/3
white:
sec ; 2
black:
;=====
; 5/6
ror NEXTCOL ; rotate in next bit ; 5
inx ; increment x ; 2
dey ; dec seven count ; 2
bne sier_xloop ; 2/3
;===========================================================
lda NEXTCOL ; sign extend top bit, ; 3
cmp #$80 ; matches earlier cool colors ; 2
ror ; 2
gb_smc:
sta $4000 ; write to hi-res display ; 4
inc gb_smc+1 ; increase GBASL ; 6
cpx #124 ; 2
bcc seven_loop ; 3/2
;=================
; total roughly ???
; full screen each inner cycle is done 256*192 = 49152
; apple II cyles/frame = 17,030
; 1FPS = 1,021,800
;==================================
jsr MOVE_DOWN ; ROM routine to skip the next line
; as this is non-trivial on Apple II
; X/Y left alone
; returns with GBASH in A
inc YY ; repeat until YY=128
bpl sier_yloop
;flip_pages:
; TODO if frame rate ever gets fast enough
ldx #24
jsr xdraw_desire ; erase desire
ldx #216
jsr xdraw_desire ; erase desire
inc FRAME
;===============
; clear screen
jsr HOME
; ldx #24
;clear_screen_loop:
; txa
; jsr BASCALC ; A is BASL at end
; lda BASH
; clc
; adc DRAW_PAGE
; sta BASH
; ldy #0
; jsr CLREOLZ
; dex
; cpx #20
; bne clear_screen_loop
ldy #39
text_loop:
tya ; get YY to print at
; clc
; adc FRAME
and #$f
tax
lda cosine,X ; get cosine value
jsr BASCALC ; convert to BASL/BASH
; lda BASH ; add so is proper page
; clc
; adc DRAW_PAGE
; sta BASH
tya ; lookup char to print
clc
adc FRAME
and #$f
tax
; lda apple,X
lda $FB09,X ; 8 bytes of apple II
cpx #8
bcc blah2
; ora #$80
lda #$a0
blah2:
sta (BASL),Y ; print it
dey ; loop
bpl text_loop
jmp sier_outer ; branch always
cosine:
.byte 23,23,23,22,22,21,20,20,20,20,20,21,21,22,23,23
shape_dsr:
.byte $2d,$36,$ff,$3f
.byte $24,$ad,$22,$24,$94,$21,$2c,$4d
.byte $91,$3f,$36,$00
;=======================
; xdraw desire
;=======================
xdraw_desire:
; setup X and Y co-ords
ldy #0 ; XPOSH always 0 for us
lda #20
jsr HPOSN ; X= (y,x) Y=(a)
lda #3
sta HGR_SCALE
shape_smc:
ldx #<shape_dsr ; point to our shape
xdraw_custom_shape:
ldy #>shape_dsr ; code fits in one page so this doesn't change
rot_smc:
lda FRAME ; set rotation
and #$f ; necessary?
asl
asl
; for scale 2 only 8 positions
blah:
jmp XDRAW0 ; XDRAW 1 AT X,Y
; Both A and X are 0 at exit