Compare commits
No commits in common. "b56dc1e98bfeb3c18c4f90df0e0d19fbe5362cde" and "ed79c80b167607f0c59d7c8f33569f9bf3e981f5" have entirely different histories.
b56dc1e98b
...
ed79c80b16
1 changed files with 25 additions and 51 deletions
76
mandel.s
76
mandel.s
|
|
@ -262,10 +262,7 @@ palette_chroma_entries = 15
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;z_buffer_len = 16 ; 10.863 ms/px
|
z_buffer_len = 16
|
||||||
;z_buffer_len = 12 ; 10.619 ms/px
|
|
||||||
z_buffer_len = 8 ; 10.612 ms/px
|
|
||||||
;z_buffer_len = 4 ; 12.395 ms/px
|
|
||||||
z_buffer_mask = z_buffer_len - 1
|
z_buffer_mask = z_buffer_len - 1
|
||||||
z_buffer:
|
z_buffer:
|
||||||
; the last N zx/zy values
|
; the last N zx/zy values
|
||||||
|
|
@ -276,12 +273,11 @@ z_buffer:
|
||||||
|
|
||||||
.export start
|
.export start
|
||||||
|
|
||||||
;max_fill_level = 6
|
max_fill_level = 6
|
||||||
max_fill_level = 3
|
|
||||||
fill_masks:
|
fill_masks:
|
||||||
; .byte %00011111
|
.byte %00011111
|
||||||
; .byte %00001111
|
.byte %00001111
|
||||||
; .byte %00000111
|
.byte %00000111
|
||||||
.byte %00000011
|
.byte %00000011
|
||||||
.byte %00000001
|
.byte %00000001
|
||||||
.byte %00000000
|
.byte %00000000
|
||||||
|
|
@ -314,21 +310,18 @@ viewport_oy:
|
||||||
.endrepeat
|
.endrepeat
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 20 cycles
|
|
||||||
.macro add16 dest, arg1, arg2
|
.macro add16 dest, arg1, arg2
|
||||||
add 2, dest, arg1, arg2
|
add 2, dest, arg1, arg2
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 38 cycles
|
|
||||||
.macro add32 dest, arg1, arg2
|
.macro add32 dest, arg1, arg2
|
||||||
add 4, dest, arg2, dest
|
add 4, dest, arg2, dest
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 8 cycles
|
|
||||||
.macro add_carry dest
|
.macro add_carry dest
|
||||||
lda dest ; 3 cyc
|
lda dest
|
||||||
adc #0 ; 2 cyc
|
adc #0
|
||||||
sta dest ; 3 cyc
|
sta dest
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 2 + 9 * byte cycles
|
; 2 + 9 * byte cycles
|
||||||
|
|
@ -341,35 +334,29 @@ viewport_oy:
|
||||||
.endrepeat
|
.endrepeat
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 20 cycles
|
|
||||||
.macro sub16 dest, arg1, arg2
|
.macro sub16 dest, arg1, arg2
|
||||||
sub 2, dest, arg1, arg2
|
sub 2, dest, arg1, arg2
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 38 cycles
|
|
||||||
.macro sub32 dest, arg1, arg2
|
.macro sub32 dest, arg1, arg2
|
||||||
sub 4, dest, arg1, arg2
|
sub 4, dest, arg1, arg2
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 3 + 5 * bytes cycles
|
|
||||||
.macro shl bytes, arg
|
.macro shl bytes, arg
|
||||||
asl arg ; 3 cyc
|
asl arg
|
||||||
.repeat bytes-1, i
|
.repeat bytes-1, i
|
||||||
rol arg + 1 + i ; 5 cyc
|
rol arg + 1 + i
|
||||||
.endrepeat
|
.endrepeat
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 13 cycles
|
|
||||||
.macro shl16 arg
|
.macro shl16 arg
|
||||||
shl 2, arg
|
shl 2, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 18 cycles
|
|
||||||
.macro shl24 arg
|
.macro shl24 arg
|
||||||
shl 3, arg
|
shl 3, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 23 cycles
|
|
||||||
.macro shl32 arg
|
.macro shl32 arg
|
||||||
shl 4, arg
|
shl 4, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
@ -382,17 +369,14 @@ viewport_oy:
|
||||||
.endrepeat
|
.endrepeat
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 12 cycles
|
|
||||||
.macro copy16 dest, arg
|
.macro copy16 dest, arg
|
||||||
copy 2, dest, arg
|
copy 2, dest, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 24 cycles
|
|
||||||
.macro copy32 dest, arg
|
.macro copy32 dest, arg
|
||||||
copy 4, dest, arg
|
copy 4, dest, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 36 cycles
|
|
||||||
.macro copyfloat dest, arg
|
.macro copyfloat dest, arg
|
||||||
copy 6, dest, arg
|
copy 6, dest, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
@ -417,20 +401,18 @@ viewport_oy:
|
||||||
neg 4, arg
|
neg 4, arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; 11-27 + 23 * shift cycles
|
|
||||||
; 103-119 cycles for shift=4
|
|
||||||
.macro shift_round_16 arg, shift
|
.macro shift_round_16 arg, shift
|
||||||
.repeat shift
|
.repeat shift
|
||||||
shl32 arg ; 23 cycles
|
shl32 arg
|
||||||
.endrepeat
|
.endrepeat
|
||||||
round16 arg ; 11-27 cycles
|
round16 arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro imul16_round dest, arg1, arg2, shift
|
.macro imul16_round dest, arg1, arg2, shift
|
||||||
copy16 FR0, arg1 ; 12 cyc
|
copy16 FR0, arg1 ; 12 cyc
|
||||||
copy16 FR1, arg2 ; 12 cyc
|
copy16 FR1, arg2 ; 12 cyc
|
||||||
jsr imul16_func ; ? cyc
|
jsr imul16_func ; ? cyc
|
||||||
shift_round_16 FR2, shift ; 103-119 cycles for shift=4
|
shift_round_16 FR2, shift
|
||||||
copy16 dest, FR2 + 2 ; 12 cyc
|
copy16 dest, FR2 + 2 ; 12 cyc
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
@ -438,7 +420,7 @@ viewport_oy:
|
||||||
;imul16_round dest, arg, arg, shift
|
;imul16_round dest, arg, arg, shift
|
||||||
copy16 FR0, arg ; 12 cyc
|
copy16 FR0, arg ; 12 cyc
|
||||||
jsr sqr16_func ; ? cyc
|
jsr sqr16_func ; ? cyc
|
||||||
shift_round_16 FR2, shift ; 103-119 cycles for shift=4
|
shift_round_16 FR2, shift
|
||||||
copy16 dest, FR2 + 2 ; 12 cyc
|
copy16 dest, FR2 + 2 ; 12 cyc
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
@ -824,7 +806,6 @@ arg2_pos:
|
||||||
sqr16_impl 1
|
sqr16_impl 1
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
; 11-27 cycles
|
|
||||||
.macro round16 arg
|
.macro round16 arg
|
||||||
; Round top 16 bits of 32-bit fixed-point number in-place
|
; Round top 16 bits of 32-bit fixed-point number in-place
|
||||||
.local increment
|
.local increment
|
||||||
|
|
@ -837,28 +818,21 @@ arg2_pos:
|
||||||
; round down if negative
|
; round down if negative
|
||||||
; < $8000: round down
|
; < $8000: round down
|
||||||
|
|
||||||
; $8000 17
|
lda arg + 1
|
||||||
; $8001 27
|
cmp #$80
|
||||||
; $8100 21
|
beq high_half
|
||||||
; $7fff 11
|
bpl increment
|
||||||
|
bmi next
|
||||||
lda arg + 1 ; 3 cyc
|
|
||||||
cmp #$80 ; 2 cyc
|
|
||||||
beq high_half ; 2 cyc
|
|
||||||
|
|
||||||
bpl increment ; 2 cyc
|
|
||||||
|
|
||||||
bmi next ; 2 cyc
|
|
||||||
|
|
||||||
high_half:
|
high_half:
|
||||||
lda arg ; 3 cyc
|
lda arg
|
||||||
beq check_sign ; 2 cyc
|
beq check_sign
|
||||||
|
bpl increment
|
||||||
jmp increment ; 3 cyc
|
bmi next
|
||||||
|
|
||||||
check_sign:
|
check_sign:
|
||||||
lda arg + 3 ; 3 cyc
|
lda arg + 3
|
||||||
bmi next ; 2 cyc
|
bmi next
|
||||||
|
|
||||||
increment: ; 5-10 cyc
|
increment: ; 5-10 cyc
|
||||||
inc arg + 2 ; 5 cyc
|
inc arg + 2 ; 5 cyc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue