rewrote the circle code to use relative position for pixel draw. This made it 2 orders of magnitudes faster!
This commit is contained in:
parent
484bafa828
commit
c2a5af481f
1 changed files with 31 additions and 4 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue