add other parts of circle. Now 6/8 of the circle renders. (A bit buggy looking)

This commit is contained in:
hugova 2025-06-29 18:50:35 +02:00
parent 7a50de832e
commit e01684254f
3 changed files with 96 additions and 15 deletions

View file

@ -6,12 +6,17 @@
t1 = $E0
t2 = $E1
X_rel = radius
Y_rel = $E3
temp = $E4
temp_ = $E7
Y_rel = $E2
temp = $E3
temp_ = $E4
X_swap = $E5
byte_to_paint_swap = $EF
; E8 - EA is used by pixel.inc
btp_mem_pos_center = $E5 ; 16bit value (uses E6)
btp_mem_pos_center = $E6 ; 16bit value (uses E7)
btp_mem_pos_center_two = btp_mem_pos_center
btp_mem_pos_inv_y =$EB ; 16bit value (uses EC)
Y_inv_x = $EC
btp_mem_pos_inv = $EE ; 16bit value (uses EF)
btp_mem_pos_inv = $ED ; 16bit value (uses EE)
btp_mem_pos_swop = $D0 ; 16bit value (uses D1)
temp__ = $D2
temp___ = $D3

View file

@ -31,7 +31,24 @@ draw_center_px_in_circle:
;; fix offset of 8 bytes, idk why this is needed
Sub_16 btp_mem_pos_center, btp_mem_pos_center + 1, #$40, #$01 ;-320
draw_lower_px_in_circle:
LDA Y_pos
STA temp
CLC
ADC radius
STA Y_pos
JSR pixel_draw
LDA btp_mem_pos
STA btp_mem_pos_swop
LDA btp_mem_pos + 1
STA btp_mem_pos_swop + 1
;; fix offset of 8 bytes, idk why this is needed
Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320
LDA temp
STA Y_pos
draw_right_px_in_circle:
;; C = 0, because Mult_16
LDA X_pos
@ -51,7 +68,8 @@ draw_right_px_in_circle:
Sub_16 btp_mem_pos_inv_y, btp_mem_pos_inv_y + 1, #$40, #$01 ;-320
SEC ;; See draw_pixel_inv
SEC ;; See draw_pixel_inv
while_x_bigger_then_y:
;;Draw pixels
JSR circle_help
@ -66,7 +84,13 @@ move_8px_down:
; So we subtract #$0140
; C = 1 because branching!
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01, ! ;-320
;; Y is inverted
Add_16 btp_mem_pos_inv_y, btp_mem_pos_inv_y + 1, #$40, #$01 ;+320
;; X and Y has swopped
Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$08, #$00
increment_y_pos_end:
;;t1 += y
@ -92,7 +116,14 @@ move_8px_left:
;; -8.
;; C = 1 because branching
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00, !
;; Y is inverted
Sub_16 btp_mem_pos_inv_y, btp_mem_pos_inv_y + 1, #$08, #$00, !
;; X and Y has swoped
Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320
;; Restores byte to paint
LDA #%00000001
STA byte_to_paint

View file

@ -1,4 +1,4 @@
.proc circle_help ;; This is because jmp cant jump that long!
.proc circle_help ; This is because jmp cant jump that long!
.include "circle.inc"
@ -21,6 +21,57 @@ draw_qaa:
ORA (btp_mem_pos), Y
STA (btp_mem_pos), Y
;; something is wrong | well isue for another time
draw_qcb:; xy swaped
STY temp
STX temp_
LDA byte_to_paint
STA temp__
LDY #$00
jmp goto_loop
loop:
INY
goto_loop:
asl byte_to_paint; lsr asl
BCC loop
STY temp___
LDX temp
LDA binary_factor, X; (see END.s)
LDY temp___
ORA (btp_mem_pos_swop), Y
STA (btp_mem_pos_swop), Y;
draw_qab: ;xy swoped + mirroring
LDA btp_mem_pos_center_two
SBC btp_mem_pos_swop
STA btp_mem_pos_inv
LDA btp_mem_pos_center_two + 1
SBC btp_mem_pos_swop + 1
STA btp_mem_pos_inv + 1
LDY temp___
SEC
LDA #$07
SBC temp___
TAY
LDX byte_to_paint
LDA inverse_factor_value, X;; (see END.s) TAX ;; A is saved to x because qba use this as well
ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y
LDY temp
LDX temp_
LDA temp__
STA byte_to_paint
draw_qda:
;; inverted Y, this is shared with qca
STY temp
@ -33,7 +84,6 @@ draw_qda:
LDA byte_to_paint
ORA (btp_mem_pos_inv_y), Y
STA (btp_mem_pos_inv_y), Y
;LDY temp
draw_qca: ;;mirror technique
SEC
@ -68,9 +118,6 @@ draw_qba: ;;mirror_technique
SBC btp_mem_pos_inv_y + 1
STA btp_mem_pos_inv + 1
;STX temp_
;LDX byte_to_paint
;LDA inverse_factor_value, X;; (see END.s)
TXA
LDX temp_
@ -78,7 +125,5 @@ draw_qba: ;;mirror_technique
ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y
RTS
.endproc