remove duplicate code for circle_draw
This commit is contained in:
parent
c4add9a62c
commit
7a50de832e
1 changed files with 34 additions and 37 deletions
|
@ -4,56 +4,38 @@
|
||||||
|
|
||||||
;;We have named the parts of the circle as such.
|
;;We have named the parts of the circle as such.
|
||||||
;; |
|
;; |
|
||||||
;; q22 | q12
|
;; qbb | qab
|
||||||
;; |
|
;; |
|
||||||
;; q21 | q11
|
;; qba | qaa
|
||||||
;;---------------X-----------------> X
|
;;---------------X-----------------> X
|
||||||
;; q31 | q41
|
;; qca | qda
|
||||||
;; |
|
;; |
|
||||||
;; q32 | q42
|
;; 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
|
||||||
|
|
||||||
|
|
||||||
draw_pixel:;;q11
|
draw_qaa:
|
||||||
LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk.
|
LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk.
|
||||||
ORA (btp_mem_pos), Y
|
ORA (btp_mem_pos), Y
|
||||||
STA (btp_mem_pos), Y
|
STA (btp_mem_pos), Y
|
||||||
|
|
||||||
draw_pixel_inv_y:;;q41
|
draw_qda:
|
||||||
|
;; inverted 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
|
||||||
;hihi:
|
;LDY temp
|
||||||
;jmp hihi
|
|
||||||
LDY temp
|
|
||||||
|
|
||||||
draw_pixel_inv_y_mirror:
|
draw_qca: ;;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
|
|
||||||
|
|
||||||
STX temp_
|
|
||||||
LDX byte_to_paint
|
|
||||||
LDA inverse_factor_value, X;; (see END.s)
|
|
||||||
LDX temp_
|
|
||||||
|
|
||||||
; A = byte_to_paint_inv
|
|
||||||
ORA (btp_mem_pos_inv), Y
|
|
||||||
STA (btp_mem_pos_inv), Y
|
|
||||||
|
|
||||||
|
|
||||||
draw_pixel_mirror:;;q31
|
|
||||||
SEC
|
SEC
|
||||||
;;C = 1 beacause the branching to while_x_bigger_then_y and SEC on first ittteration.
|
;;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
|
||||||
|
@ -63,19 +45,12 @@ draw_pixel_mirror:;;q31
|
||||||
SBC btp_mem_pos + 1
|
SBC btp_mem_pos + 1
|
||||||
STA btp_mem_pos_inv + 1
|
STA btp_mem_pos_inv + 1
|
||||||
|
|
||||||
;; 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
|
;; calculate byte_to_paint_inv 00000001 --> 10000000, 00000010 --> 01000000 ... etc
|
||||||
;; uses a table!
|
;; uses a table!
|
||||||
STX temp_
|
STX temp_
|
||||||
LDX byte_to_paint
|
LDX byte_to_paint
|
||||||
LDA inverse_factor_value, X;; (see END.s)
|
LDA inverse_factor_value, X;; (see END.s)
|
||||||
LDX temp_
|
TAX ;; A is saved to x because qba use this as well
|
||||||
|
|
||||||
; A = byte_to_paint_inv
|
; A = byte_to_paint_inv
|
||||||
ORA (btp_mem_pos_inv), Y
|
ORA (btp_mem_pos_inv), Y
|
||||||
|
@ -83,5 +58,27 @@ draw_pixel_mirror:;;q31
|
||||||
|
|
||||||
;;Recover the Y value (we changed it because evrything is inverted)
|
;;Recover the Y value (we changed it because evrything is inverted)
|
||||||
LDY temp
|
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
|
||||||
|
|
||||||
|
;STX temp_
|
||||||
|
;LDX byte_to_paint
|
||||||
|
;LDA inverse_factor_value, X;; (see END.s)
|
||||||
|
TXA
|
||||||
|
LDX temp_
|
||||||
|
|
||||||
|
; A = byte_to_paint_inv
|
||||||
|
ORA (btp_mem_pos_inv), Y
|
||||||
|
STA (btp_mem_pos_inv), Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue