Rewrite start condition of line_down so that it start on exaktly the right pixel

This commit is contained in:
hugova 2025-03-25 19:20:23 +01:00
parent f185c80a16
commit 4497026d95
3 changed files with 18 additions and 15 deletions

View file

@ -51,7 +51,7 @@
Sub_16 >D, <D, dx, #$00 Sub_16 >D, <D, dx, #$00
jsr pixel_draw ;;only used first pixel. after this relative position is abused jsr pixel_draw ;;only used first pixel. after this relative position is abused
LDY #$00 ;LDY #$00
LDX X_pos LDX X_pos
for_x: for_x:
;; Paints A to address i btp_mem_pos* + Y ;; Paints A to address i btp_mem_pos* + Y
@ -82,10 +82,9 @@ increment_y_pos:
CPY #$08 ; CPY #$08 ;
BNE for_x BNE for_x
move_8px_down: ; Z=1 --> C=1 move_8px_down: ; Z=1 --> C=1
;; +320-8 bytes
LDY #$00 LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos, #$40, #$01 Add_16 >btp_mem_pos, <btp_mem_pos, #$40, #$01; +320
jmp for_x JMP for_x
increment_y_pos_end: increment_y_pos_end:
case_2: ;; C =0 because LAG_16 so we can use ! case_2: ;; C =0 because LAG_16 so we can use !
Add_16 >D, <D, >dy_2, <dy_2, ! ;D = D + 2*dy Add_16 >D, <D, >dy_2, <dy_2, ! ;D = D + 2*dy

View file

@ -6,9 +6,9 @@
X_pos_ = $0E X_pos_ = $0E
Y_end_ = $10 Y_end_ = $10
X_end_ = $11 X_end_ = $11
LDA #$d0 LDA #$d2
STA X_pos_ STA X_pos_
LDA #$60 LDA #$62
STA Y_pos_ STA Y_pos_
LDA #$ff LDA #$ff
STA X_end STA X_end

View file

@ -47,14 +47,18 @@ end__:
LDA #%00000111 ; A = y (mod 8) LDA #%00000111 ; A = y (mod 8)
AND Y_pos ;; offset to add AND Y_pos ;; offset to add
;;ading offset, same as psudocode bellow ;;ading offset, same as psudocode bellow
;;Add_16 >btp_mem_pos, <btp_mem_pos, A, #$00 ;;Add_16 >btp_mem_pos, <btp_mem_pos, A, #$00
CLC ; Y = b_low ;CLC ; Y = b_low
ADC >btp_mem_pos ;ADC >btp_mem_pos
STA >btp_mem_pos ;STA >btp_mem_pos
LDA #$00 ;LDA #$00
ADC <btp_mem_pos ; C =0 ;ADC <btp_mem_pos ; C =0
STA <btp_mem_pos ;STA <btp_mem_pos
TAY
CLC
LDA #$00 LDA #$00
STA $4B STA $4B
@ -87,9 +91,9 @@ end__:
Add_16 >btp_mem_pos, <btp_mem_pos, #<Bitmap, #>Bitmap, ! Add_16 >btp_mem_pos, <btp_mem_pos, #<Bitmap, #>Bitmap, !
;;Let draw some stuff ;;Let draw some stuff
LDX #$00 ;LDY #$00
LDA byte_to_paint ;; note that both bytes are used! LDA byte_to_paint ;; note that both bytes are used!
ORA (>btp_mem_pos, X) ORA (>btp_mem_pos), Y
STA (>btp_mem_pos, X) STA (>btp_mem_pos), Y
RTS RTS
.endproc .endproc