make line_down draw from other end of line. Reduses one CMP instruction
This commit is contained in:
parent
54fa061342
commit
f64d28168b
1 changed files with 24 additions and 18 deletions
|
@ -73,27 +73,34 @@ selfmod:
|
||||||
LDA V + 1
|
LDA V + 1
|
||||||
STA case_1 + 7
|
STA case_1 + 7
|
||||||
end_selfmod:
|
end_selfmod:
|
||||||
|
LDA X_end
|
||||||
|
STA X_pos
|
||||||
|
LDA Y_end
|
||||||
|
STA Y_pos
|
||||||
|
|
||||||
JSR pixel_calc ;;only used first pixel. after this relative position is abused
|
JSR pixel_calc ;;only used first pixel. after this relative position is abused
|
||||||
STA byte_to_paint
|
STA byte_to_paint
|
||||||
;; X = X_end - X_pos
|
;; X = X_end - X_pos
|
||||||
LDX dx
|
LDX dx
|
||||||
|
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$00, #$00,! ;; Y has always a offset of at least 1 = C + $0000
|
||||||
|
INY
|
||||||
for_x:
|
for_x:
|
||||||
;; Paints A to address in |btp_mem_pos* + Y|
|
;; Paints A to address in |btp_mem_pos* + Y|
|
||||||
;; Y is pixel position in the chunk. Therefor it may be that Y = 0, 1, 2, 3, 4, ,5 ,6 ,7.
|
;; Y is pixel position in the chunk. Therefor it may be that Y = 0, 1, 2, 3, 4, ,5 ,6 ,7.
|
||||||
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
|
||||||
increment_pixel_x:
|
decrement_pixel_x:
|
||||||
LSR byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN.
|
ASL byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN.
|
||||||
BCC increment_pixel_x_end; We need to move to the next chunk
|
BCC decrement_pixel_x_end; We need to move to the next chunk
|
||||||
move_8px_left:
|
move_8px_right:
|
||||||
;; Restores byte to paint to #%10000000
|
;; Restores byte to paint to #%00000001
|
||||||
ROR byte_to_paint
|
ROL byte_to_paint
|
||||||
;; Next chunk is 8 addresses away. Look in pixel_draw for more detail.
|
;; Next chunk is 8 addresses away. Look in pixel_draw for more detail.
|
||||||
;; -8.
|
;; -8.
|
||||||
;; C = 1 therefore you se 07
|
;; C = 0
|
||||||
Add_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00, !
|
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$07, #$00, !
|
||||||
increment_pixel_x_end:
|
decrement_pixel_x_end:
|
||||||
DEX
|
DEX
|
||||||
BEQ end ;We keep track on when to stop line draw with the X registry.
|
BEQ end ;We keep track on when to stop line draw with the X registry.
|
||||||
;;If D < %00000010 00000000: case_2
|
;;If D < %00000010 00000000: case_2
|
||||||
|
@ -105,20 +112,19 @@ case_1:
|
||||||
;; C =1 so we can use !
|
;; C =1 so we can use !
|
||||||
;; A = >D
|
;; A = >D
|
||||||
Sub_16_A D, D + 1, #>V, #<V, !
|
Sub_16_A D, D + 1, #>V, #<V, !
|
||||||
increment_y_pos:
|
decrement_y_pos:
|
||||||
INY ; Increment Y pos inside the buffer
|
DEY ; Increment Y pos inside the buffer
|
||||||
CPY #$08
|
|
||||||
BNE for_x
|
BNE for_x
|
||||||
move_8px_down: ; Z=1 --> C=1
|
move_8px_up: ; Z=1 --> C=1
|
||||||
LDY #$00
|
LDY #$08
|
||||||
;; Switch to chunk bellow
|
;; Switch to chunk bellow
|
||||||
; C = 1
|
; C = 1
|
||||||
; So we subtract #$3F, #$01 +C
|
; So we subtract #$40, #$01
|
||||||
Add_16 btp_mem_pos, btp_mem_pos + 1, #$3F, #$01, !; +320
|
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01, !; +320
|
||||||
JMP for_x
|
JMP for_x
|
||||||
increment_y_pos_end:
|
decrement_y_pos_end:
|
||||||
case_2:
|
case_2:
|
||||||
Add_16 D, D + 1, #>dy_2, #<dy_2, ! ;D = D + 2*dy
|
Add_16 D, D + 1, #>dy_2, #<dy_2,! ;D = D + 2*dy
|
||||||
JMP for_x
|
JMP for_x
|
||||||
end:
|
end:
|
||||||
RTS
|
RTS
|
||||||
|
|
Loading…
Add table
Reference in a new issue