add more parts of circle now 7/8 of them renders (though buggy looking)

This commit is contained in:
hugova 2025-06-30 21:15:29 +02:00
parent e01684254f
commit 55ab7e367d
3 changed files with 54 additions and 41 deletions

View file

@ -20,3 +20,4 @@
btp_mem_pos_swop = $D0 ; 16bit value (uses D1) btp_mem_pos_swop = $D0 ; 16bit value (uses D1)
temp__ = $D2 temp__ = $D2
temp___ = $D3 temp___ = $D3
btp_mem_pos_swop_inv_y = $D4 ;16bit value (uses D5)

View file

@ -42,10 +42,13 @@ draw_lower_px_in_circle:
LDA btp_mem_pos LDA btp_mem_pos
STA btp_mem_pos_swop STA btp_mem_pos_swop
STA btp_mem_pos_swop_inv_y
LDA btp_mem_pos + 1 LDA btp_mem_pos + 1
STA btp_mem_pos_swop_inv_y + 1
STA btp_mem_pos_swop + 1 STA btp_mem_pos_swop + 1
;; fix offset of 8 bytes, idk why this is needed ;; fix offset of 8 bytes, idk why this is needed
Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320 Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320
Sub_16 btp_mem_pos_swop_inv_y, btp_mem_pos_swop_inv_y + 1, #$40, #$01 ;-320
LDA temp LDA temp
STA Y_pos STA Y_pos
@ -69,29 +72,11 @@ draw_right_px_in_circle:
SEC ;; See draw_pixel_inv SEC ;; circle_help expect this
while_x_bigger_then_y: while_x_bigger_then_y:
;;Draw pixels ;;Draw pixels and does the ypos incrementation logic
JSR circle_help JSR circle_help
increment_y_pos:
INC Y_rel ; y++
DEY
BPL increment_y_pos_end
move_8px_down:
LDY #$07
;; Switch to chunk bellow
; 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 ;;t1 += y
CLC CLC
@ -119,10 +104,10 @@ move_8px_left:
;; Y is inverted ;; Y is inverted
Sub_16 btp_mem_pos_inv_y, btp_mem_pos_inv_y + 1, #$08, #$00, ! Sub_16 btp_mem_pos_inv_y, btp_mem_pos_inv_y + 1, #$08, #$00, !
;; X and Y has swoped ;; X and Y has swoped
Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320 Sub_16 btp_mem_pos_swop, btp_mem_pos_swop + 1, #$40, #$01 ;-320
;; X and Y has swoped and Y has inverted
Sub_16 btp_mem_pos_swop_inv_y, btp_mem_pos_swop_inv_y +1, #$40, #$01 ;+320
;; Restores byte to paint ;; Restores byte to paint
LDA #%00000001 LDA #%00000001

View file

@ -3,7 +3,7 @@
;;We have named the parts of the circle as such. ;;We have named the parts of the circle as such.
;; | ;; * |
;; qbb | qab ;; qbb | qab
;; | ;; |
;; qba | qaa ;; qba | qaa
@ -11,7 +11,7 @@
;; qca | qda ;; qca | qda
;; | ;; |
;; 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
@ -33,7 +33,7 @@ draw_qcb:; xy swaped
loop: loop:
INY INY
goto_loop: goto_loop:
asl byte_to_paint; lsr asl ASL byte_to_paint; lsr asl
BCC loop BCC loop
STY temp___ STY temp___
@ -46,8 +46,22 @@ goto_loop:
ORA (btp_mem_pos_swop), Y ORA (btp_mem_pos_swop), Y
STA (btp_mem_pos_swop), Y; STA (btp_mem_pos_swop), Y;
;; this one is buggy
draw_qdb:; xy swaped and y is inverted.
draw_qab: ;xy swoped + mirroring LDX temp
LDA binary_factor, X; (see END.s)
TAX
LDA inverse_factor_value, X;; (see END.s)
ORA (btp_mem_pos_swop_inv_y), Y
STA (btp_mem_pos_swop_inv_y), Y;
SEC
LDA #$07
SBC temp___
TAY
draw_qab:; xy swoped + mirroring
LDA btp_mem_pos_center_two LDA btp_mem_pos_center_two
SBC btp_mem_pos_swop SBC btp_mem_pos_swop
@ -56,38 +70,33 @@ draw_qab: ;xy swoped + mirroring
SBC btp_mem_pos_swop + 1 SBC btp_mem_pos_swop + 1
STA btp_mem_pos_inv + 1 STA btp_mem_pos_inv + 1
LDY temp___
SEC
LDA #$07 LDA #$07
SBC temp___ SBC temp
TAY TAX
LDA binary_factor, X; (see END.s)
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 ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y STA (btp_mem_pos_inv), Y
LDY temp LDY temp
LDX temp_ ; LDX temp_
LDA temp__ LDA temp__
STA byte_to_paint STA byte_to_paint
draw_qda: draw_qda:; y is inverted
;; inverted Y, this is shared with qca ;; invert Y, this is shared with qca
STY temp STY temp
LDA #$07 LDA #$07
SEC ;SEC
SBC temp SBC temp
TAY TAY
LDA byte_to_paint LDA byte_to_paint
ORA (btp_mem_pos_inv_y), Y ORA (btp_mem_pos_inv_y), Y
STA (btp_mem_pos_inv_y), Y STA (btp_mem_pos_inv_y), Y
draw_qca: ;;mirror technique draw_qca: ;;mirror technique
SEC ;SEC
;;C = 1 beacause the branching to while_x_bigger_then_y and SEC on first ittteration.
LDA btp_mem_pos_center_two LDA btp_mem_pos_center_two
SBC btp_mem_pos SBC btp_mem_pos
STA btp_mem_pos_inv STA btp_mem_pos_inv
@ -110,7 +119,7 @@ draw_qca: ;;mirror technique
LDY temp LDY temp
draw_qba: ;;mirror_technique draw_qba: ;;mirror_technique
SEC ;SEC
LDA btp_mem_pos_center_two LDA btp_mem_pos_center_two
SBC btp_mem_pos_inv_y SBC btp_mem_pos_inv_y
STA btp_mem_pos_inv STA btp_mem_pos_inv
@ -125,5 +134,23 @@ draw_qba: ;;mirror_technique
ORA (btp_mem_pos_inv), Y ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y STA (btp_mem_pos_inv), Y
increment_y_pos:
INC Y_rel ; y++
DEY
BPL increment_y_pos_end
move_8px_down:
LDY #$07
;; Switch to chunk bellow
; 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
;; X and Y has swoped and Y has inverted
Add_16 btp_mem_pos_swop_inv_y, btp_mem_pos_swop_inv_y +1, #$08, #$00
increment_y_pos_end:
RTS RTS
.endproc .endproc