small 65C02 optimizations in many places

This commit is contained in:
FeralChild64 committed 2019-10-10 19:45:40 +02:00
1 parent 3e5c80bbf1
commit ce8c84a20c
22 files changed
+103 -159

No files matched your search

+3 -4
View File
@@ -7,9 +7,8 @@ STROUT:
// Setup pointer
sty FRESPC+1
sta FRESPC+0
txa
pha
_phx
// Get offset ready
ldy #$00
@@ -29,6 +28,6 @@ STROUT:
iny
bne !-
!:
pla
pla // XXX can we use _plx here?
tax
rts
+2 -4
View File
@@ -2,8 +2,7 @@
basic_do_error:
// Save error number
txa
pha
_phx
// Print ? at start
jsr print_return
@@ -11,8 +10,7 @@ basic_do_error:
jsr JCHROUT
// Print main part of error message
pla
tax
_plx
jsr print_packed_message
// Print ERROR at end
+2 -14
View File
@@ -98,15 +98,9 @@ list_not_quote:
// Display a token
// Save registers
#if CONFIG_CPU_MOS_6502
tax
pha
tya
pha
#else
phx
phy
#endif
_phy
// Get pointer to compressed keyword list
lda #<packed_keywords
@@ -124,13 +118,7 @@ list_not_quote:
ldy #$ff
jsr packed_word_search
#if CONFIG_CPU_MOS_6502
pla
tay
#else
ply
#endif
_ply
pla
cmp #$8f
+1 -2
View File
@@ -5,8 +5,7 @@
print_integer:
pha
txa
pha
_phx
// Clear temporary output
lda #$00
+8 -16
View File
@@ -32,15 +32,13 @@ packed_message_search:
found_message_in_token_stream:
// Now print each word in the message
tya
pha
_phy
lda packed_message_tokens,y
cmp #$ff
beq !+
jsr print_packed_word
jsr print_space
pla
tay
_ply
iny
bne found_message_in_token_stream
!:
@@ -139,16 +137,14 @@ next_packed_word_char:
tax
// Save Y so it doesn't get clobbered by CHROUT
tya
pha
_phy
// X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x
jsr JCHROUT
// See if there is a char in the low nybl to print
pla
tay
_ply
lda (FRESPC),y
and #$0f
beq end_of_packed_word
@@ -158,8 +154,7 @@ next_packed_word_char:
has_lo_nybl_char:
// We need to print the low nybl char as well
tax
tya
pha
_phy
// Skip lower nybls of $F or $0 in nybl packed
// bytes, as these do not encode characters
@@ -173,8 +168,7 @@ has_nybl:
lda packed_message_chars-1,x
jsr JCHROUT
!:
pla
tay
_ply
// FALLTHROUGH
no_lo_nybl_char:
@@ -204,8 +198,7 @@ next_is_literal_char:
unpack_literal_char:
// Output the literal char, and ready for next char
iny
tya
pha
_phy
lda (FRESPC),y
jsr JCHROUT
pla
@@ -222,7 +215,6 @@ is_uncommon_char:
// We need to print the low nybl char as well
tax
tya
pha
_phy
jmp has_nybl
+1 -2
View File
@@ -232,8 +232,7 @@ wedge_dos_clean_exit:
wedge_dos_basic_error:
pha
jsr JCLALL
pla
tax
_plx
dex
jmp do_basic_error