diff --git a/wip-hugo/routines/circle/circle.s b/wip-hugo/routines/circle/circle.s index 2da3b60..b8fe78a 100644 --- a/wip-hugo/routines/circle/circle.s +++ b/wip-hugo/routines/circle/circle.s @@ -18,12 +18,29 @@ LSR LSR STA t1 + + ;; We only draw the first pixel using absolute position. + ;; After that we use relative position. + JSR pixel_draw + ;; This sets byte_to_paint, btp_mem_pos and Y while_x_bigger_then_y: - JSR pixel_draw + 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 - INC Y_pos ; y++ - INC Y_rel +increment_y_pos: + INC Y_rel ; y++ + INY + CPY #$08 + + BNE increment_y_pos_end +move_8px_down: + LDY #$00 + ;; Switch to chunk bellow + ; So we subtract #$4000 + Add_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01 ;+320 +increment_y_pos_end: ;;t1 += y CLC @@ -39,8 +56,18 @@ while_x_bigger_then_y: CMP #$00 BMI endif if: - DEC X_pos ; x-- +decrement_x_pos: DEC X_rel + ASL byte_to_paint + BCC decrement_x_pos_end +move_8px_left: +;; Next chunk is 8 addresses away. Look in pixel_draw for more detail. +;; -8. +Sub_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00 +;; Restores byte to paint +LDA #%00000001 +STA byte_to_paint +decrement_x_pos_end: LDA t2 STA t1 ; t1 = t2 endif: