optimise circle draw by redusing instructions

This commit is contained in:
hugova 2025-06-30 23:41:55 +02:00
parent ba2db967c4
commit 6c962befa2

View file

@ -5,7 +5,7 @@
;;We have named the parts of the circle as such.
;; * |
;; |
;; qbb | qab
;; |
;; qba | qaa
@ -13,7 +13,7 @@
;; qca | qda
;; |
;; qcb | qdb
;; | *
;; |
;; v Y
;; 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
STA (btp_mem_pos), Y
draw_qcb:; xy swaped
draw_qcb:; xy swoped
STY temp
LDA byte_to_paint
STA temp__
;;modify Y_pos
LDY #$00
jmp goto_loop
JMP goto_loop
loop:
INY
goto_loop:
ASL byte_to_paint; lsr asl
ASL byte_to_paint
BCC loop
STY temp___
revert_byte_to_paint:
LDA temp__
STA byte_to_paint
@ -76,39 +75,35 @@ revert_byte_to_paint:
LDA binary_factor, X; (see END.s)
LDY temp___
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.
;;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
SBC temp
TAX
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
STA (btp_mem_pos_qab), Y
LDY temp
draw_qda:; y is inverted
;; invert Y, this is shared with qca
LDA #$07
SBC temp
@ -122,7 +117,6 @@ draw_qca: ;;mirror technique
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
;; uses a table!
STX temp_
LDX byte_to_paint
LDA inverse_factor_value, X;; (see END.s)
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
STA (btp_mem_pos_qba), Y
increment_y_pos:
INC Y_rel ; y++
DEY