Remove set flag instruction to optimize circledraw from 5846 to 5640 cpu cycles
This commit is contained in:
parent
b7f04d1fcb
commit
c5b0d5f64b
1 changed files with 25 additions and 22 deletions
|
@ -32,7 +32,7 @@ draw_center_px_in_circle:
|
|||
|
||||
|
||||
draw_right_px_in_circle:
|
||||
CLC
|
||||
;; C = 0, because Mult_16
|
||||
LDA X_pos
|
||||
ADC radius
|
||||
STA X_pos
|
||||
|
@ -41,6 +41,7 @@ draw_right_px_in_circle:
|
|||
JSR pixel_draw
|
||||
;; This sets byte_to_paint, btp_mem_pos and Y
|
||||
|
||||
SEC ;; See draw_pixel_inv
|
||||
while_x_bigger_then_y:
|
||||
|
||||
|
||||
|
@ -50,7 +51,7 @@ draw_pixel:
|
|||
STA (btp_mem_pos), Y
|
||||
|
||||
draw_pixel_inv:
|
||||
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
|
||||
|
@ -58,26 +59,26 @@ draw_pixel_inv:
|
|||
SBC btp_mem_pos + 1
|
||||
STA btp_mem_pos_inv + 1
|
||||
|
||||
;; calculate the inverted y value Y = 7-Y
|
||||
STY temp
|
||||
LDA #$07
|
||||
SEC
|
||||
SBC temp
|
||||
TAY
|
||||
;; calculate the inverted y value Y = 7-Y
|
||||
STY temp
|
||||
LDA #$07
|
||||
;; C = 1 because arithmatic above
|
||||
SBC temp
|
||||
TAY
|
||||
|
||||
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
|
||||
;; uses a table!
|
||||
stx temp_
|
||||
ldx byte_to_paint
|
||||
STX temp_
|
||||
LDX byte_to_paint
|
||||
LDA inverse_factor_value, X;; (see END.s)
|
||||
ldx temp_
|
||||
LDX temp_
|
||||
|
||||
; A = byte_to_paint_inv
|
||||
; 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
|
||||
;;Recover the Y value (we changed it because evrything is inverted)
|
||||
LDY temp
|
||||
|
||||
increment_y_pos:
|
||||
INC Y_rel ; y++
|
||||
|
@ -88,8 +89,9 @@ increment_y_pos:
|
|||
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
|
||||
; So we subtract #$4001
|
||||
; C = 1 because branching!
|
||||
Add_16 btp_mem_pos, btp_mem_pos + 1, #$3F, #$01, ! ;+320
|
||||
increment_y_pos_end:
|
||||
|
||||
;;t1 += y
|
||||
|
@ -111,12 +113,13 @@ decrement_x_pos:
|
|||
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
|
||||
;; Next chunk is 8 addresses away. Look in pixel_draw for more detail.
|
||||
;; -8.
|
||||
;; C = 1 because branching
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue