small size optimization of screen code
This commit is contained in:
1 parent
793c83be2b
commit
c9ba173195
3 files changed
+28
-34
No files matched your search
@@ -0,0 +1,60 @@
|
||||
|
||||
//
|
||||
// Sets PNTR in a proper range (0-39 or 40-79)
|
||||
// Sets LNMX to 39 or 79
|
||||
//
|
||||
|
||||
|
||||
screen_calculate_PNTR_LNMX:
|
||||
|
||||
ldy TBLX
|
||||
lda LDTBL, y
|
||||
php
|
||||
jsr screen_get_clipped_PNTR
|
||||
plp
|
||||
bmi screen_calculate_PNTR_0_39
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_calculate_PNTR_40_79:
|
||||
|
||||
tya
|
||||
clc
|
||||
adc #40
|
||||
tay
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_calculate_PNTR_0_39:
|
||||
|
||||
sty PNTR
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_calculate_LNMX:
|
||||
|
||||
ldy TBLX
|
||||
lda LDTBL, y
|
||||
bpl screen_calculate_lnmx_79 // this line is a continuation
|
||||
|
||||
cpy #24
|
||||
beq screen_calculate_lnmx_39 // this is the last line, which is not a continuation
|
||||
|
||||
iny
|
||||
lda LDTBL, y
|
||||
bpl screen_calculate_lnmx_79 // line is continued
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_calculate_lnmx_39:
|
||||
|
||||
lda #39
|
||||
skip_2_bytes_trash_nvz
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_calculate_lnmx_79:
|
||||
|
||||
lda #79
|
||||
sta LNMX
|
||||
rts
|
||||
Reference in new issue
Block a user