Add more more minute optimisations of circle draw

This commit is contained in:
hugova 2025-07-02 02:15:06 +02:00
parent 0ed8359f66
commit 0ceb455031
3 changed files with 29 additions and 29 deletions

View file

@ -7,7 +7,7 @@
t2 = $E1 t2 = $E1
X_rel = radius X_rel = radius
Y_rel = $E2 Y_rel = $E2
temp = $E3 Y_copy = $E3
temp_ = $E4 temp_ = $E4
temo__ = $E5 temo__ = $E5
byte_to_paint_qaa = byte_to_paint byte_to_paint_qaa = byte_to_paint

View file

@ -33,7 +33,7 @@ draw_center_px_in_circle:
draw_lower_px_in_circle: draw_lower_px_in_circle:
CLC CLC
LDA Y_pos LDA Y_pos
STA temp STA temp_
ADC radius ADC radius
STA Y_pos STA Y_pos
@ -48,7 +48,7 @@ draw_lower_px_in_circle:
Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb +1, #$08, #$00 Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb +1, #$08, #$00
LDA temp LDA temp_
STA Y_pos STA Y_pos
draw_right_px_in_circle: draw_right_px_in_circle:
CLC CLC

View file

@ -6,13 +6,13 @@
;;We have named the parts of the circle as such. ;;We have named the parts of the circle as such.
;; | ;; |
;; qbb | qab ;; qbb (7) | qab (8)
;; | ;; |
;; qba (2) | qaa (1) ;; qba (2) | qaa (1)
;;---------------X-----------------> X ;;---------------X-----------------> X
;; qca | qda ;; qca (4) | qda (3)
;; | ;; |
;; qcb | qdb ;; qcb (5) | qdb (6)
;; | ;; |
;; v Y ;; v Y
@ -57,7 +57,7 @@ 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 :) ;; Note that I have the draw_qxx in listed pairs. Each pair chair the same Y-register :)
STY temp STY Y_copy
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
@ -65,19 +65,35 @@ draw_qaa:
draw_qba: ;;mirror_technique draw_qba: ;;mirror_technique
LDX byte_to_paint LDX byte_to_paint
LDA inverse_factor_value, X;; (see END.s) LDA inverse_factor_value, X;; (see END.s)
STA temp___ TAX
ORA (btp_mem_pos_qba), Y ORA (btp_mem_pos_qba), Y
STA (btp_mem_pos_qba), Y STA (btp_mem_pos_qba), Y
draw_qda:; y is inverted
;; invert Y, this is shared with qca
LDA #$07
SBC Y_copy
TAY
LDA byte_to_paint
ORA (btp_mem_pos_qda), Y
STA (btp_mem_pos_qda), Y
draw_qca: ;;mirror technique
TXA
ORA (btp_mem_pos_qca), Y
STA (btp_mem_pos_qca), Y
draw_qcb:; xy swoped draw_qcb:; xy swoped
LDX temp___
LDA log, X LDA log, X
TAY TAY
;;modify X_pos ;;modify X_pos
LDX temp LDX Y_copy
LDA binary_factor, X; (see END.s) LDA binary_factor, X; (see END.s)
TAX
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
@ -106,25 +122,9 @@ draw_qab:; xy swoped + mirroring
ORA (btp_mem_pos_qab), Y ORA (btp_mem_pos_qab), Y
STA (btp_mem_pos_qab), Y STA (btp_mem_pos_qab), Y
draw_qda:; y is inverted
;; invert Y, this is shared with qca
LDA #$07
SBC temp
TAY
LDA byte_to_paint
ORA (btp_mem_pos_qda), Y
STA (btp_mem_pos_qda), Y
draw_qca: ;;mirror technique
LDA temp___
ORA (btp_mem_pos_qca), Y
STA (btp_mem_pos_qca), Y
;;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 Y_copy
increment_y_pos: increment_y_pos:
INC Y_rel ; y++ INC Y_rel ; y++