mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-09 22:29:36 +00:00
demo: more work-in-progress
This commit is contained in:
parent
b7ed658b8f
commit
9962c261ed
|
@ -7,7 +7,7 @@ EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||||
|
|
||||||
all: xdraw.dsk xdraw128.dsk
|
all: xdraw.dsk xdraw128.dsk
|
||||||
|
|
||||||
submit: xdraw128.zip
|
submit: xdraw128_submit.zip
|
||||||
|
|
||||||
xdraw128_submit.zip: XDRAW128 xdraw128.s file_id.diz xdraw128.dsk
|
xdraw128_submit.zip: XDRAW128 xdraw128.s file_id.diz xdraw128.dsk
|
||||||
mkdir -p outline2021_xdraw128
|
mkdir -p outline2021_xdraw128
|
||||||
|
|
|
@ -54,6 +54,7 @@ OUTLINE: outline.o
|
||||||
|
|
||||||
outline.o: outline.s zp.inc \
|
outline.o: outline.s zp.inc \
|
||||||
shimmer.s a2_inside.s drops.s wires.s \
|
shimmer.s a2_inside.s drops.s wires.s \
|
||||||
|
rotoplasma_tiny.s \
|
||||||
flying_dir.inc tfv_flying.s flying_mode7.s credits.s
|
flying_dir.inc tfv_flying.s flying_mode7.s credits.s
|
||||||
ca65 -o outline.o outline.s -l outline.lst
|
ca65 -o outline.o outline.s -l outline.lst
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
Memory Usage:
|
Memory Usage:
|
||||||
|
|
||||||
$200
|
$200
|
||||||
$1000-$10FF wires_lookup
|
$1000-$10FF wires_lookup/plasma_lookup
|
||||||
|
$1100-$11FF plasma lookup
|
||||||
|
$1200-$12FF plasma lookup
|
||||||
$2000-$3FFF hires page 1
|
$2000-$3FFF hires page 1
|
||||||
$4000-$6000 hires page 2 (24k)
|
$4000-$6000 hires page 2 (24k)
|
||||||
$6000-????? code
|
$6000-????? code
|
||||||
|
|
|
@ -10,6 +10,15 @@ a2_inside:
|
||||||
bit LORES
|
bit LORES
|
||||||
bit FULLGR ; make it 40x48
|
bit FULLGR ; make it 40x48
|
||||||
|
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; init wires
|
||||||
|
|
||||||
|
jsr wires_create_lookup
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; draw the computer
|
||||||
|
|
||||||
draw_box_loop:
|
draw_box_loop:
|
||||||
|
|
||||||
; get color/Y0
|
; get color/Y0
|
||||||
|
@ -18,7 +27,7 @@ draw_box_loop:
|
||||||
|
|
||||||
tya ; check for end
|
tya ; check for end
|
||||||
|
|
||||||
bmi end
|
bmi done_computer
|
||||||
|
|
||||||
|
|
||||||
jsr load_byte ; Y1
|
jsr load_byte ; Y1
|
||||||
|
@ -64,15 +73,16 @@ inner_loop:
|
||||||
bcc inner_loop
|
bcc inner_loop
|
||||||
bcs draw_box_loop
|
bcs draw_box_loop
|
||||||
|
|
||||||
|
done_computer:
|
||||||
|
|
||||||
;=========================
|
;====================================
|
||||||
; draw the demo
|
; draw the demo, sierpinski at first
|
||||||
;=========================
|
;====================================
|
||||||
; screen is from (11,6) - (20,23)
|
; screen is from (11,6) - (20,23)
|
||||||
; so size is 9,17?
|
; so size is 9,17?
|
||||||
end:
|
|
||||||
|
|
||||||
lda #128
|
|
||||||
|
lda #200
|
||||||
sta FRAME
|
sta FRAME
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,8 +147,234 @@ black:
|
||||||
|
|
||||||
lda FRAME
|
lda FRAME
|
||||||
bne sier_loop
|
bne sier_loop
|
||||||
|
; rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;====================================
|
||||||
|
; draw the demo, wires
|
||||||
|
;====================================
|
||||||
|
; screen is from (11,6) - (20,23)
|
||||||
|
; so size is 9,17?
|
||||||
|
|
||||||
|
|
||||||
|
lda #200
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
|
|
||||||
|
; pause a bit at beginning
|
||||||
|
jsr WAIT
|
||||||
|
|
||||||
|
a2_wire_loop:
|
||||||
|
|
||||||
|
jsr wires_cycle_colors
|
||||||
|
|
||||||
|
lda #100 ; Wait a bit, we're too fast
|
||||||
|
jsr WAIT
|
||||||
|
|
||||||
|
inc FRAME ; increment frame
|
||||||
|
|
||||||
|
ldx #17 ; YY
|
||||||
|
|
||||||
|
a2_wire_yloop:
|
||||||
|
|
||||||
|
lda #9 ; XX
|
||||||
|
sta XX
|
||||||
|
|
||||||
|
a2_wire_xloop:
|
||||||
|
|
||||||
|
txa
|
||||||
|
and #$f
|
||||||
|
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
ora XX
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda wires_lookup,Y ; load from array ; 4
|
||||||
|
|
||||||
|
cmp #11
|
||||||
|
bcs acolor_notblue ; if < 11, blue
|
||||||
|
|
||||||
|
acolor_blue:
|
||||||
|
lda #$11 ; blue offset
|
||||||
|
|
||||||
|
acolor_notblue:
|
||||||
|
tay
|
||||||
|
lda wires_colorlookup-11,Y ; lookup color
|
||||||
|
|
||||||
|
acolor_notblack:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jsr SETCOL ; set top/bottom nibble same color
|
||||||
|
|
||||||
|
lda XX ; offset XX to tiny screen
|
||||||
|
clc
|
||||||
|
adc #11
|
||||||
|
tay ; put into Y
|
||||||
|
|
||||||
|
txa ; offset YY to tiny screen
|
||||||
|
clc
|
||||||
|
adc #6 ; put into A
|
||||||
|
|
||||||
|
jsr PLOT ; PLOT AT Y,A
|
||||||
|
|
||||||
|
dec XX
|
||||||
|
bpl a2_wire_xloop
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl a2_wire_yloop
|
||||||
|
|
||||||
|
lda FRAME
|
||||||
|
bne a2_wire_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=======================================
|
||||||
|
; copy to $c00
|
||||||
|
;=======================================
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr gr_copy_from_current
|
||||||
|
|
||||||
|
lda #4
|
||||||
|
sta DISP_PAGE
|
||||||
|
|
||||||
|
;============================
|
||||||
|
; rotozoom
|
||||||
|
;============================
|
||||||
|
|
||||||
|
; do a (hopefully fast) roto-zoom
|
||||||
|
|
||||||
|
; jsr clear_screens
|
||||||
|
; jsr init_multiply_tables
|
||||||
|
|
||||||
|
jsr gr_copy_to_current
|
||||||
|
jsr page_flip
|
||||||
|
jsr gr_copy_to_current
|
||||||
|
|
||||||
|
;=================================
|
||||||
|
; main loop
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta ANGLE
|
||||||
|
sta SCALE_F
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta direction
|
||||||
|
lda #$10
|
||||||
|
sta scaleaddl
|
||||||
|
lda #$00
|
||||||
|
sta scaleaddh
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta SCALE_I
|
||||||
|
|
||||||
|
rz_main_loop:
|
||||||
|
|
||||||
|
jsr rotozoom_c00
|
||||||
|
|
||||||
|
jsr page_flip
|
||||||
|
|
||||||
|
;wait_for_keypress:
|
||||||
|
; lda KEYPRESS
|
||||||
|
; bpl wait_for_keypress
|
||||||
|
; bit KEYRESET
|
||||||
|
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda FRAME
|
||||||
|
adc direction
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
|
cmp #$f8
|
||||||
|
beq rback_at_zero
|
||||||
|
cmp #33
|
||||||
|
beq rat_far_end
|
||||||
|
bne rdone_reverse
|
||||||
|
|
||||||
|
rback_at_zero:
|
||||||
|
; inc which_image
|
||||||
|
; lda which_image
|
||||||
|
; cmp #3
|
||||||
|
; bne refresh_image
|
||||||
|
; lda #0
|
||||||
|
; sta which_image
|
||||||
|
;refresh_image:
|
||||||
|
; jsr load_background
|
||||||
|
|
||||||
|
rat_far_end:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; change bg color
|
||||||
|
; lda roto_color_even_smc+1
|
||||||
|
; clc
|
||||||
|
; adc #$01
|
||||||
|
; and #$0f
|
||||||
|
; sta roto_color_even_smc+1
|
||||||
|
|
||||||
|
; lda roto_color_odd_smc+1
|
||||||
|
; clc
|
||||||
|
; adc #$10
|
||||||
|
; and #$f0
|
||||||
|
; sta roto_color_odd_smc+1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; reverse direction
|
||||||
|
;; lda direction
|
||||||
|
; eor #$ff
|
||||||
|
; clc
|
||||||
|
; adc #1
|
||||||
|
; sta direction
|
||||||
|
|
||||||
|
; lda scaleaddl
|
||||||
|
; eor #$ff
|
||||||
|
; clc
|
||||||
|
; adc #1
|
||||||
|
; sta scaleaddl
|
||||||
|
|
||||||
|
; lda scaleaddh
|
||||||
|
; eor #$ff
|
||||||
|
; adc #0
|
||||||
|
; sta scaleaddh
|
||||||
|
|
||||||
|
rdone_reverse:
|
||||||
|
clc
|
||||||
|
lda ANGLE
|
||||||
|
adc direction
|
||||||
|
and #$1f
|
||||||
|
sta ANGLE
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda SCALE_F
|
||||||
|
adc scaleaddl
|
||||||
|
sta SCALE_F
|
||||||
|
lda SCALE_I
|
||||||
|
adc scaleaddh
|
||||||
|
sta SCALE_I
|
||||||
|
|
||||||
|
jmp rz_main_loop
|
||||||
|
|
||||||
|
|
||||||
|
;direction: .byte $01
|
||||||
|
;scaleaddl: .byte $10
|
||||||
|
;scaleaddh: .byte $00
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
; load byte routine
|
; load byte routine
|
||||||
;=========================
|
;=========================
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
|
|
||||||
credits:
|
credits:
|
||||||
|
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
jsr HGR ; Hi-res graphics, no text at bottom
|
jsr HGR ; Hi-res graphics, no text at bottom
|
||||||
; Y=0, A=0 after this call
|
; Y=0, A=0 after this call
|
||||||
|
|
||||||
jsr clear_bottom
|
|
||||||
|
|
||||||
sta LOGO_OFFSET
|
sta LOGO_OFFSET
|
||||||
sta FRAME
|
sta FRAME
|
||||||
|
|
|
@ -373,12 +373,13 @@ nomatch:
|
||||||
|
|
||||||
lda SPACEY_I ; 3
|
lda SPACEY_I ; 3
|
||||||
sta spacey_label+1 ; self modifying code, LAST_SPACEY_I ; 4
|
sta spacey_label+1 ; self modifying code, LAST_SPACEY_I ; 4
|
||||||
and #CONST_MAP_MASK_Y ; wrap to 64x64 grid ; 2
|
and #CONST_MAP_MASK_Y ; wrap to 16x16 grid ; 2
|
||||||
sta SPACEY_I ; 3
|
sta SPACEY_I ; 3
|
||||||
|
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; multiply by 8 ; 2
|
asl ; multiply by 16 ; 2
|
||||||
|
asl
|
||||||
clc ; 2
|
clc ; 2
|
||||||
adc SPACEX_I ; add in X value ; 3
|
adc SPACEX_I ; add in X value ; 3
|
||||||
; only valid if x<8 and y<8
|
; only valid if x<8 and y<8
|
||||||
|
@ -387,11 +388,11 @@ nomatch:
|
||||||
; 37
|
; 37
|
||||||
|
|
||||||
; SPACEX_I is n y
|
; SPACEX_I is n y
|
||||||
cpy #$8 ; 2
|
; cpy #$8 ; 2
|
||||||
bcs ocean_color ; bge 8 ; 2nt/3
|
; bcs ocean_color ; bge 8 ; 2nt/3
|
||||||
ldy SPACEY_I ; 3
|
; ldy SPACEY_I ; 3
|
||||||
cpy #$8 ; 2
|
; cpy #$8 ; 2
|
||||||
bcs ocean_color ; bge 8 ; 2nt/3
|
; bcs ocean_color ; bge 8 ; 2nt/3
|
||||||
;=============
|
;=============
|
||||||
; ??
|
; ??
|
||||||
|
|
||||||
|
@ -400,18 +401,36 @@ nomatch:
|
||||||
; A is spacey<<3+spacex
|
; A is spacey<<3+spacex
|
||||||
island_color:
|
island_color:
|
||||||
tay ; 2
|
tay ; 2
|
||||||
lda flying_map,Y ; load from array ; 4
|
lda wires_lookup,Y ; load from array ; 4
|
||||||
jmp update_cache ; 3
|
|
||||||
|
cmp #11
|
||||||
|
bcs mcolor_notblue ; if < 11, blue
|
||||||
|
|
||||||
|
mcolor_blue:
|
||||||
|
lda #$11 ; blue offset
|
||||||
|
|
||||||
|
mcolor_notblue:
|
||||||
|
tay
|
||||||
|
lda wires_colorlookup-11,Y ; lookup color
|
||||||
|
|
||||||
|
mcolor_notblack:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; lda #$bb
|
||||||
|
|
||||||
|
; jmp update_cache ; 3
|
||||||
;============
|
;============
|
||||||
; 11
|
; 11
|
||||||
|
|
||||||
;=============
|
;=============
|
||||||
; lookup ocean
|
; lookup ocean
|
||||||
; A is spacey<<3+spacex
|
; A is spacey<<3+spacex
|
||||||
ocean_color:
|
;ocean_color:
|
||||||
and #$1f ; 2
|
; and #$1f ; 2
|
||||||
tay ; 2
|
; tay ; 2
|
||||||
lda water_map,Y ; the color of the sea ; 4
|
; lda water_map,Y ; the color of the sea ; 4
|
||||||
;===========
|
;===========
|
||||||
; 8
|
; 8
|
||||||
|
|
||||||
|
@ -509,10 +528,17 @@ done_screenx_loop:
|
||||||
lda SCREEN_Y ; 3
|
lda SCREEN_Y ; 3
|
||||||
cmp #40 ; LOWRES height ; 2
|
cmp #40 ; LOWRES height ; 2
|
||||||
beq done_screeny ; 2nt/3
|
beq done_screeny ; 2nt/3
|
||||||
|
|
||||||
jmp screeny_loop ; too far to branch ; 3
|
jmp screeny_loop ; too far to branch ; 3
|
||||||
;=============
|
;=============
|
||||||
; 15
|
; 15
|
||||||
done_screeny:
|
done_screeny:
|
||||||
|
|
||||||
|
|
||||||
|
jsr wires_cycle_colors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rts ; 6
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
@ -523,8 +549,7 @@ done_screeny:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.if 0
|
||||||
|
|
||||||
|
|
||||||
;====================
|
;====================
|
||||||
; lookup_map
|
; lookup_map
|
||||||
|
@ -541,40 +566,43 @@ lookup_map:
|
||||||
tay ; 2
|
tay ; 2
|
||||||
|
|
||||||
lda SPACEY_I ; 3
|
lda SPACEY_I ; 3
|
||||||
and #CONST_MAP_MASK_Y ; wrap to 64x64 grid ; 2
|
and #CONST_MAP_MASK_Y ; wrap to 16x16 grid ; 2
|
||||||
sta SPACEY_I ; 3
|
sta SPACEY_I ; 3
|
||||||
|
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; multiply by 8 ; 2
|
asl ; multiply by 16 ; 2
|
||||||
|
asl
|
||||||
clc ; 2
|
clc ; 2
|
||||||
adc SPACEX_I ; add in X value ; 3
|
adc SPACEX_I ; add in X value ; 3
|
||||||
; only valid if x<8 and y<8
|
; only valid if x<8 and y<8
|
||||||
|
|
||||||
; SPACEX_I is in y
|
; SPACEX_I is in y
|
||||||
cpy #$8 ; 2
|
; cpy #$8 ; 2
|
||||||
;============
|
;============
|
||||||
; 31
|
; 31
|
||||||
|
|
||||||
bcs ocean_color_outline ; bgt 8 ;^2nt/3
|
; bcs ocean_color_outline ; bgt 8 ;^2nt/3
|
||||||
ldy SPACEY_I ; 3
|
; ldy SPACEY_I ; 3
|
||||||
cpy #$8 ; 2
|
; cpy #$8 ; 2
|
||||||
bcs ocean_color_outline ; bgt 8 ; 2nt/3
|
; bcs ocean_color_outline ; bgt 8 ; 2nt/3
|
||||||
|
|
||||||
tay ; 2
|
tay ; 2
|
||||||
lda flying_map,Y ; load from array ; 4
|
lda wires_lookup,Y ; load from array ; 4
|
||||||
|
tay
|
||||||
|
lda wires_colorlookup,Y
|
||||||
|
|
||||||
bcc update_cache_outline ; 3
|
; bcc update_cache_outline ; 3
|
||||||
|
|
||||||
ocean_color_outline:
|
;ocean_color_outline:
|
||||||
and #$1f ; 2
|
; and #$1f ; 2
|
||||||
tay ; 2
|
; tay ; 2
|
||||||
lda water_map,Y ; the color of the sea ; 4
|
; lda water_map,Y ; the color of the sea ; 4
|
||||||
|
|
||||||
update_cache_outline:
|
update_cache_outline:
|
||||||
rts ; 6
|
rts ; 6
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
;======================================
|
;======================================
|
||||||
; draw sky
|
; draw sky
|
||||||
|
@ -587,7 +615,7 @@ draw_sky:
|
||||||
; lines 0..6
|
; lines 0..6
|
||||||
|
|
||||||
|
|
||||||
lda #COLOR_BOTH_MEDIUMBLUE ; MEDIUMBLUE color ; 2
|
lda #COLOR_BOTH_BLACK ; MEDIUMBLUE color ; 2
|
||||||
ldx #39
|
ldx #39
|
||||||
|
|
||||||
sky_loop: ; draw line across screen
|
sky_loop: ; draw line across screen
|
||||||
|
@ -603,7 +631,7 @@ sky_loop: ; draw line across screen
|
||||||
|
|
||||||
; Draw Hazy Horizon
|
; Draw Hazy Horizon
|
||||||
|
|
||||||
lda #$56 ; Horizon is blue/grey ; 2
|
lda #$50 ; Horizon is black/grey ; 2
|
||||||
ldx #39
|
ldx #39
|
||||||
horizon_loop: ; draw line across screen
|
horizon_loop: ; draw line across screen
|
||||||
sta $580,X
|
sta $580,X
|
||||||
|
|
221
demos/outline2021/demo/gr_copy.s
Normal file
221
demos/outline2021/demo/gr_copy.s
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
;=========================================================
|
||||||
|
; gr_copy_from_current, 40x48 version
|
||||||
|
;=========================================================
|
||||||
|
; copy DRAW_PAGE to $C00
|
||||||
|
;
|
||||||
|
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
|
||||||
|
|
||||||
|
gr_copy_from_current:
|
||||||
|
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc #$4 ; 2
|
||||||
|
sta gr_copy_fline+2 ; 4
|
||||||
|
sta gr_copy_fline+8 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_fline+14 ; 4
|
||||||
|
sta gr_copy_fline+20 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_fline+26 ; 4
|
||||||
|
sta gr_copy_fline+32 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_fline+38 ; 4
|
||||||
|
sta gr_copy_fline+44 ; 4
|
||||||
|
;===========
|
||||||
|
; 45
|
||||||
|
|
||||||
|
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||||
|
|
||||||
|
gr_copy_fline:
|
||||||
|
lda $400,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $C00,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $480,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $C80,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $500,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $D00,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $580,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $D80,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $600,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $E00,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $680,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $E80,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $700,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $F00,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $780,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $F80,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
dey ; decrement pointer ; 2
|
||||||
|
bpl gr_copy_fline ; ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; gr_copy_to_current, 40x48 version
|
||||||
|
;=========================================================
|
||||||
|
; copy 0xc00 to DRAW_PAGE
|
||||||
|
;
|
||||||
|
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
|
||||||
|
;.align $100
|
||||||
|
gr_copy_to_current:
|
||||||
|
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc #$4 ; 2
|
||||||
|
sta gr_copy_line+5 ; 4
|
||||||
|
sta gr_copy_line+11 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line+17 ; 4
|
||||||
|
sta gr_copy_line+23 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line+29 ; 4
|
||||||
|
sta gr_copy_line+35 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line+41 ; 4
|
||||||
|
sta gr_copy_line+47 ; 4
|
||||||
|
;===========
|
||||||
|
; 45
|
||||||
|
|
||||||
|
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||||
|
|
||||||
|
gr_copy_line:
|
||||||
|
lda $C00,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $400,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $C80,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $480,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $D00,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $500,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $D80,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $580,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $E00,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $600,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $E80,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $680,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $F00,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $700,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $F80,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $780,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
dey ; decrement pointer ; 2
|
||||||
|
bpl gr_copy_line ; ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; gr_copy_to_current, 40x48 version
|
||||||
|
;=========================================================
|
||||||
|
; copy 0x1000 to DRAW_PAGE
|
||||||
|
|
||||||
|
gr_copy_to_current_1000:
|
||||||
|
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc #$4 ; 2
|
||||||
|
sta gr_copy_line_40+5 ; 4
|
||||||
|
sta gr_copy_line_40+11 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line_40+17 ; 4
|
||||||
|
sta gr_copy_line_40+23 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line_40+29 ; 4
|
||||||
|
sta gr_copy_line_40+35 ; 4
|
||||||
|
adc #$1 ; 2
|
||||||
|
sta gr_copy_line_40+41 ; 4
|
||||||
|
sta gr_copy_line_40+47 ; 4
|
||||||
|
;===========
|
||||||
|
; 45
|
||||||
|
|
||||||
|
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||||
|
|
||||||
|
gr_copy_line_40:
|
||||||
|
lda $1000,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $400,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1080,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $480,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1100,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $500,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1180,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $580,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1200,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $600,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1280,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $680,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1300,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $700,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
lda $1380,Y ; load a byte (self modified) ; 4
|
||||||
|
sta $780,Y ; store a byte (self modified) ; 5
|
||||||
|
|
||||||
|
dey ; decrement pointer ; 2
|
||||||
|
bpl gr_copy_line_40 ; ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; gr_copy_to_current_40x40
|
||||||
|
;=========================================================
|
||||||
|
; Take image in 0xc00
|
||||||
|
; Copy to DRAW_PAGE
|
||||||
|
; Actually copy lines 0..39
|
||||||
|
; Don't over-write bottom 4 lines of text
|
||||||
|
gr_copy_to_current_40x40:
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
gc_40x40_loop:
|
||||||
|
lda gr_offsets,x
|
||||||
|
sta OUTL
|
||||||
|
sta INL
|
||||||
|
lda gr_offsets+1,x
|
||||||
|
clc
|
||||||
|
adc DRAW_PAGE
|
||||||
|
sta OUTH
|
||||||
|
|
||||||
|
lda gr_offsets+1,x
|
||||||
|
clc
|
||||||
|
adc #$8
|
||||||
|
sta INH
|
||||||
|
|
||||||
|
ldy #39
|
||||||
|
gc_40x40_inner:
|
||||||
|
lda (INL),Y
|
||||||
|
sta (OUTL),Y
|
||||||
|
|
||||||
|
dey
|
||||||
|
bpl gc_40x40_inner
|
||||||
|
|
||||||
|
inx
|
||||||
|
inx
|
||||||
|
|
||||||
|
cpx #40
|
||||||
|
bne gc_40x40_loop
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ HLINE = $F819 ; HLINE Y,$2C at A
|
||||||
VLINE = $F828 ; VLINE A,$2D at Y
|
VLINE = $F828 ; VLINE A,$2D at Y
|
||||||
CLRSCR = $F832 ; Clear low-res screen
|
CLRSCR = $F832 ; Clear low-res screen
|
||||||
CLRTOP = $F836 ; clear only top of low-res screen
|
CLRTOP = $F836 ; clear only top of low-res screen
|
||||||
|
GBASCALC = $F847 ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
|
||||||
SETGR = $FB40 ; GR
|
SETGR = $FB40 ; GR
|
||||||
SETCOL = $F864 ; COLOR=A
|
SETCOL = $F864 ; COLOR=A
|
||||||
TEXT = $FB36
|
TEXT = $FB36
|
||||||
|
|
BIN
demos/outline2021/demo/mAZE_-_Apple_snapple_Outline.pt3
Normal file
BIN
demos/outline2021/demo/mAZE_-_Apple_snapple_Outline.pt3
Normal file
Binary file not shown.
|
@ -62,15 +62,16 @@ mockingboard_not_found:
|
||||||
; a2 plasma
|
; a2 plasma
|
||||||
;=============================
|
;=============================
|
||||||
|
|
||||||
; jsr a2_inside
|
|
||||||
|
|
||||||
; jsr plasma
|
jsr a2_inside
|
||||||
|
|
||||||
; jsr drops
|
|
||||||
|
|
||||||
jsr wires
|
jsr wires
|
||||||
|
|
||||||
; jsr mode7_flying
|
jsr rotoplasma
|
||||||
|
|
||||||
|
jsr drops
|
||||||
|
|
||||||
|
jsr mode7_flying
|
||||||
|
|
||||||
;=============================
|
;=============================
|
||||||
; Credits
|
; Credits
|
||||||
|
@ -91,11 +92,15 @@ forever:
|
||||||
|
|
||||||
.include "shimmer.s"
|
.include "shimmer.s"
|
||||||
.include "a2_inside.s"
|
.include "a2_inside.s"
|
||||||
.include "fakepal.s"
|
;.include "fakepal.s"
|
||||||
.include "tfv_flying.s"
|
.include "tfv_flying.s"
|
||||||
.include "drops.s"
|
.include "drops.s"
|
||||||
.include "wires.s"
|
.include "wires.s"
|
||||||
.include "credits.s"
|
.include "credits.s"
|
||||||
|
.include "rotoplasma_tiny.s"
|
||||||
|
.include "rotozoom_texture.s"
|
||||||
|
.include "rotozoom.s"
|
||||||
|
.include "plasma.s"
|
||||||
|
|
||||||
.include "gr_putsprite.s"
|
.include "gr_putsprite.s"
|
||||||
.include "gr_pageflip.s"
|
.include "gr_pageflip.s"
|
||||||
|
@ -103,6 +108,8 @@ forever:
|
||||||
.include "multiply_fast.s"
|
.include "multiply_fast.s"
|
||||||
.include "gr_fast_clear.s"
|
.include "gr_fast_clear.s"
|
||||||
.include "gr_offsets.s"
|
.include "gr_offsets.s"
|
||||||
|
.include "c00_scrn_offsets.s"
|
||||||
|
.include "gr_copy.s"
|
||||||
|
|
||||||
.include "long_wait.s"
|
.include "long_wait.s"
|
||||||
.include "random16.s"
|
.include "random16.s"
|
||||||
|
|
171
demos/outline2021/demo/plasma.s
Normal file
171
demos/outline2021/demo/plasma.s
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
texture = $1000
|
||||||
|
high_lookup = $1100
|
||||||
|
low_lookup = $1200
|
||||||
|
|
||||||
|
;col = ( 8.0 + (sintable[xx&0xf])
|
||||||
|
; + 8.0 + (sintable[yy&0xf])
|
||||||
|
; ) / 2;
|
||||||
|
|
||||||
|
init_plasma_texture:
|
||||||
|
|
||||||
|
ldy #15
|
||||||
|
plasma_create_yloop:
|
||||||
|
ldx #15
|
||||||
|
plasma_create_xloop:
|
||||||
|
clc
|
||||||
|
lda #15
|
||||||
|
adc sinetable,X
|
||||||
|
adc sinetable,Y
|
||||||
|
lsr
|
||||||
|
plasma_lookup_smc:
|
||||||
|
sta texture ; always starts at $d00
|
||||||
|
|
||||||
|
inc plasma_lookup_smc+1
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl plasma_create_xloop
|
||||||
|
|
||||||
|
dey
|
||||||
|
bpl plasma_create_yloop
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;==============================
|
||||||
|
; update plasma
|
||||||
|
|
||||||
|
update_plasma:
|
||||||
|
|
||||||
|
plasma_cycle_colors:
|
||||||
|
; cycle colors
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
cycle_texture_loop:
|
||||||
|
inc texture,X
|
||||||
|
|
||||||
|
lda texture,X ; slow here but faster than doing it
|
||||||
|
and #$f ; in the draw routine
|
||||||
|
sta texture,X
|
||||||
|
|
||||||
|
inx
|
||||||
|
bne cycle_texture_loop
|
||||||
|
|
||||||
|
; make lookup
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
cycle_lookup_loop:
|
||||||
|
lda texture,X
|
||||||
|
lsr
|
||||||
|
tay
|
||||||
|
color_lookup_smc:
|
||||||
|
lda green_lookup,Y
|
||||||
|
pha
|
||||||
|
and #$f0
|
||||||
|
sta high_lookup,X
|
||||||
|
pla
|
||||||
|
and #$0f
|
||||||
|
sta low_lookup,X
|
||||||
|
|
||||||
|
inx
|
||||||
|
bne cycle_lookup_loop
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.if 0
|
||||||
|
plot_frame:
|
||||||
|
|
||||||
|
; plot frame
|
||||||
|
|
||||||
|
ldx #47 ; YY=0
|
||||||
|
|
||||||
|
plot_yloop:
|
||||||
|
|
||||||
|
txa ; get (y&0xf)<<4
|
||||||
|
pha ; save YY
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta CTEMP
|
||||||
|
|
||||||
|
txa
|
||||||
|
lsr
|
||||||
|
|
||||||
|
ldy #$0f ; setup mask
|
||||||
|
bcc plot_mask
|
||||||
|
ldy #$f0
|
||||||
|
|
||||||
|
plot_mask:
|
||||||
|
sty MASK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jsr GBASCALC ; point GBASL/H to address in A
|
||||||
|
; after, A trashed, C is clear
|
||||||
|
|
||||||
|
;==========
|
||||||
|
|
||||||
|
ldy #39 ; XX = 39 (countdown)
|
||||||
|
|
||||||
|
plot_xloop:
|
||||||
|
|
||||||
|
tya ; get x&0xf
|
||||||
|
and #$f
|
||||||
|
ora CTEMP ; get ((y&0xf)*16)+x
|
||||||
|
|
||||||
|
tax
|
||||||
|
|
||||||
|
plot_lookup:
|
||||||
|
|
||||||
|
; sta plot_lookup_smc+1
|
||||||
|
|
||||||
|
plot_lookup_smc:
|
||||||
|
lda lookup,X ; load lookup, (y*16)+x
|
||||||
|
; lda lookup ; load lookup, (y*16)+x
|
||||||
|
|
||||||
|
and #$f
|
||||||
|
lsr
|
||||||
|
tax
|
||||||
|
lda colorlookup,X
|
||||||
|
sta COLOR
|
||||||
|
|
||||||
|
jsr PLOT1 ; plot at GBASL,Y (x co-ord in Y)
|
||||||
|
|
||||||
|
dey
|
||||||
|
bpl plot_xloop
|
||||||
|
|
||||||
|
pla
|
||||||
|
tax ; restore YY
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl plot_yloop
|
||||||
|
bmi forever_loop
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
|
which_color: .byte $0
|
||||||
|
|
||||||
|
colorlookup:
|
||||||
|
.word green_lookup,yellow_lookup,blue_lookup,red_lookup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; blue
|
||||||
|
blue_lookup:
|
||||||
|
.byte $55,$22,$66,$77,$ff,$77,$55,$00
|
||||||
|
|
||||||
|
; red
|
||||||
|
red_lookup:
|
||||||
|
.byte $55,$11,$33,$bb,$ff,$bb,$55,$00
|
||||||
|
|
||||||
|
; green
|
||||||
|
green_lookup:
|
||||||
|
.byte $55,$44,$cc,$ee,$ff,$ee,$55,$00
|
||||||
|
|
||||||
|
; yellow
|
||||||
|
yellow_lookup:
|
||||||
|
.byte $55,$88,$99,$dd,$ff,$dd,$55,$00
|
||||||
|
|
||||||
|
sinetable:
|
||||||
|
.byte $00,$03,$05,$07,$08,$07,$05,$03
|
||||||
|
.byte $00,$FD,$FB,$F9,$F8,$F9,$FB,$FD
|
180
demos/outline2021/demo/rotoplasma_tiny.s
Normal file
180
demos/outline2021/demo/rotoplasma_tiny.s
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
; rotozoom with cycling plasma texture
|
||||||
|
;
|
||||||
|
|
||||||
|
; TODO:
|
||||||
|
; make angle 64 degrees?
|
||||||
|
; remove scaling step?
|
||||||
|
; cycle between all four color schemes?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;.include "zp.inc"
|
||||||
|
;.include "hardware.inc"
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; Clear screen and setup graphics
|
||||||
|
;================================
|
||||||
|
rotoplasma:
|
||||||
|
jsr HOME
|
||||||
|
bit PAGE0 ; set page 0
|
||||||
|
bit LORES ; Lo-res graphics
|
||||||
|
bit FULLGR ; mixed gr/text mode
|
||||||
|
bit SET_GR ; set graphics
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta DISP_PAGE
|
||||||
|
lda #4
|
||||||
|
sta DRAW_PAGE
|
||||||
|
sta REV_COUNT
|
||||||
|
|
||||||
|
;===================================
|
||||||
|
; Clear top/bottom of page 0 and 1
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
; jsr clear_screens
|
||||||
|
|
||||||
|
;===================================
|
||||||
|
; init the multiply tables
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
; jsr init_multiply_tables
|
||||||
|
|
||||||
|
;======================
|
||||||
|
; init plasma texture
|
||||||
|
;======================
|
||||||
|
|
||||||
|
jsr init_plasma_texture
|
||||||
|
|
||||||
|
;=================================
|
||||||
|
; main loop
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta ANGLE
|
||||||
|
sta SCALE_F
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta SCALE_I
|
||||||
|
|
||||||
|
roto_loop:
|
||||||
|
jsr update_plasma
|
||||||
|
|
||||||
|
jsr rotozoom
|
||||||
|
|
||||||
|
jsr page_flip
|
||||||
|
|
||||||
|
wait_for_keypress:
|
||||||
|
; lda KEYPRESS
|
||||||
|
; bpl wait_for_keypress
|
||||||
|
; bit KEYRESET
|
||||||
|
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda FRAME
|
||||||
|
adc direction
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
|
cmp #$f8 ; why -8?
|
||||||
|
beq back_at_zero
|
||||||
|
cmp #9 ; why 33?
|
||||||
|
; beq at_far_end
|
||||||
|
beq back_at_zero
|
||||||
|
bne done_reverse
|
||||||
|
|
||||||
|
back_at_zero:
|
||||||
|
; change plasma color
|
||||||
|
|
||||||
|
inc which_color
|
||||||
|
lda which_color
|
||||||
|
cmp #4
|
||||||
|
bne refresh_color
|
||||||
|
lda #0
|
||||||
|
sta which_color
|
||||||
|
refresh_color:
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda colorlookup,Y
|
||||||
|
sta color_lookup_smc+1
|
||||||
|
; sta colorlookup2_smc+1
|
||||||
|
lda colorlookup+1,Y
|
||||||
|
sta color_lookup_smc+2
|
||||||
|
; sta colorlookup2_smc+2
|
||||||
|
|
||||||
|
at_far_end:
|
||||||
|
|
||||||
|
; change bg color
|
||||||
|
|
||||||
|
; reverse direction
|
||||||
|
lda direction
|
||||||
|
eor #$ff
|
||||||
|
clc
|
||||||
|
adc #1
|
||||||
|
sta direction
|
||||||
|
|
||||||
|
lda scaleaddl
|
||||||
|
eor #$ff
|
||||||
|
clc
|
||||||
|
adc #1
|
||||||
|
sta scaleaddl
|
||||||
|
|
||||||
|
lda scaleaddh
|
||||||
|
eor #$ff
|
||||||
|
adc #0
|
||||||
|
sta scaleaddh
|
||||||
|
|
||||||
|
dec REV_COUNT
|
||||||
|
bne done_reverse
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
done_reverse:
|
||||||
|
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda ANGLE
|
||||||
|
adc direction
|
||||||
|
and #$3f
|
||||||
|
sta ANGLE
|
||||||
|
|
||||||
|
; increment zoom
|
||||||
|
|
||||||
|
; clc
|
||||||
|
; lda SCALE_F
|
||||||
|
; adc scaleaddl
|
||||||
|
; sta SCALE_F
|
||||||
|
; lda SCALE_I
|
||||||
|
; adc scaleaddh
|
||||||
|
; sta SCALE_I
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jmp roto_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
direction: .byte $01
|
||||||
|
scaleaddl: .byte $10
|
||||||
|
scaleaddh: .byte $00
|
||||||
|
|
||||||
|
;===============================================
|
||||||
|
; External modules
|
||||||
|
;===============================================
|
||||||
|
|
||||||
|
;.include "rotozoom_texture.s"
|
||||||
|
;.include "plasma.s"
|
||||||
|
|
||||||
|
;.include "gr_pageflip.s"
|
||||||
|
;.include "gr_fast_clear.s"
|
||||||
|
;.include "gr_copy.s"
|
||||||
|
;.include "decompress_fast_v2.s"
|
||||||
|
|
||||||
|
;.include "gr_offsets.s"
|
||||||
|
;.include "c00_scrn_offsets.s"
|
||||||
|
|
||||||
|
;.include "multiply_fast.s"
|
||||||
|
|
||||||
|
;===============================================
|
||||||
|
; Data
|
||||||
|
;===============================================
|
630
demos/outline2021/demo/rotozoom.s
Normal file
630
demos/outline2021/demo/rotozoom.s
Normal file
|
@ -0,0 +1,630 @@
|
||||||
|
|
||||||
|
; rotozoomer!
|
||||||
|
; takes a lores-formatted image in $c00 and rotozooms it
|
||||||
|
; by ANGLE and SCALE_I/SCALE_F and draws it to the
|
||||||
|
; lo-res page in DRAW_PAGE
|
||||||
|
|
||||||
|
; ANGLE in our case is 0..31
|
||||||
|
; SCALE_I/SCALE_F is 8.8 fixed point scale multiplier
|
||||||
|
|
||||||
|
; optimization (cycles measured at ANGLE=0)
|
||||||
|
; $6BD76=441,718=2.26fps initial code with external plot and scrn
|
||||||
|
; $62776=403,318=2.48fps inline plot
|
||||||
|
; $597b6=366,518=2.73fps inline scrn
|
||||||
|
; $4F496=324,758=3.08fps move plot line calc outside of inner loop
|
||||||
|
; $49d16=302,358=3.31fps do color*17 ourselves
|
||||||
|
; $4645e=287,838=3.47fps move XX into X
|
||||||
|
; $3ef7e=257,918=3.87fps optimize plot
|
||||||
|
; $3c9fe=248,318=4.03fps optimize scrn
|
||||||
|
; $39e3e=237,118=4.22fps add scrn address lookup table
|
||||||
|
; $39fdf=237,535 add two scale multiplies
|
||||||
|
; $39e17=237,079=4.22fps change the init to also use multiply
|
||||||
|
; $39dc9=237,001= change to use common lookup table (outside inner loop)
|
||||||
|
; $3399f=211,359=4.73fps unroll the Y loop by one
|
||||||
|
; $2BA83=178,819=5.59fps optimize unrolled loop
|
||||||
|
; $2B14B=176,459=5.66fps avoid extra jump (qkumba)
|
||||||
|
|
||||||
|
.if 0
|
||||||
|
CAL = $B0
|
||||||
|
CAH = $B1
|
||||||
|
SAL = $B2
|
||||||
|
SAH = $B3
|
||||||
|
YPL = $B4
|
||||||
|
YPH = $B5
|
||||||
|
XPL = $B6
|
||||||
|
XPH = $B7
|
||||||
|
;YY
|
||||||
|
;XX
|
||||||
|
CCAL = $B8
|
||||||
|
CCAH = $B9
|
||||||
|
CSAL = $BA
|
||||||
|
CSAH = $BB
|
||||||
|
YCAL = $BC
|
||||||
|
YCAH = $BD
|
||||||
|
YSAL = $BE
|
||||||
|
YSAH = $BF
|
||||||
|
.endif
|
||||||
|
|
||||||
|
rotozoom_c00:
|
||||||
|
|
||||||
|
; setup scale for multiply
|
||||||
|
|
||||||
|
lda SCALE_I ; 3
|
||||||
|
sta NUM1H ; 3
|
||||||
|
lda SCALE_F ; 3
|
||||||
|
sta NUM1L ; 3
|
||||||
|
|
||||||
|
; ca = cos(theta)*scale;
|
||||||
|
; (we use equiv ca=fixed_sin[(theta+8)&0xf] )
|
||||||
|
|
||||||
|
lda ANGLE ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc #8 ; 2
|
||||||
|
and #$1f ; 2
|
||||||
|
asl ; 2
|
||||||
|
tay ; 2
|
||||||
|
lda fixed_sin32,Y ; load integer half ; 4
|
||||||
|
sta NUM2H ; 3
|
||||||
|
lda fixed_sin32+1,Y ; load float half ; 4
|
||||||
|
sta NUM2L ; 3
|
||||||
|
;===========
|
||||||
|
; 27
|
||||||
|
|
||||||
|
sec ; reload NUM1H/NUM1L ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
stx CAH ; 3
|
||||||
|
sta CAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; sa = sin(theta)*scale;
|
||||||
|
|
||||||
|
lda ANGLE ; 3
|
||||||
|
asl ; 2
|
||||||
|
tay ; 2
|
||||||
|
lda fixed_sin32,Y ; load integer half ; 4
|
||||||
|
sta NUM2H ; 3
|
||||||
|
lda fixed_sin32+1,Y ; load integer half ; 4
|
||||||
|
sta NUM2L ; 3
|
||||||
|
;==========
|
||||||
|
; 21
|
||||||
|
|
||||||
|
|
||||||
|
clc ; NUM1H/NUM1L same as last time ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
|
||||||
|
stx SAH ; 3
|
||||||
|
sta SAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; cca = -20*ca;
|
||||||
|
|
||||||
|
lda #-20 ; 2
|
||||||
|
sta NUM1H ; 3
|
||||||
|
lda #0 ; 2
|
||||||
|
sta NUM1L ; 3
|
||||||
|
|
||||||
|
lda CAL ; 3
|
||||||
|
sta NUM2L ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
sta NUM2H ; 3
|
||||||
|
|
||||||
|
sec ; reload NUM1H/NUM1L ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
stx CCAH ; 3
|
||||||
|
sta CCAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; csa = -20*sa;
|
||||||
|
|
||||||
|
lda SAL ; 3
|
||||||
|
sta NUM2L ; 3
|
||||||
|
lda SAH ; 3
|
||||||
|
sta NUM2H ; 3
|
||||||
|
|
||||||
|
clc ; same NUM1H/NUM1L as las time ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
|
||||||
|
stx CSAH ; 3
|
||||||
|
sta CSAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; yca=cca+ycenter;
|
||||||
|
|
||||||
|
lda CCAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
clc ; 2
|
||||||
|
lda CCAH ; 3
|
||||||
|
adc #20 ; 2
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 16
|
||||||
|
; ysa=csa+xcenter;
|
||||||
|
|
||||||
|
lda CSAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
clc ; 2
|
||||||
|
lda CSAH ; 3
|
||||||
|
adc #20 ; 2
|
||||||
|
sta YSAH ; 3
|
||||||
|
;===========
|
||||||
|
; 16
|
||||||
|
|
||||||
|
; yloop, unrolled once
|
||||||
|
;===================================================================
|
||||||
|
; for(yy=0;yy<40;yy++) {
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
ldy #0 ; 2
|
||||||
|
sty YY ; 3
|
||||||
|
|
||||||
|
crotozoom_yloop:
|
||||||
|
|
||||||
|
; setup self-modifying code for plot
|
||||||
|
; YY already in Y from end of loop
|
||||||
|
; ldy YY ; 3
|
||||||
|
|
||||||
|
lda common_offsets_l,Y ; lookup low-res memory address ; 4
|
||||||
|
sta crplot2_smc+1 ; 4
|
||||||
|
sta crplot12_smc+1 ; 4
|
||||||
|
sta crplot22_smc+1 ; 4
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda gr_400_offsets_h,Y ; 4
|
||||||
|
adc DRAW_PAGE ; add in draw page offset ; 3
|
||||||
|
sta crplot2_smc+2 ; 4
|
||||||
|
sta crplot12_smc+2 ; 4
|
||||||
|
sta crplot22_smc+2 ; 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=====================
|
||||||
|
; unroll 0, even line
|
||||||
|
;=====================
|
||||||
|
|
||||||
|
|
||||||
|
; xp=cca+ysa; 8.8 fixed point
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc CCAL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc CCAH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; yp=yca-csa; 8.8 fixed point
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
sbc CSAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
sbc CSAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; for(xx=0;xx<40;xx++) {
|
||||||
|
ldx #0 ; 2
|
||||||
|
crotozoom_xloop:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
; note: every cycle saved below here
|
||||||
|
; saves 1600 cycles
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
; if ((xp<0) || (xp>39)) color=0;
|
||||||
|
; else if ((yp<0) || (yp>39)) color=0;
|
||||||
|
; else color=scrn_page(xp,yp,PAGE2);
|
||||||
|
|
||||||
|
; we know it's never going to go *that* far out of bounds
|
||||||
|
; so we could avoid the Y check by just having "0"
|
||||||
|
; on the edges of the screen? Tricky due to Apple II
|
||||||
|
; interlacing
|
||||||
|
|
||||||
|
croto_color_even_smc:
|
||||||
|
lda #0 ; default color ; 2
|
||||||
|
|
||||||
|
ldy XPH ; 3
|
||||||
|
bmi crplot ; 2nt/3
|
||||||
|
cpy #40 ; 2
|
||||||
|
bcs crplot ; 2nt/3
|
||||||
|
|
||||||
|
ldy YPH ; 3
|
||||||
|
bmi crplot ; 2nt/3
|
||||||
|
cpy #40 ; 2
|
||||||
|
bcs crplot ; 2nt/3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;==================================================
|
||||||
|
|
||||||
|
; scrn(xp,yp)
|
||||||
|
|
||||||
|
tya ; YPH ; 2
|
||||||
|
|
||||||
|
lsr ; divide to get index, also low bit in carry ; 2
|
||||||
|
tay ; 2
|
||||||
|
|
||||||
|
; TODO: put these in zero page?
|
||||||
|
; also we can share low bytes with other lookup
|
||||||
|
|
||||||
|
lda common_offsets_l,Y ; lookup low-res memory address ; 4
|
||||||
|
sta BASL ; 3
|
||||||
|
lda scrn_c00_offsets_h,Y ; 4
|
||||||
|
sta BASH ; 3
|
||||||
|
|
||||||
|
|
||||||
|
ldy XPH ; 3
|
||||||
|
lda (BASL),Y ; top/bottom color ; 5+
|
||||||
|
|
||||||
|
; carry was set a bit before to low bit of YPH
|
||||||
|
; hopefully nothing has cleared it
|
||||||
|
|
||||||
|
bcc crscrn_adjust_even ; 2nt/3
|
||||||
|
|
||||||
|
crscrn_adjust_odd:
|
||||||
|
; YP was odd so want top nibble
|
||||||
|
lsr ; 2
|
||||||
|
lsr ; 2
|
||||||
|
lsr ; 2
|
||||||
|
lsr ; 2
|
||||||
|
|
||||||
|
; fall through
|
||||||
|
|
||||||
|
crscrn_adjust_even:
|
||||||
|
|
||||||
|
; YP was even so want bottom nibble
|
||||||
|
and #$f ; 2
|
||||||
|
|
||||||
|
crscrn_done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=============================================
|
||||||
|
|
||||||
|
|
||||||
|
; always even, want A in bottom of nibble
|
||||||
|
; so we are all set
|
||||||
|
|
||||||
|
crotozoom_set_color:
|
||||||
|
; want same color in top and bottom nibbles
|
||||||
|
;==========
|
||||||
|
; 0
|
||||||
|
|
||||||
|
;=================================================
|
||||||
|
|
||||||
|
crplot:
|
||||||
|
|
||||||
|
; plot(xx,yy); (color is in A)
|
||||||
|
|
||||||
|
; we are in loop unroll0 so always even line here
|
||||||
|
|
||||||
|
; meaning we want to load old color, save top nibble, and over-write
|
||||||
|
; bottom nibble with our value
|
||||||
|
|
||||||
|
; but! we don't need to save old as we are re-drawing whole screen!
|
||||||
|
|
||||||
|
crplot_even:
|
||||||
|
|
||||||
|
crplot2_smc:
|
||||||
|
sta $400,X ; 5
|
||||||
|
;============
|
||||||
|
; 5
|
||||||
|
|
||||||
|
;=======================
|
||||||
|
|
||||||
|
; xp=xp+ca; fixed point 8.8
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda CAL ; 3
|
||||||
|
adc XPL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
adc XPH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
|
||||||
|
; yp=yp-sa; fixed point 8.8
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YPL ; 3
|
||||||
|
sbc SAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YPH ; 3
|
||||||
|
sbc SAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
|
||||||
|
crotozoom_end_xloop:
|
||||||
|
inx ; 2
|
||||||
|
cpx #40 ; 2
|
||||||
|
bne crotozoom_xloop ; 2nt/3
|
||||||
|
crotozoom_xloop_done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; yca+=ca; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
adc CAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
adc CAH ; 3
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; ysa+=sa; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc SAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc SAH ; 3
|
||||||
|
sta YSAH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; loop unroll 1
|
||||||
|
;===============
|
||||||
|
|
||||||
|
;rotozoom_yloop:
|
||||||
|
|
||||||
|
; xp=cca+ysa; 8.8 fixed point
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc CCAL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc CCAH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; yp=yca-csa; 8.8 fixed point
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
sbc CSAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
sbc CSAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; for(xx=0;xx<40;xx++) {
|
||||||
|
ldx #0 ; 2
|
||||||
|
crotozoom_xloop2:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
; note: every cycle saved below here
|
||||||
|
; saves 1600 cycles
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
; if ((xp<0) || (xp>39)) color=0;
|
||||||
|
; else if ((yp<0) || (yp>39)) color=0;
|
||||||
|
; else color=scrn_page(xp,yp,PAGE2);
|
||||||
|
|
||||||
|
; we know it's never going to go *that* far out of bounds
|
||||||
|
; so we could avoid the Y check by just having "0"
|
||||||
|
; on the edges of the screen? Tricky due to Apple II
|
||||||
|
; interlacing
|
||||||
|
|
||||||
|
croto_color_odd_smc:
|
||||||
|
lda #0 ; default color ; 2
|
||||||
|
|
||||||
|
ldy XPH ; 3
|
||||||
|
bmi crplot2 ; 2nt/3
|
||||||
|
cpy #40 ; 2
|
||||||
|
bcs crplot2 ; 2nt/3
|
||||||
|
|
||||||
|
ldy YPH ; 3
|
||||||
|
bmi crplot2 ; 2nt/3
|
||||||
|
cpy #40 ; 2
|
||||||
|
bcs crplot2 ; 2nt/3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;==================================================
|
||||||
|
|
||||||
|
; scrn(xp,yp)
|
||||||
|
|
||||||
|
tya ; YPH ; 2
|
||||||
|
|
||||||
|
lsr ; divide to get index, also low bit in carry ; 2
|
||||||
|
tay ; 2
|
||||||
|
|
||||||
|
; TODO: put these in zero page?
|
||||||
|
; also we can share low bytes with other lookup
|
||||||
|
|
||||||
|
lda common_offsets_l,Y ; lookup low-res memory address ; 4
|
||||||
|
sta BASL ; 3
|
||||||
|
lda scrn_c00_offsets_h,Y ; 4
|
||||||
|
sta BASH ; 3
|
||||||
|
|
||||||
|
|
||||||
|
ldy XPH ; 3
|
||||||
|
lda (BASL),Y ; top/bottom color ; 5+
|
||||||
|
|
||||||
|
; carry was set a bit before to low bit of YPH
|
||||||
|
; hopefully nothing has cleared it
|
||||||
|
|
||||||
|
bcs crscrn_adjust_odd2 ; 3
|
||||||
|
|
||||||
|
crscrn_adjust_even2:
|
||||||
|
|
||||||
|
; want bottom color, but put it in top of A
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
|
||||||
|
jmp crscrn_done2 ; 3
|
||||||
|
|
||||||
|
crscrn_adjust_odd2:
|
||||||
|
; want top color alone
|
||||||
|
|
||||||
|
and #$f0 ; 2
|
||||||
|
|
||||||
|
crscrn_done2:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=============================================
|
||||||
|
|
||||||
|
|
||||||
|
crotozoom_set_color2:
|
||||||
|
; always odd
|
||||||
|
; want color in top, which it is from above
|
||||||
|
;==========
|
||||||
|
; 0
|
||||||
|
|
||||||
|
;=================================================
|
||||||
|
|
||||||
|
crplot2:
|
||||||
|
|
||||||
|
; plot(xx,yy); (color is in A)
|
||||||
|
|
||||||
|
; always odd, so place color in top
|
||||||
|
|
||||||
|
; note! since we are drawing whole screen, we know the top of
|
||||||
|
; the value is already clear from loop=0 so we don't have to mask
|
||||||
|
|
||||||
|
crplot_odd:
|
||||||
|
crplot12_smc:
|
||||||
|
ora $400,X ; 4
|
||||||
|
crplot22_smc:
|
||||||
|
sta $400,X ; 5
|
||||||
|
|
||||||
|
;============
|
||||||
|
; 9
|
||||||
|
|
||||||
|
;=======================
|
||||||
|
|
||||||
|
; xp=xp+ca; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda CAL ; 3
|
||||||
|
adc XPL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
adc XPH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
|
||||||
|
; yp=yp-sa; 8.8 fixed point
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YPL ; 3
|
||||||
|
sbc SAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YPH ; 3
|
||||||
|
sbc SAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
|
||||||
|
crotozoom_end_xloop2:
|
||||||
|
inx ; 2
|
||||||
|
cpx #40 ; 2
|
||||||
|
bne crotozoom_xloop2 ; 3
|
||||||
|
crotozoom_xloop_done2:
|
||||||
|
|
||||||
|
; yca+=ca; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
adc CAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
adc CAH ; 3
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; ysa+=sa; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc SAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc SAH ; 3
|
||||||
|
sta YSAH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
crotozoom_end_yloop:
|
||||||
|
inc YY ; 5
|
||||||
|
ldy YY ; 3
|
||||||
|
cpy #24 ; 2
|
||||||
|
beq cdone_rotozoom ; 2nt/3
|
||||||
|
jmp crotozoom_yloop ; too far ; 3
|
||||||
|
|
||||||
|
cdone_rotozoom:
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
fixed_sin32:
|
||||||
|
; .byte $00,$00 ; 0.000000=00.00
|
||||||
|
; .byte $00,$61 ; 0.382683=00.61
|
||||||
|
; .byte $00,$b5 ; 0.707107=00.b5
|
||||||
|
; .byte $00,$ec ; 0.923880=00.ec
|
||||||
|
; .byte $01,$00 ; 1.000000=01.00
|
||||||
|
; .byte $00,$ec ; 0.923880=00.ec
|
||||||
|
; .byte $00,$b5 ; 0.707107=00.b5
|
||||||
|
; .byte $00,$61 ; 0.382683=00.61
|
||||||
|
; .byte $00,$00 ; 0.000000=00.00
|
||||||
|
; .byte $ff,$9f ; -0.382683=ff.9f
|
||||||
|
; .byte $ff,$4b ; -0.707107=ff.4b
|
||||||
|
; .byte $ff,$14 ; -0.923880=ff.14
|
||||||
|
; .byte $ff,$00 ; -1.000000=ff.00
|
||||||
|
; .byte $ff,$14 ; -0.923880=ff.14
|
||||||
|
; .byte $ff,$4b ; -0.707107=ff.4b
|
||||||
|
; .byte $ff,$9f ; -0.382683=ff.9f
|
||||||
|
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $01,$00 ; 1.000000
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$00 ; -1.000000
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
|
599
demos/outline2021/demo/rotozoom_texture.s
Normal file
599
demos/outline2021/demo/rotozoom_texture.s
Normal file
|
@ -0,0 +1,599 @@
|
||||||
|
|
||||||
|
; rotozoomer!
|
||||||
|
; with 16x16 texture
|
||||||
|
|
||||||
|
; takes a lores-formatted image in $c00 and rotozooms it
|
||||||
|
; by ANGLE and SCALE_I/SCALE_F and draws it to the
|
||||||
|
; lo-res page in DRAW_PAGE
|
||||||
|
|
||||||
|
; ANGLE in our case is 0..31
|
||||||
|
; SCALE_I/SCALE_F is 8.8 fixed point scale multiplier
|
||||||
|
|
||||||
|
|
||||||
|
; $2E7CF = 190,415 = 5.25fps first merging
|
||||||
|
; $2D8CF = 186,575 = 5.35fps move mask to rotate not draw
|
||||||
|
; $29CCF = 171,215 = 5.84fps do color conversion outside of loop
|
||||||
|
; $28DCF = 167,375 = 5.97fps two lookup tables for hi/low
|
||||||
|
; $26FCF = 159,695 = 6.26fps remove carry set/clear for fixed point adds
|
||||||
|
|
||||||
|
CAL = $B0
|
||||||
|
CAH = $B1
|
||||||
|
SAL = $B2
|
||||||
|
SAH = $B3
|
||||||
|
YPL = $B4
|
||||||
|
YPH = $B5
|
||||||
|
XPL = $B6
|
||||||
|
XPH = $B7
|
||||||
|
;YY
|
||||||
|
;XX
|
||||||
|
CCAL = $B8
|
||||||
|
CCAH = $B9
|
||||||
|
CSAL = $BA
|
||||||
|
CSAH = $BB
|
||||||
|
YCAL = $BC
|
||||||
|
YCAH = $BD
|
||||||
|
YSAL = $BE
|
||||||
|
YSAH = $BF
|
||||||
|
|
||||||
|
rotozoom:
|
||||||
|
|
||||||
|
; setup scale for multiply
|
||||||
|
|
||||||
|
lda SCALE_I ; 3
|
||||||
|
sta NUM1H ; 3
|
||||||
|
lda SCALE_F ; 3
|
||||||
|
sta NUM1L ; 3
|
||||||
|
|
||||||
|
; ca = cos(theta)*scale;
|
||||||
|
; (we use equiv ca=fixed_sin[(theta+8)&0xf] )
|
||||||
|
|
||||||
|
lda ANGLE ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc #16 ; 2
|
||||||
|
and #$3f ; 2
|
||||||
|
asl ; 2
|
||||||
|
tay ; 2
|
||||||
|
lda fixed_sin64,Y ; load integer half ; 4
|
||||||
|
sta NUM2H ; 3
|
||||||
|
lda fixed_sin64+1,Y ; load float half ; 4
|
||||||
|
sta NUM2L ; 3
|
||||||
|
;===========
|
||||||
|
; 27
|
||||||
|
|
||||||
|
sec ; reload NUM1H/NUM1L ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
stx CAH ; 3
|
||||||
|
sta CAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; sa = sin(theta)*scale;
|
||||||
|
|
||||||
|
lda ANGLE ; 3
|
||||||
|
asl ; 2
|
||||||
|
tay ; 2
|
||||||
|
lda fixed_sin64,Y ; load integer half ; 4
|
||||||
|
sta NUM2H ; 3
|
||||||
|
lda fixed_sin64+1,Y ; load integer half ; 4
|
||||||
|
sta NUM2L ; 3
|
||||||
|
;==========
|
||||||
|
; 21
|
||||||
|
|
||||||
|
|
||||||
|
clc ; NUM1H/NUM1L same as last time ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
|
||||||
|
stx SAH ; 3
|
||||||
|
sta SAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; cca = -20*ca;
|
||||||
|
|
||||||
|
lda #-20 ; 2
|
||||||
|
sta NUM1H ; 3
|
||||||
|
lda #0 ; 2
|
||||||
|
sta NUM1L ; 3
|
||||||
|
|
||||||
|
lda CAL ; 3
|
||||||
|
sta NUM2L ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
sta NUM2H ; 3
|
||||||
|
|
||||||
|
sec ; reload NUM1H/NUM1L ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
stx CCAH ; 3
|
||||||
|
sta CCAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; csa = -20*sa;
|
||||||
|
|
||||||
|
lda SAL ; 3
|
||||||
|
sta NUM2L ; 3
|
||||||
|
lda SAH ; 3
|
||||||
|
sta NUM2H ; 3
|
||||||
|
|
||||||
|
clc ; same NUM1H/NUM1L as las time ; 2
|
||||||
|
jsr multiply ; 6+???
|
||||||
|
|
||||||
|
stx CSAH ; 3
|
||||||
|
sta CSAL ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; yca=cca+ycenter;
|
||||||
|
|
||||||
|
lda CCAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
clc ; 2
|
||||||
|
lda CCAH ; 3
|
||||||
|
adc #20 ; 2
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 16
|
||||||
|
; ysa=csa+xcenter;
|
||||||
|
|
||||||
|
lda CSAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
clc ; 2
|
||||||
|
lda CSAH ; 3
|
||||||
|
adc #20 ; 2
|
||||||
|
sta YSAH ; 3
|
||||||
|
;===========
|
||||||
|
; 16
|
||||||
|
|
||||||
|
; yloop, unrolled once
|
||||||
|
;===================================================================
|
||||||
|
; for(yy=0;yy<40;yy++) {
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
ldy #0 ; 2
|
||||||
|
sty YY ; 3
|
||||||
|
|
||||||
|
rotozoom_yloop:
|
||||||
|
|
||||||
|
; setup self-modifying code for plot
|
||||||
|
; YY already in Y from end of loop
|
||||||
|
; ldy YY ; 3
|
||||||
|
|
||||||
|
lda common_offsets_l,Y ; lookup low-res memory address ; 4
|
||||||
|
sta rplot2_smc+1 ; 4
|
||||||
|
sta rplot12_smc+1 ; 4
|
||||||
|
sta rplot22_smc+1 ; 4
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda gr_400_offsets_h,Y ; 4
|
||||||
|
adc DRAW_PAGE ; add in draw page offset ; 3
|
||||||
|
sta rplot2_smc+2 ; 4
|
||||||
|
sta rplot12_smc+2 ; 4
|
||||||
|
sta rplot22_smc+2 ; 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=====================
|
||||||
|
; unroll 0, even line
|
||||||
|
;=====================
|
||||||
|
|
||||||
|
|
||||||
|
; xp=cca+ysa; 8.8 fixed point
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc CCAL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc CCAH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; yp=yca-csa; 8.8 fixed point
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
sbc CSAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
sbc CSAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; for(xx=0;xx<40;xx++) {
|
||||||
|
ldx #0 ; 2
|
||||||
|
rotozoom_xloop:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
; note: every cycle saved below here
|
||||||
|
; saves 1600 cycles
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
lda XPH ; 3
|
||||||
|
and #$f ; 2
|
||||||
|
sta CTEMP ; 3
|
||||||
|
|
||||||
|
lda YPH ; 3
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
asl ; 2
|
||||||
|
clc ; 2
|
||||||
|
adc CTEMP ; 3
|
||||||
|
tay ; 2
|
||||||
|
|
||||||
|
lda low_lookup,Y ; 4
|
||||||
|
|
||||||
|
;============
|
||||||
|
; 30
|
||||||
|
rscrn_done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=============================================
|
||||||
|
|
||||||
|
|
||||||
|
; always even, want A in bottom of nibble
|
||||||
|
; so we are all set
|
||||||
|
|
||||||
|
rotozoom_set_color:
|
||||||
|
; want same color in top and bottom nibbles
|
||||||
|
;==========
|
||||||
|
; 0
|
||||||
|
|
||||||
|
;=================================================
|
||||||
|
|
||||||
|
rplot:
|
||||||
|
|
||||||
|
; plot(xx,yy); (color is in A)
|
||||||
|
|
||||||
|
; we are in loop unroll0 so always even line here
|
||||||
|
|
||||||
|
; meaning we want to load old color, save top nibble, and over-write
|
||||||
|
; bottom nibble with our value
|
||||||
|
|
||||||
|
; but! we don't need to save old as we are re-drawing whole screen!
|
||||||
|
|
||||||
|
rplot_even:
|
||||||
|
|
||||||
|
rplot2_smc:
|
||||||
|
sta $400,X ; 5
|
||||||
|
;============
|
||||||
|
; 5
|
||||||
|
|
||||||
|
;=======================
|
||||||
|
|
||||||
|
; xp=xp+ca; fixed point 8.8
|
||||||
|
|
||||||
|
; always set? also low importance LSB
|
||||||
|
; clc ; 2
|
||||||
|
lda CAL ; 3
|
||||||
|
adc XPL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
adc XPH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
|
||||||
|
; yp=yp-sa; fixed point 8.8
|
||||||
|
|
||||||
|
; low importance LSB?
|
||||||
|
; sec ; 2
|
||||||
|
lda YPL ; 3
|
||||||
|
sbc SAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YPH ; 3
|
||||||
|
sbc SAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
|
||||||
|
rotozoom_end_xloop:
|
||||||
|
inx ; 2
|
||||||
|
cpx #40 ; 2
|
||||||
|
bne rotozoom_xloop ; 2nt/3
|
||||||
|
rotozoom_xloop_done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; yca+=ca; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
adc CAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
adc CAH ; 3
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; ysa+=sa; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc SAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc SAH ; 3
|
||||||
|
sta YSAH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; loop unroll 1
|
||||||
|
;===============
|
||||||
|
|
||||||
|
;rotozoom_yloop:
|
||||||
|
|
||||||
|
; xp=cca+ysa; 8.8 fixed point
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc CCAL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc CCAH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; yp=yca-csa; 8.8 fixed point
|
||||||
|
|
||||||
|
sec ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
sbc CSAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
sbc CSAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; for(xx=0;xx<40;xx++) {
|
||||||
|
ldx #0 ; 2
|
||||||
|
rotozoom_xloop2:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
; note: every cycle saved below here
|
||||||
|
; saves 1600 cycles
|
||||||
|
;===================================================================
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
; if ((xp<0) || (xp>39)) color=0;
|
||||||
|
; else if ((yp<0) || (yp>39)) color=0;
|
||||||
|
; else color=scrn_page(xp,yp,PAGE2);
|
||||||
|
|
||||||
|
; we know it's never going to go *that* far out of bounds
|
||||||
|
; so we could avoid the Y check by just having "0"
|
||||||
|
; on the edges of the screen? Tricky due to Apple II
|
||||||
|
; interlacing
|
||||||
|
|
||||||
|
lda XPH
|
||||||
|
and #$f
|
||||||
|
sta CTEMP
|
||||||
|
|
||||||
|
lda YPH
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
clc
|
||||||
|
adc CTEMP
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda high_lookup,Y
|
||||||
|
; and #$f0
|
||||||
|
|
||||||
|
;=============================================
|
||||||
|
|
||||||
|
|
||||||
|
rotozoom_set_color2:
|
||||||
|
; always odd
|
||||||
|
; want color in top, which it is from above
|
||||||
|
;==========
|
||||||
|
; 0
|
||||||
|
|
||||||
|
;=================================================
|
||||||
|
|
||||||
|
rplot2:
|
||||||
|
|
||||||
|
; plot(xx,yy); (color is in A)
|
||||||
|
|
||||||
|
; always odd, so place color in top
|
||||||
|
|
||||||
|
; note! since we are drawing whole screen, we know the top of
|
||||||
|
; the value is already clear from loop=0 so we don't have to mask
|
||||||
|
|
||||||
|
rplot_odd:
|
||||||
|
rplot12_smc:
|
||||||
|
ora $400,X ; 4
|
||||||
|
rplot22_smc:
|
||||||
|
sta $400,X ; 5
|
||||||
|
|
||||||
|
;============
|
||||||
|
; 9
|
||||||
|
|
||||||
|
;=======================
|
||||||
|
|
||||||
|
; xp=xp+ca; 8.8 fixed point
|
||||||
|
|
||||||
|
; clc ; 2
|
||||||
|
lda CAL ; 3
|
||||||
|
adc XPL ; 3
|
||||||
|
sta XPL ; 3
|
||||||
|
lda CAH ; 3
|
||||||
|
adc XPH ; 3
|
||||||
|
sta XPH ; 3
|
||||||
|
|
||||||
|
; yp=yp-sa; 8.8 fixed point
|
||||||
|
|
||||||
|
; sec ; 2
|
||||||
|
lda YPL ; 3
|
||||||
|
sbc SAL ; 3
|
||||||
|
sta YPL ; 3
|
||||||
|
lda YPH ; 3
|
||||||
|
sbc SAH ; 3
|
||||||
|
sta YPH ; 3
|
||||||
|
|
||||||
|
rotozoom_end_xloop2:
|
||||||
|
inx ; 2
|
||||||
|
cpx #40 ; 2
|
||||||
|
bne rotozoom_xloop2 ; 3
|
||||||
|
rotozoom_xloop_done2:
|
||||||
|
|
||||||
|
; yca+=ca; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YCAL ; 3
|
||||||
|
adc CAL ; 3
|
||||||
|
sta YCAL ; 3
|
||||||
|
lda YCAH ; 3
|
||||||
|
adc CAH ; 3
|
||||||
|
sta YCAH ; 3
|
||||||
|
;===========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
; ysa+=sa; 8.8 fixed point
|
||||||
|
|
||||||
|
clc ; 2
|
||||||
|
lda YSAL ; 3
|
||||||
|
adc SAL ; 3
|
||||||
|
sta YSAL ; 3
|
||||||
|
lda YSAH ; 3
|
||||||
|
adc SAH ; 3
|
||||||
|
sta YSAH ; 3
|
||||||
|
;==========
|
||||||
|
; 20
|
||||||
|
|
||||||
|
rotozoom_end_yloop:
|
||||||
|
inc YY ; 5
|
||||||
|
ldy YY ; 3
|
||||||
|
cpy #24 ; 2
|
||||||
|
beq done_rotozoom ; 2nt/3
|
||||||
|
jmp rotozoom_yloop ; too far ; 3
|
||||||
|
|
||||||
|
done_rotozoom:
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fixed_sin64:
|
||||||
|
; .byte $00,$00 ; 0.000000=00.00
|
||||||
|
; .byte $00,$61 ; 0.382683=00.61
|
||||||
|
; .byte $00,$b5 ; 0.707107=00.b5
|
||||||
|
; .byte $00,$ec ; 0.923880=00.ec
|
||||||
|
; .byte $01,$00 ; 1.000000=01.00
|
||||||
|
; .byte $00,$ec ; 0.923880=00.ec
|
||||||
|
; .byte $00,$b5 ; 0.707107=00.b5
|
||||||
|
; .byte $00,$61 ; 0.382683=00.61
|
||||||
|
; .byte $00,$00 ; 0.000000=00.00
|
||||||
|
; .byte $ff,$9f ; -0.382683=ff.9f
|
||||||
|
; .byte $ff,$4b ; -0.707107=ff.4b
|
||||||
|
; .byte $ff,$14 ; -0.923880=ff.14
|
||||||
|
; .byte $ff,$00 ; -1.000000=ff.00
|
||||||
|
; .byte $ff,$14 ; -0.923880=ff.14
|
||||||
|
; .byte $ff,$4b ; -0.707107=ff.4b
|
||||||
|
; .byte $ff,$9f ; -0.382683=ff.9f
|
||||||
|
|
||||||
|
.if 0
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $01,$00 ; 1.000000
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$00 ; -1.000000
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $00,$19 ; 0.098017
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$4A ; 0.290285
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$78 ; 0.471397
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$A2 ; 0.634393
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$C5 ; 0.773010
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$E1 ; 0.881921
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$F4 ; 0.956940
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $00,$FE ; 0.995185
|
||||||
|
.byte $01,$00 ; 1.000000
|
||||||
|
.byte $00,$FE ; 0.995185
|
||||||
|
.byte $00,$FB ; 0.980785
|
||||||
|
.byte $00,$F4 ; 0.956940
|
||||||
|
.byte $00,$EC ; 0.923880
|
||||||
|
.byte $00,$E1 ; 0.881921
|
||||||
|
.byte $00,$D4 ; 0.831470
|
||||||
|
.byte $00,$C5 ; 0.773010
|
||||||
|
.byte $00,$B5 ; 0.707107
|
||||||
|
.byte $00,$A2 ; 0.634393
|
||||||
|
.byte $00,$8E ; 0.555570
|
||||||
|
.byte $00,$78 ; 0.471397
|
||||||
|
.byte $00,$61 ; 0.382683
|
||||||
|
.byte $00,$4A ; 0.290285
|
||||||
|
.byte $00,$31 ; 0.195090
|
||||||
|
.byte $00,$19 ; 0.098017
|
||||||
|
.byte $00,$00 ; 0.000000
|
||||||
|
.byte $FF,$E7 ; -0.098017
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
.byte $FF,$B6 ; -0.290285
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$88 ; -0.471397
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$5E ; -0.634393
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$3B ; -0.773010
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$1F ; -0.881921
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$0C ; -0.956940
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$02 ; -0.995185
|
||||||
|
.byte $FF,$00 ; -1.000000
|
||||||
|
.byte $FF,$02 ; -0.995185
|
||||||
|
.byte $FF,$05 ; -0.980785
|
||||||
|
.byte $FF,$0C ; -0.956940
|
||||||
|
.byte $FF,$14 ; -0.923880
|
||||||
|
.byte $FF,$1F ; -0.881921
|
||||||
|
.byte $FF,$2C ; -0.831470
|
||||||
|
.byte $FF,$3B ; -0.773010
|
||||||
|
.byte $FF,$4B ; -0.707107
|
||||||
|
.byte $FF,$5E ; -0.634393
|
||||||
|
.byte $FF,$72 ; -0.555570
|
||||||
|
.byte $FF,$88 ; -0.471397
|
||||||
|
.byte $FF,$9F ; -0.382683
|
||||||
|
.byte $FF,$B6 ; -0.290285
|
||||||
|
.byte $FF,$CF ; -0.195090
|
||||||
|
.byte $FF,$E7 ; -0.098017
|
|
@ -5,8 +5,8 @@
|
||||||
; CONSTANTS
|
; CONSTANTS
|
||||||
;===========
|
;===========
|
||||||
CONST_SHIPX = 15
|
CONST_SHIPX = 15
|
||||||
CONST_TILE_W = 64
|
CONST_TILE_W = 16
|
||||||
CONST_TILE_H = 64
|
CONST_TILE_H = 16
|
||||||
CONST_MAP_MASK_X = (CONST_TILE_W - 1)
|
CONST_MAP_MASK_X = (CONST_TILE_W - 1)
|
||||||
CONST_MAP_MASK_Y = (CONST_TILE_H - 1)
|
CONST_MAP_MASK_Y = (CONST_TILE_H - 1)
|
||||||
CONST_LOWRES_W = 40
|
CONST_LOWRES_W = 40
|
||||||
|
@ -36,6 +36,12 @@ mode7_flying:
|
||||||
lda #4
|
lda #4
|
||||||
sta DRAW_PAGE
|
sta DRAW_PAGE
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; Init texture
|
||||||
|
;===============
|
||||||
|
|
||||||
|
jsr wires_create_lookup
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; Init Variables
|
; Init Variables
|
||||||
;===============
|
;===============
|
||||||
|
@ -238,6 +244,7 @@ check_land:
|
||||||
cmp #13
|
cmp #13
|
||||||
bne check_help
|
bne check_help
|
||||||
|
|
||||||
|
.if 0
|
||||||
;=====
|
;=====
|
||||||
; LAND
|
; LAND
|
||||||
;=====
|
;=====
|
||||||
|
@ -298,7 +305,7 @@ done_flying:
|
||||||
rts ; finish flying
|
rts ; finish flying
|
||||||
|
|
||||||
must_land_on_grass:
|
must_land_on_grass:
|
||||||
|
.endif
|
||||||
|
|
||||||
check_help:
|
check_help:
|
||||||
cmp #('H')
|
cmp #('H')
|
||||||
|
@ -382,6 +389,7 @@ speed_loop:
|
||||||
draw_background:
|
draw_background:
|
||||||
jsr draw_background_mode7 ; 6
|
jsr draw_background_mode7 ; 6
|
||||||
|
|
||||||
|
.if 0
|
||||||
check_over_water:
|
check_over_water:
|
||||||
; See if we are over water
|
; See if we are over water
|
||||||
lda CX_I ; 3
|
lda CX_I ; 3
|
||||||
|
@ -424,7 +432,7 @@ no_turning_splash:
|
||||||
|
|
||||||
lda #1 ; 2
|
lda #1 ; 2
|
||||||
sta DRAW_SPLASH ; 3
|
sta DRAW_SPLASH ; 3
|
||||||
|
.endif
|
||||||
no_splash:
|
no_splash:
|
||||||
|
|
||||||
;==============
|
;==============
|
||||||
|
@ -627,22 +635,18 @@ update_z_factor:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
flying_map:
|
;flying_map:
|
||||||
.byte $22,$ff,$ff,$ff, $ff,$ff,$ff,$22
|
; .byte $22,$ff,$ff,$ff, $ff,$ff,$ff,$22
|
||||||
.byte $dd,$cc,$cc,$88, $44,$44,$00,$dd
|
; .byte $dd,$cc,$cc,$88, $44,$44,$00,$dd
|
||||||
.byte $dd,$cc,$cc,$cc, $88,$44,$44,$dd
|
; .byte $dd,$cc,$cc,$cc, $88,$44,$44,$dd
|
||||||
.byte $dd,$cc,$cc,$88, $44,$44,$44,$dd
|
; .byte $dd,$cc,$cc,$88, $44,$44,$44,$dd
|
||||||
.byte $dd,$cc,$99,$99, $88,$44,$44,$dd
|
; .byte $dd,$cc,$99,$99, $88,$44,$44,$dd
|
||||||
.byte $dd,$cc,$99,$88, $44,$44,$44,$dd
|
; .byte $dd,$cc,$99,$88, $44,$44,$44,$dd
|
||||||
.byte $dd,$cc,$99,$99, $11,$44,$44,$dd
|
; .byte $dd,$cc,$99,$99, $11,$44,$44,$dd
|
||||||
.byte $22,$dd,$dd,$dd, $dd,$dd,$dd,$22
|
; .byte $22,$dd,$dd,$dd, $dd,$dd,$dd,$22
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
water_map:
|
|
||||||
.byte $22,$22,$22,$22, $22,$22,$22,$22
|
|
||||||
.byte $ee,$22,$22,$22, $22,$22,$22,$22
|
|
||||||
.byte $22,$22,$22,$22, $22,$22,$22,$22
|
|
||||||
.byte $22,$22,$22,$22, $ee,$22,$22,$22
|
|
||||||
|
|
||||||
|
|
||||||
;===============================================
|
;===============================================
|
||||||
|
|
|
@ -123,7 +123,7 @@ color_notblack:
|
||||||
|
|
||||||
inc FRAME
|
inc FRAME
|
||||||
lda FRAME
|
lda FRAME
|
||||||
cmp #$40
|
cmp #$32
|
||||||
bne wires_forever_loop
|
bne wires_forever_loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -107,6 +107,8 @@ LOAD_WORLD = $A8
|
||||||
LASTKEY = $A9
|
LASTKEY = $A9
|
||||||
KEY_OFFSET = $AA
|
KEY_OFFSET = $AA
|
||||||
KEY_COUNT = $AB
|
KEY_COUNT = $AB
|
||||||
|
SCALE_I = $AC
|
||||||
|
SCALE_F = $AD
|
||||||
|
|
||||||
SHIPY = $E4 ; mode7
|
SHIPY = $E4 ; mode7
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ TINH = $F1
|
||||||
YPOS = $F1 ; shimmer
|
YPOS = $F1 ; shimmer
|
||||||
XHIGH = $F1 ; credits
|
XHIGH = $F1 ; credits
|
||||||
X0 = $F1 ; a2
|
X0 = $F1 ; a2
|
||||||
|
YY = $F1 ; plasma
|
||||||
|
|
||||||
BINL = $F2
|
BINL = $F2
|
||||||
DIRECTION = $F2 ; shimmer
|
DIRECTION = $F2 ; shimmer
|
||||||
|
@ -133,7 +136,7 @@ Y1 = $F2 ; a2
|
||||||
LOGO_OFFSET = $F2 ; credits
|
LOGO_OFFSET = $F2 ; credits
|
||||||
|
|
||||||
BINH = $F3
|
BINH = $F3
|
||||||
|
REV_COUNT = $F4 ; plasma
|
||||||
|
|
||||||
SCROLL_COUNT = $F9
|
SCROLL_COUNT = $F9
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@ EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||||
|
|
||||||
all: boxes.dsk make_boxes
|
all: boxes.dsk make_boxes
|
||||||
|
|
||||||
boxes.dsk: HELLO A2_BOXES BOXES RR
|
boxes.dsk: HELLO A2_BOXES BOXES RR NYAN
|
||||||
cp $(EMPTYDISK) boxes.dsk
|
cp $(EMPTYDISK) boxes.dsk
|
||||||
$(DOS33) -y boxes.dsk SAVE A HELLO
|
$(DOS33) -y boxes.dsk SAVE A HELLO
|
||||||
$(DOS33) -y boxes.dsk BSAVE -a 0x300 BOXES
|
$(DOS33) -y boxes.dsk BSAVE -a 0x300 BOXES
|
||||||
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 A2_BOXES
|
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 A2_BOXES
|
||||||
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 RR
|
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 RR
|
||||||
|
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 NYAN
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
@ -35,6 +36,15 @@ RR: rr.o
|
||||||
rr.o: rr.s
|
rr.o: rr.s
|
||||||
ca65 -o rr.o rr.s -l rr.lst
|
ca65 -o rr.o rr.s -l rr.lst
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
NYAN: nyan.o
|
||||||
|
ld65 -o NYAN nyan.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||||
|
|
||||||
|
nyan.o: nyan.s
|
||||||
|
ca65 -o nyan.o nyan.s -l nyan.lst
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
0 0 39 0 47 ; background (x1 x2 y1 y2)
|
2 0 39 0 47 ; background (x1 x2 y1 y2)
|
||||||
8 15 25 20 30 ; pastry
|
8 15 25 20 30 ; pastry
|
||||||
3 16 24 20 28 ; frosting
|
11 16 24 20 28 ; frosting
|
||||||
1 0 14 19 20 ; red
|
1 0 14 19 20 ; red
|
||||||
9 0 14 21 22 ; orange
|
9 0 14 21 22 ; orange
|
||||||
13 0 14 23 24 ; yellow
|
13 0 14 23 24 ; yellow
|
||||||
12 0 14 25 26 ; l. green
|
12 0 14 25 26 ; l. green
|
||||||
6 0 14 27 28 ; l. blue
|
6 0 14 27 28 ; l. blue
|
||||||
2 0 14 29 30 ; purple
|
3 0 14 29 30 ; purple
|
||||||
1 6 9 18 19 ; red
|
1 6 9 18 19 ; red
|
||||||
9 6 9 20 21 ; orange
|
9 6 9 20 21 ; orange
|
||||||
13 6 9 22 23 ; yellow
|
13 6 9 22 23 ; yellow
|
||||||
12 6 9 24 25 ; l. green
|
12 6 9 24 25 ; l. green
|
||||||
6 6 9 26 27 ; l. blue
|
6 6 9 26 27 ; l. blue
|
||||||
2 6 9 28 29 ; purple
|
3 6 9 28 29 ; purple
|
||||||
0 6 9 30 31 ; bg
|
2 6 9 30 31 ; bg
|
||||||
5 21 27 23 29 ; head
|
5 21 27 23 29 ; head
|
||||||
5 21 21 22 31 ; ear/foot
|
5 21 21 22 31 ; ear/foot
|
||||||
5 27 27 21 28 ; ear
|
5 27 27 21 28 ; ear
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
Xdraw testing:
|
Xdraw testing:
|
||||||
|
|
||||||
Size $20
|
Note: try them with various ROT as well
|
||||||
|
|
||||||
|
Size $20, ROT=$0
|
||||||
D02A
|
D02A
|
||||||
D07D-D083 interesting
|
D07D-D083 interesting
|
||||||
D23C
|
D23C
|
||||||
D251-D25D (D256 highlight)
|
D251-D25D (D256 highlight)
|
||||||
|
D300 not bad
|
||||||
|
D32D? D336?
|
||||||
|
D33D is nice
|
||||||
|
D347 is OK
|
||||||
|
|
||||||
|
**** D34D ****
|
||||||
|
D34E
|
||||||
|
D34F
|
||||||
|
D350
|
||||||
|
D351
|
||||||
|
**** D352 ****
|
||||||
|
(a few that are soso)
|
||||||
|
D357
|
||||||
|
D35A they end?
|
||||||
|
D35E is good though...
|
||||||
|
|
||||||
|
D3D6 ok
|
||||||
|
|
||||||
|
*** stopped at D4 for now
|
||||||
|
|
||||||
To try:
|
To try:
|
||||||
Cycle colors (clear background, offset X by 1)
|
Cycle colors (clear background, offset X by 1)
|
||||||
|
|
|
@ -96,7 +96,8 @@ tiny_loop:
|
||||||
; F0 01 = cool, let's go with it
|
; F0 01 = cool, let's go with it
|
||||||
|
|
||||||
smc2:
|
smc2:
|
||||||
ldy #$d0 ; point to top byte of shape address
|
; ldy #$d0 ; point to top byte of shape address
|
||||||
|
ldy #$d3 ; point to top byte of shape address
|
||||||
|
|
||||||
smc1:
|
smc1:
|
||||||
ldx #$00 ; point to bottom byte of shape address
|
ldx #$00 ; point to bottom byte of shape address
|
||||||
|
@ -105,7 +106,7 @@ smc1:
|
||||||
; ROT in A
|
; ROT in A
|
||||||
|
|
||||||
; this will be 0 2nd time through loop, arbitrary otherwise
|
; this will be 0 2nd time through loop, arbitrary otherwise
|
||||||
; lda #0 ; ROT=0
|
lda #0 ; ROT=0
|
||||||
jsr XDRAW0 ; XDRAW 1 AT X,Y
|
jsr XDRAW0 ; XDRAW 1 AT X,Y
|
||||||
; Both A and X are 0 at exit
|
; Both A and X are 0 at exit
|
||||||
; Z flag set on exit
|
; Z flag set on exit
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
0 T=INT(RND(1)*20)+1
|
0 PR#3
|
||||||
1 B=T+8: IF B>23 THEN B=23
|
1 T=INT(RND(1)*20)+1
|
||||||
2 L=INT(RND(1)*35)
|
2 B=T+8: IF B>23 THEN B=23
|
||||||
3 POKE 32,L:POKE 33,1:POKE 34,T:POKE 35,B
|
3 L=INT(RND(1)*35)
|
||||||
4 VTAB T
|
4 POKE 32,L:POKE 33,1:POKE 34,T:POKE 35,B
|
||||||
5 LIST 7
|
5 VTAB T
|
||||||
6 GOTO 0
|
6 LIST 8
|
||||||
7 "-!/\*+^%
|
7 GOTO 1
|
||||||
|
8 "-!/\*+^%
|
||||||
|
|
Loading…
Reference in New Issue
Block a user