some more size/speed optimizations

This commit is contained in:
FeralChild64 committed 2020-07-19 12:34:41 +02:00
1 parent fc3a40a254
commit 46ee7e476e
5 files changed
+36 -47

No files matched your search

@@ -189,9 +189,8 @@ execute_line:
// Check if pointer is null, if so, we are at the end of the program
ldy #0
jsr peek_line_pointer_null_check
bcc_16 shell_main_loop // branch if end of program reached
jsr is_line_pointer_null
beq_16 shell_main_loop // branch if end of program reached
// Skip pointer and line number to get address of first statement
@@ -0,0 +1,37 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Return pointer in BASIC memory space status in Z flag
#if CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_60K
is_line_pointer_null:
// Check the pointer
ldy #$01 // for non-NULL pointer, high byte is almost certainly not NULL
#if CONFIG_MEMORY_MODEL_60K
ldx #<OLDTXT+0
jsr peek_under_roms
cmp #$00
#else // CONFIG_MEMORY_MODEL_38K
lda (OLDTXT),y
#endif
bne !+
dey
#if CONFIG_MEMORY_MODEL_60K
jsr peek_under_roms
cmp #$00
#else // CONFIG_MEMORY_MODEL_38K
lda (OLDTXT),y
#endif
!:
rts
#endif
@@ -0,0 +1,37 @@
// #LAYOUT# STD * #TAKE-HIGH
// #LAYOUT# * BASIC_0 #TAKE-HIGH
// #LAYOUT# * * #IGNORE
// This has to go $E000 or above - routine below banks out the main BASIC ROM!
// Return pointer in BASIC memory space status in Z flag
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
is_line_pointer_null:
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Check the pointer
ldy #$01 // for non-NULL pointer, high byte is almost certainly not NULL
lda (OLDTXT),y
bne !+ // branch if pointer not NULL
dey
lda (OLDTXT),y
!:
// Restore memory mapping and quit
php
lda #$27
sta CPU_R6510
plp
rts
#endif