optimise circle draw by redusing instructions
This commit is contained in:
parent
ba2db967c4
commit
6c962befa2
1 changed files with 24 additions and 27 deletions
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
|
|
||||||
;;We have named the parts of the circle as such.
|
;;We have named the parts of the circle as such.
|
||||||
;; * |
|
;; |
|
||||||
;; qbb | qab
|
;; qbb | qab
|
||||||
;; |
|
;; |
|
||||||
;; qba | qaa
|
;; qba | qaa
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
;; qca | qda
|
;; qca | qda
|
||||||
;; |
|
;; |
|
||||||
;; qcb | qdb
|
;; qcb | qdb
|
||||||
;; | *
|
;; |
|
||||||
;; v Y
|
;; v Y
|
||||||
;; The q stands for quarter, whe have 4 quarter, and each quarter is split into 2
|
;; The q stands for quarter, whe have 4 quarter, and each quarter is split into 2
|
||||||
|
|
||||||
|
@ -53,20 +53,19 @@ draw_qaa:
|
||||||
ORA (btp_mem_pos), Y
|
ORA (btp_mem_pos), Y
|
||||||
STA (btp_mem_pos), Y
|
STA (btp_mem_pos), Y
|
||||||
|
|
||||||
draw_qcb:; xy swaped
|
draw_qcb:; xy swoped
|
||||||
STY temp
|
STY temp
|
||||||
LDA byte_to_paint
|
LDA byte_to_paint
|
||||||
STA temp__
|
STA temp__
|
||||||
|
|
||||||
;;modify Y_pos
|
;;modify Y_pos
|
||||||
LDY #$00
|
LDY #$00
|
||||||
jmp goto_loop
|
JMP goto_loop
|
||||||
loop:
|
loop:
|
||||||
INY
|
INY
|
||||||
goto_loop:
|
goto_loop:
|
||||||
ASL byte_to_paint; lsr asl
|
ASL byte_to_paint
|
||||||
BCC loop
|
BCC loop
|
||||||
STY temp___
|
|
||||||
revert_byte_to_paint:
|
revert_byte_to_paint:
|
||||||
LDA temp__
|
LDA temp__
|
||||||
STA byte_to_paint
|
STA byte_to_paint
|
||||||
|
@ -76,39 +75,35 @@ revert_byte_to_paint:
|
||||||
LDA binary_factor, X; (see END.s)
|
LDA binary_factor, X; (see END.s)
|
||||||
|
|
||||||
|
|
||||||
LDY temp___
|
|
||||||
ORA (btp_mem_pos_qcb), Y
|
ORA (btp_mem_pos_qcb), Y
|
||||||
STA (btp_mem_pos_qcb), Y;
|
STA (btp_mem_pos_qcb), Y
|
||||||
|
|
||||||
draw_qdb:; xy swaped and y is inverted.
|
draw_qdb:; xy swaped and y is inverted.
|
||||||
;;modify X
|
;;modify X
|
||||||
LDX temp
|
|
||||||
LDA binary_factor, X; (see END.s)
|
|
||||||
TAX
|
|
||||||
LDA inverse_factor_value, X;; (see END.s)
|
|
||||||
|
|
||||||
;;Uses modifyed Y from above
|
|
||||||
|
|
||||||
ORA (btp_mem_pos_qdb), Y
|
|
||||||
STA (btp_mem_pos_qdb), Y;
|
|
||||||
|
|
||||||
draw_qab:; xy swoped + mirroring
|
|
||||||
;SEC
|
|
||||||
LDA #$07
|
|
||||||
SBC temp___
|
|
||||||
TAY
|
|
||||||
|
|
||||||
LDA #$07
|
LDA #$07
|
||||||
SBC temp
|
SBC temp
|
||||||
TAX
|
TAX
|
||||||
LDA binary_factor, X; (see END.s)
|
LDA binary_factor, X; (see END.s)
|
||||||
|
TAX
|
||||||
|
|
||||||
|
;;Uses modifyed Y from above
|
||||||
|
|
||||||
|
ORA (btp_mem_pos_qdb), Y
|
||||||
|
STA (btp_mem_pos_qdb), Y
|
||||||
|
|
||||||
|
draw_qab:; xy swoped + mirroring
|
||||||
|
|
||||||
|
STY temp___
|
||||||
|
LDA #$07
|
||||||
|
SBC temp___
|
||||||
|
TAY
|
||||||
|
|
||||||
|
TXA
|
||||||
ORA (btp_mem_pos_qab), Y
|
ORA (btp_mem_pos_qab), Y
|
||||||
STA (btp_mem_pos_qab), Y
|
STA (btp_mem_pos_qab), Y
|
||||||
|
|
||||||
|
|
||||||
LDY temp
|
|
||||||
draw_qda:; y is inverted
|
draw_qda:; y is inverted
|
||||||
|
|
||||||
;; invert Y, this is shared with qca
|
;; invert Y, this is shared with qca
|
||||||
LDA #$07
|
LDA #$07
|
||||||
SBC temp
|
SBC temp
|
||||||
|
@ -122,7 +117,6 @@ draw_qca: ;;mirror technique
|
||||||
|
|
||||||
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
|
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
|
||||||
;; uses a table!
|
;; uses a table!
|
||||||
STX temp_
|
|
||||||
LDX byte_to_paint
|
LDX byte_to_paint
|
||||||
LDA inverse_factor_value, X;; (see END.s)
|
LDA inverse_factor_value, X;; (see END.s)
|
||||||
TAX ;; A is saved to x because qba use this as well
|
TAX ;; A is saved to x because qba use this as well
|
||||||
|
@ -140,6 +134,9 @@ draw_qba: ;;mirror_technique
|
||||||
ORA (btp_mem_pos_qba), Y
|
ORA (btp_mem_pos_qba), Y
|
||||||
STA (btp_mem_pos_qba), Y
|
STA (btp_mem_pos_qba), Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
increment_y_pos:
|
increment_y_pos:
|
||||||
INC Y_rel ; y++
|
INC Y_rel ; y++
|
||||||
DEY
|
DEY
|
||||||
|
|
Loading…
Add table
Reference in a new issue