c64-livecoding/wip-hugo/routines/circle/circle_help.s

129 lines
3 KiB
ArmAsm

.proc circle_help ; This is because jmp cant jump that long!
.include "circle.inc"
;;We have named the parts of the circle as such.
;; |
;; qbb | qab
;; |
;; qba | qaa
;;---------------X-----------------> X
;; qca | qda
;; |
;; qcb | qdb
;; |
;; v Y
;; The q stands for quarter, whe have 4 quarter, and each quarter is split into 2
draw_qaa:
LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk.
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
LDA #$07
SEC
SBC temp
TAY
LDA byte_to_paint
ORA (btp_mem_pos_inv_y), Y
STA (btp_mem_pos_inv_y), Y
draw_qca: ;;mirror technique
SEC
;;C = 1 beacause the branching to while_x_bigger_then_y and SEC on first ittteration.
LDA btp_mem_pos_center_two
SBC btp_mem_pos
STA btp_mem_pos_inv
LDA btp_mem_pos_center_two + 1
SBC btp_mem_pos + 1
STA btp_mem_pos_inv + 1
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
;; uses a table!
STX temp_
LDX byte_to_paint
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
ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y
;;Recover the Y value (we changed it because evrything is inverted)
LDY temp
draw_qba: ;;mirror_technique
SEC
LDA btp_mem_pos_center_two
SBC btp_mem_pos_inv_y
STA btp_mem_pos_inv
LDA btp_mem_pos_center_two + 1
SBC btp_mem_pos_inv_y + 1
STA btp_mem_pos_inv + 1
TXA
LDX temp_
; A = byte_to_paint_inv
ORA (btp_mem_pos_inv), Y
STA (btp_mem_pos_inv), Y
RTS
.endproc