Redused number of instructions but to small a diffrence to messure with current test

This commit is contained in:
hugova 2025-03-06 00:59:29 +01:00
parent 9694d8d55b
commit ecc138f2bc
2 changed files with 13 additions and 18 deletions

View file

@ -48,18 +48,13 @@
Add_16 >D, <D, #$ff, #$01, ! Add_16 >D, <D, #$ff, #$01, !
Sub_16 >D, <D, dx, #$00 Sub_16 >D, <D, dx, #$00
start_paint:
LDY #$00 LDY #$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
;byte_to_paint = $FE ;Byte with one 1 that corasponds to a pixel.
;btp_mem_pos =$494A; byte to paint memory position ;Position of byte on screen
jmp increment_x_pos_end
for_x: for_x:
;; Lets increment btp_mem_pos with +8 ;; Lets increment btp_mem_pos with +8
;; Read more in pixel_draw to understand this! ;; Read more in pixel_draw to understand this!
increment_x_pos: increment_pixel_x:
INC X_pos;; legacy
CLC CLC
LDA byte_to_paint LDA byte_to_paint
ROR byte_to_paint ROR byte_to_paint
@ -67,14 +62,15 @@ increment_x_pos:
ORA (>btp_mem_pos, X) ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X) STA (>btp_mem_pos, X)
BCS move_8px_left BCS move_8px_left
jmp increment_x_pos_end jmp increment_pixel_x_end
move_8px_left: move_8px_left:
;; add +8 to btp_mem_pos. Find more of why in pixel_draw ;; add +8 to btp_mem_pos. Find more of why in pixel_draw
Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00 Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00
;; reset byte_to_paint ;; reset byte_to_paint
LDA #%10000000 LDA #%10000000
STA byte_to_paint STA byte_to_paint
increment_x_pos_end: increment_pixel_x_end:
INC X_pos;; legacy
LDX X_pos LDX X_pos
CPX X_end CPX X_end
BEQ end BEQ end
@ -82,9 +78,8 @@ increment_x_pos_end:
;;else case 1. ;;else case 1.
Lag_16 >D, <D, #$00, #$02, case_2 Lag_16 >D, <D, #$00, #$02, case_2
case_1:; C =1 so we can use ! case_1:; C =1 so we can use !
Sub_16 >D, <D, >V, <V ; D = D - V Sub_16 >D, <D, >V, <V, ! ; D = D - V
increment_y_pos: increment_y_pos:
INC Y_pos
Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00 Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00
INY INY
CPY #$08 ; CPY #$08 ;
@ -96,7 +91,7 @@ move_8px_down:
Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01 Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01
jmp for_x jmp for_x
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
JMP for_x JMP for_x
end: end:
RTS RTS

View file

@ -15,7 +15,7 @@
;;Store pixel in byte_to_paint ;;Store pixel in byte_to_paint
LDA #%10000000 LDA #%10000000
INX INX
@shift_btp: @shift_btp: ;; check out SMB instruction here! //Hugo
DEX DEX
BEQ end__;X=0 end this BEQ end__;X=0 end this
CLC CLC