added some Mega65 optimizations in BASIC

This commit is contained in:
FeralChild64 committed 2020-07-12 12:13:04 +02:00
1 parent 7edf26fbb6
commit 1432935f03
5 files changed
+96

No files matched your search

+6
View File
@@ -7,6 +7,9 @@
//
// For these configurations we have optimized version in another file
#if !(ROM_LAYOUT_M65 && (CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K))
fetch_character:
ldy #0
@@ -46,3 +49,6 @@ consume_character:
#endif
rts
#endif
@@ -0,0 +1,42 @@
// #LAYOUT# M65 BASIC_0 #TAKE-HIGH
// #LAYOUT# * * #IGNORE
//
// Fetches a single character - optimized version
//
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
fetch_character:
ldy #0
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Retrieve value from under ROMs
lda (TXTPTR), y
// Restore memory mapping
pha
lda #$27
sta CPU_R6510
pla
// FALLTROUGH
consume_character:
// Advance basic text pointer
inw TXTPTR
rts
#endif
@@ -6,6 +6,10 @@
// Fetches a single character, but skips spaces
//
// For these configurations we have optimized version in another file
#if !(ROM_LAYOUT_M65 && (CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K))
fetch_character_skip_spaces:
jsr fetch_character
@@ -13,3 +17,6 @@ fetch_character_skip_spaces:
beq fetch_character_skip_spaces
rts
#endif
@@ -0,0 +1,41 @@
// #LAYOUT# M65 BASIC_0 #TAKE-HIGH
// #LAYOUT# * * #IGNORE
//
// Fetches a single character, but skips spaces - optimized version
//
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
fetch_character_skip_spaces:
ldy #0
// Unmap BASIC lower ROM
lda #$26
sta CPU_R6510
// Retrieve value from under ROMs, advance text pointer
!:
lda (TXTPTR), y
inw TXTPTR
// Skip space characters
cmp #$20
beq !-
// Restore memory mapping
pha
lda #$27
sta CPU_R6510
pla
rts
#endif