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
|
||||
STA case_1 + 7
|
||||
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
|
||||
STA byte_to_paint
|
||||
;; X = X_end - X_pos
|
||||
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:
|
||||
;; 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.
|
||||
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
|
||||
increment_pixel_x:
|
||||
LSR 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
|
||||
move_8px_left:
|
||||
;; Restores byte to paint to #%10000000
|
||||
ROR byte_to_paint
|
||||
decrement_pixel_x:
|
||||
ASL byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN.
|
||||
BCC decrement_pixel_x_end; We need to move to the next chunk
|
||||
move_8px_right:
|
||||
;; Restores byte to paint to #%00000001
|
||||
ROL byte_to_paint
|
||||
;; Next chunk is 8 addresses away. Look in pixel_draw for more detail.
|
||||
;; -8.
|
||||
;; C = 1 therefore you se 07
|
||||
Add_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00, !
|
||||
increment_pixel_x_end:
|
||||
;; C = 0
|
||||
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$07, #$00, !
|
||||
decrement_pixel_x_end:
|
||||
DEX
|
||||
BEQ end ;We keep track on when to stop line draw with the X registry.
|
||||
;;If D < %00000010 00000000: case_2
|
||||
|
@ -105,20 +112,19 @@ case_1:
|
|||
;; C =1 so we can use !
|
||||
;; A = >D
|
||||
Sub_16_A D, D + 1, #>V, #<V, !
|
||||
increment_y_pos:
|
||||
INY ; Increment Y pos inside the buffer
|
||||
CPY #$08
|
||||
decrement_y_pos:
|
||||
DEY ; Increment Y pos inside the buffer
|
||||
BNE for_x
|
||||
move_8px_down: ; Z=1 --> C=1
|
||||
LDY #$00
|
||||
move_8px_up: ; Z=1 --> C=1
|
||||
LDY #$08
|
||||
;; Switch to chunk bellow
|
||||
; C = 1
|
||||
; So we subtract #$3F, #$01 +C
|
||||
Add_16 btp_mem_pos, btp_mem_pos + 1, #$3F, #$01, !; +320
|
||||
; So we subtract #$40, #$01
|
||||
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01, !; +320
|
||||
JMP for_x
|
||||
increment_y_pos_end:
|
||||
decrement_y_pos_end:
|
||||
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
|
||||
end:
|
||||
RTS
|
||||
|
|
Loading…
Add table
Reference in a new issue