optimize circle draw (more code cleanup)

This commit is contained in:
hugova 2025-07-02 00:45:41 +02:00
parent 5bb62aed88
commit 913a6ba072

View file

@ -15,6 +15,7 @@
;; 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
;; We first calculate all btp_mem_pos for the inverted half quarters! ;; We first calculate all btp_mem_pos for the inverted half quarters!
@ -55,16 +56,20 @@ calculate:
end_calculation: end_calculation:
;; Lets draw all half-quatrons of the circle. This draws only 8 pixels per iteration. ;; Lets draw all half-quatrons of the circle. This draws only 8 pixels per iteration.
;; Note that I have the draw_qxx in listed pairs. Each pair chair the same Y-register :)
draw_qaa: draw_qaa:
LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk. LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk.
ORA (btp_mem_pos), Y ORA (btp_mem_pos), Y
STA (btp_mem_pos), Y STA (btp_mem_pos), Y
draw_qba: ;;mirror_technique
LDX byte_to_paint
LDA inverse_factor_value, X;; (see END.s)
ORA (btp_mem_pos_qba), Y
STA (btp_mem_pos_qba), Y
draw_qcb:; xy swoped draw_qcb:; xy swoped
STY temp STY temp
LDX byte_to_paint
LDA inverse_factor_value, X;; (see END.s) LDA inverse_factor_value, X;; (see END.s)
TAX TAX
LDA log, X LDA log, X
@ -73,36 +78,36 @@ draw_qcb:; xy swoped
;;modify X_pos ;;modify X_pos
LDX temp LDX temp
LDA binary_factor, X; (see END.s) LDA binary_factor, X; (see END.s)
TAX
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
LDA #$07 LDA inverse_factor_value, X
SBC temp STA temp__
TAX
LDA binary_factor, X; (see END.s)
TAX
;;Uses modifyed Y from above ;;Uses modifyed Y from above
ORA (btp_mem_pos_qdb), Y ORA (btp_mem_pos_qdb), Y
STA (btp_mem_pos_qdb), Y STA (btp_mem_pos_qdb), Y
draw_qbb:;; the one not working draw_qbb:
STY temp_ STY temp_
LDA #$07 LDA #$07
SBC temp_ SBC temp_
TAY TAY
LDA inverse_factor_value, X;; (see END.s) LDX temp
LDA binary_factor, X; (see END.s)
TAX
ORA (btp_mem_pos_qbb), Y ORA (btp_mem_pos_qbb), Y
STA (btp_mem_pos_qbb), Y STA (btp_mem_pos_qbb), Y
draw_qab:; xy swoped + mirroring draw_qab:; xy swoped + mirroring ;!!!!!!!!!!!!!!!!!!!!!!!!!!1111111!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TXA LDA temp__
ORA (btp_mem_pos_qab), Y ORA (btp_mem_pos_qab), Y
STA (btp_mem_pos_qab), Y STA (btp_mem_pos_qab), Y
@ -123,8 +128,6 @@ draw_qca: ;;mirror technique
;; uses a table! ;; uses a table!
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
; A = byte_to_paint_inv ; A = byte_to_paint_inv
ORA (btp_mem_pos_qca), Y ORA (btp_mem_pos_qca), Y
STA (btp_mem_pos_qca), Y STA (btp_mem_pos_qca), Y
@ -132,12 +135,6 @@ draw_qca: ;;mirror technique
;;Recover the Y value (we changed it because evrything is inverted) ;;Recover the Y value (we changed it because evrything is inverted)
LDY temp LDY temp
draw_qba: ;;mirror_technique
TXA
ORA (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