Rewrote 4 branch instructions to 2. 2% performance increase

This commit is contained in:
hugova 2025-03-24 18:00:17 +01:00
parent f583423bb6
commit 3ce76c02a8
2 changed files with 4 additions and 6 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
*.prg *.prg
*.o *.o
*.list *.list
*.note

View file

@ -50,8 +50,8 @@
Add_16 >D, <D, #$ff, #$01, ! Add_16 >D, <D, #$ff, #$01, !
Sub_16 >D, <D, dx, #$00 Sub_16 >D, <D, dx, #$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
LDY #$00
for_x: for_x:
;; Paints A to address i btp_mem_pos* + Y ;; Paints A to address i btp_mem_pos* + Y
;; Y is our Y-pos-chunk-offset. ;; Y is our Y-pos-chunk-offset.
@ -59,10 +59,8 @@ for_x:
ORA (>btp_mem_pos), Y ORA (>btp_mem_pos), Y
STA (>btp_mem_pos), Y STA (>btp_mem_pos), Y
increment_pixel_x: increment_pixel_x:
;CLC
LSR byte_to_paint LSR byte_to_paint
BCS move_8px_left BCC increment_pixel_x_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
@ -83,8 +81,7 @@ increment_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 ;
BEQ move_8px_down BNE for_x
jmp for_x
move_8px_down: ; Z=1 --> C=1 move_8px_down: ; Z=1 --> C=1
;; +320-8 bytes ;; +320-8 bytes
LDY #$00 LDY #$00