reduse instructions in circle draw

This commit is contained in:
hugova 2025-07-10 01:38:37 +02:00
parent 7cd03c02ba
commit 5e3eb78506
2 changed files with 9 additions and 10 deletions

View file

@ -35,4 +35,5 @@
Y_qda = $DE Y_qda = $DE
Y_qdb = $DF Y_qdb = $DF
Y_qbb = $CE Y_qbb = $CE
temp__ = $CD
Y_qaa = Y_copy Y_qaa = Y_copy

View file

@ -76,7 +76,7 @@ draw_upper_px_in_circle:
draw_left_px_in_circle: ;similar as above draw_left_px_in_circle: ;similar as above
SEC SEC
LDA X_pos LDA X_pos
STA temp_ STA temp__
SBC radius SBC radius
STA X_pos STA X_pos
@ -91,13 +91,11 @@ draw_left_px_in_circle: ;similar as above
LDA byte_to_paint LDA byte_to_paint
STA byte_to_paint_qca STA byte_to_paint_qca
LDA temp__
LDA temp_
STA X_pos STA X_pos
draw_lower_px_in_circle: ;similar as above draw_lower_px_in_circle: ;similar as above
CLC CLC
LDA Y_pos LDA Y_pos
STA temp_
ADC radius ADC radius
STA Y_pos STA Y_pos
@ -120,7 +118,7 @@ draw_lower_px_in_circle: ;similar as above
LDA temp_ LDA temp_
STA Y_pos STA Y_pos
draw_right_px_in_circle:; similar as above draw_right_px_in_circle:; similar as above
CLC ;; C =0 becuse pixel_draw
LDA X_pos LDA X_pos
ADC radius ADC radius
STA X_pos STA X_pos
@ -137,7 +135,7 @@ draw_right_px_in_circle:; similar as above
LDX #$08 ; X=8 always expected inside the loop LDX #$08 ; X=8 always expected inside the loop
while_x_bigger_then_y: while_x_bigger_then_y:
draw_pixels. draw_pixels:
draw_qaa: draw_qaa:
LDY Y_qaa LDY Y_qaa
LDA byte_to_paint ;A byte containing a single 1. Coresponds to 2^rest(X_pos/8) LDA byte_to_paint ;A byte containing a single 1. Coresponds to 2^rest(X_pos/8)
@ -179,18 +177,19 @@ draw_qab:
;; Y_rel and X_rel is the X and Y in the eye of the algorithm. Thsese are calculated seperatly from the pixel cordinates, ;; Y_rel and X_rel is the X and Y in the eye of the algorithm. Thsese are calculated seperatly from the pixel cordinates,
;; but are modified at the same time. This is becsuse the pixel cordinate system is complex (see pixel draw) ;; but are modified at the same time. This is becsuse the pixel cordinate system is complex (see pixel draw)
LDY #$07 ;; Y is expected to be 7 from this point on in the loop
change_Y: change_Y:
INC Y_rel ; y++ INC Y_rel ; y++
qaa_y: qaa_y:
DEC Y_qaa DEC Y_qaa
BPL qaa_y_end BPL qaa_y_end
qaa_y_underflow: qaa_y_underflow:
LDA #$07
STA Y_qaa
;; Switch to chunk bellow ;; Switch to chunk bellow
; So we subtract #$0140 ; So we subtract #$0140
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01 ;-320 Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01 ;-320
Sub_16 btp_mem_pos_qba, btp_mem_pos_qba + 1, #$40, #$01,! Sub_16 btp_mem_pos_qba, btp_mem_pos_qba + 1, #$40, #$01,!
STY Y_qaa ; Y_qaa =$07
qaa_y_end: qaa_y_end:
qda_y: qda_y:
INC Y_qda INC Y_qda
@ -263,8 +262,7 @@ qdb_y:
qdb_overflow: qdb_overflow:
Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb + 1, #$3f, #$01, ! ;+320 Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb + 1, #$3f, #$01, ! ;+320
Sub_16 btp_mem_pos_qcb, btp_mem_pos_qcb + 1, #$40, #$01, ! ;+320 Sub_16 btp_mem_pos_qcb, btp_mem_pos_qcb + 1, #$40, #$01, ! ;+320
LDA #$07 STY Y_qdb
STA Y_qdb
qdb_y_end: qdb_y_end:
qbb_y: qbb_y: