Add self modifying code to draw_line for 2% performance improvments
This commit is contained in:
parent
ff64a9a9b0
commit
89c9bc4129
3 changed files with 33 additions and 3 deletions
|
@ -51,6 +51,36 @@
|
|||
|
||||
jsr pixel_draw ;;only used first pixel. after this relative position is abused
|
||||
LDX X_pos
|
||||
|
||||
;; Self modifying code. Makes LDA instructions take 1 cycle less.
|
||||
;; Code will run without this but slower!
|
||||
;; Modifies LDA instructions for dy_2 and SBC for V
|
||||
;;Note: The offsets like +2 etc is because there are instructions betwean the label and the
|
||||
;address that needs to be modified
|
||||
|
||||
;;; dy_2
|
||||
;;; Modifies LDA >dy_2
|
||||
;LDA #$A9 ; LDA (immediate)
|
||||
;STA case_2
|
||||
;LDA >dy_2
|
||||
;STA case_2 +1
|
||||
;;; Modifies LDA <dy_2
|
||||
;LDA #$A9 ; LDA (immediate)
|
||||
;STA case_2 +6 ; ADC is +2 bytes, STA is + 2 bytes, Offset from before is +2 bytes.
|
||||
;LDA <dy_2
|
||||
;STA case_2 +7
|
||||
;;; V
|
||||
;;;Modidies SBC >V
|
||||
;LDA #$E9 ;SBC (immediate)
|
||||
;STA case_1 +2;LDA is +2
|
||||
;LDA >V
|
||||
;STA case_1 +3
|
||||
;;; Modifies SBC <V
|
||||
;LDA #$E9 ;SBC (immediate)
|
||||
;STA case_1 +8; Offset before +4 bytes, STA +2, LDA +2.
|
||||
;LDA <V
|
||||
;STA case_1 +9
|
||||
|
||||
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.
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
LDA X_pos_
|
||||
STA X_pos
|
||||
|
||||
jsr line_down
|
||||
jsr line
|
||||
INC Y_end
|
||||
LDA Y_end
|
||||
CMP #$50
|
||||
|
@ -48,4 +48,4 @@ end__:
|
|||
|
||||
jmp exit
|
||||
|
||||
.include "line_down.s"
|
||||
.include "line.s"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.include "macros/timer.s"
|
||||
|
||||
.include "STARTUP.s"
|
||||
.include "routines/line/line_test.s"
|
||||
.include "routines/line/line_test_time.s"
|
||||
|
||||
;;This is used by .s files to terminate nicely without reading includes at the end!
|
||||
exit:
|
||||
|
|
Loading…
Add table
Reference in a new issue