optimise circle using lookup table
This commit is contained in:
parent
7d55bc9ed8
commit
5bb62aed88
6 changed files with 47 additions and 43 deletions
|
@ -1,19 +1,33 @@
|
|||
inverse_factor_value: ;lookup 00000001 --gives--> 10000000 , etc etc. only 1st 1 in binary numbers
|
||||
NOP
|
||||
.byte %10000000, %01000000
|
||||
.byte %10000000, %01000000; (inverse factor value)
|
||||
NOP
|
||||
.byte %00100000
|
||||
.byte %00100000; (inverse factor value)
|
||||
NOP
|
||||
NOP;.byte $0; (log)
|
||||
NOP;.byte $1; (log)
|
||||
.byte %00010000; (inverse factor value)
|
||||
log:
|
||||
NOP
|
||||
.byte $0; (log)
|
||||
.byte $1; (log)
|
||||
NOP
|
||||
.byte $2
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00010000
|
||||
NOP
|
||||
.byte %00001000; (inverse factor value)
|
||||
.byte $3
|
||||
NOP
|
||||
NOP
|
||||
;; i put another lookup table where nops normaly are'
|
||||
binary_factor:
|
||||
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
|
||||
;; ^ this one it is (in inverse_faktor value)
|
||||
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001; (binary factor)
|
||||
;; ^(log)
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00000100; (inverse factor value)
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
|
@ -22,11 +36,7 @@ NOP
|
|||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00000100
|
||||
.byte $5
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
|
@ -49,6 +59,8 @@ NOP
|
|||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00000010; (inverse factor value)
|
||||
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
|
@ -57,8 +69,7 @@ NOP
|
|||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00000010
|
||||
.byte $6
|
||||
;; i put another lookup table where nops normaly are
|
||||
Bitmap = $4000
|
||||
;;This is used by pixel_draw! look at it for more detail
|
||||
|
@ -117,13 +128,13 @@ NOP
|
|||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte %00000001
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
.byte $7
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
Y_rel = $E2
|
||||
temp = $E3
|
||||
temp_ = $E4
|
||||
X_swap = $E5
|
||||
byte_to_paint_swap = $EF
|
||||
temo__ = $E5
|
||||
byte_to_paint_qaa = byte_to_paint
|
||||
byte_to_paint_qcb = $EB ;16bit value (uses EC)
|
||||
|
||||
; E8 - EA is used by pixel.inc
|
||||
btp_mem_pos_center = $E6 ; 16bit value (uses E7)
|
||||
btp_mem_pos_center_two = btp_mem_pos_center
|
||||
|
|
|
@ -104,8 +104,7 @@ move_8px_left:
|
|||
Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb +1, #$40, #$01, ! ;+320
|
||||
|
||||
;; Restores byte to paint
|
||||
LDX #%00000001
|
||||
STX byte_to_paint
|
||||
INC byte_to_paint
|
||||
|
||||
LDA t2
|
||||
decrement_x_pos_end:
|
||||
|
|
|
@ -63,20 +63,12 @@ draw_qaa:
|
|||
|
||||
draw_qcb:; xy swoped
|
||||
STY temp
|
||||
LDA byte_to_paint
|
||||
STA temp__
|
||||
|
||||
;;modify Y_pos
|
||||
LDY #$00
|
||||
JMP goto_loop
|
||||
loop:
|
||||
INY
|
||||
goto_loop:
|
||||
ASL byte_to_paint
|
||||
BCC loop
|
||||
revert_byte_to_paint:
|
||||
LDA temp__
|
||||
STA byte_to_paint
|
||||
LDX byte_to_paint
|
||||
LDA inverse_factor_value, X;; (see END.s)
|
||||
TAX
|
||||
LDA log, X
|
||||
TAY
|
||||
|
||||
;;modify X_pos
|
||||
LDX temp
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
LDA #$50
|
||||
STA X_pos
|
||||
STA Y_pos
|
||||
LDA #$55
|
||||
LDA #$40
|
||||
STA radius
|
||||
JSR circle
|
||||
.endscope
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
;.include "routines/arithmatic/mult_test.s"
|
||||
;.include "routines/arithmatic/div_test.s"
|
||||
;.include "routines/circle/circle_test.s"
|
||||
.include "routines/circle/circle_test.s"
|
||||
;.include "routines/circle/circle_test_size.s"
|
||||
.include "routines/circle/circle_test_position.s"
|
||||
;.include "routines/circle/circle_test_position.s"
|
||||
;.include "routines/line/line_test.s"
|
||||
;.include "routines/text/char_draw_test.s"
|
||||
;.include "routines/pixel/pixel_test.s"
|
||||
|
|
Loading…
Add table
Reference in a new issue