added code to display dictionary compressed strings

This commit is contained in:
FeralChild64 committed 2020-06-23 19:38:56 +02:00
1 parent d3fdc6cc59
commit 3b4d1345db
13 files changed
+202 -78

No files matched your search

@@ -0,0 +1,67 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_COMPRESSION_LVL_2
print_packed_error: // .X - error string index
lda #<packed_dict_errors
ldy #>packed_dict_errors
bne print_dict_packed_string // branch always
print_packed_misc_str: // .X - misc string index
lda #<packed_dict_misc
ldy #>packed_dict_misc
// FALLTROUGH
print_dict_packed_string:
// Search for the packed string on the list
jsr print_packed_search
ldy #$00
!:
// At this point FRESPC contains a pointer to the string to display
// Fetch a byte-code
lda (FRESPC), y
beq print_dict_packed_string_end // branch if everything displayed
tax
dex
// Call 'print_freq_packed_string' - but preserve all the data needed to progress further
phy_trash_a
lda FRESPC+0
pha
lda FRESPC+1
pha
lda #<packed_dictionary
ldy #>packed_dictionary
jsr print_freq_packed_string
pla
sta FRESPC+1
pla
sta FRESPC+0
ply_trash_a
// Next iteration
iny
bne !- // branch always
print_dict_packed_string_end:
rts
#endif
@@ -23,69 +23,46 @@ print_packed_misc_str:
#else
#if !CONFIG_COMPRESSION_LVL_2
print_packed_error: // .X - error string index
lda #<packed_str_errors
ldy #>packed_str_errors
lda #<packed_freq_errors
ldy #>packed_freq_errors
bne print_freq_packed_string // branch always
print_packed_misc_str: // .X - misc string index
lda #<packed_str_misc
ldy #>packed_str_misc
lda #<packed_freq_misc
ldy #>packed_freq_misc
bne print_freq_packed_string // branch always
#endif
print_packed_keyword_CC: // .X - token number
lda #<packed_str_keywords_CC
ldy #>packed_str_keywords_CC
lda #<packed_freq_keywords_CC
ldy #>packed_freq_keywords_CC
bne print_freq_packed_string // branch always
print_packed_keyword_CD: // .X - token number
lda #<packed_str_keywords_CD
ldy #>packed_str_keywords_CD
lda #<packed_freq_keywords_CD
ldy #>packed_freq_keywords_CD
bne print_freq_packed_string // branch always
print_packed_keyword_V2: // .X - token number
lda #<packed_str_keywords_V2
ldy #>packed_str_keywords_V2
lda #<packed_freq_keywords_V2
ldy #>packed_freq_keywords_V2
// FALLTROUGH
print_freq_packed_string: // not to be used directly XXX rename to print_packed_string
// First store the initial address of the packed strings list
// Search for the packed string on the list
sta FRESPC+0
sty FRESPC+1
// Now find the address of the string to print out
// The implementation assumes no packed string is longer than 255 bytes, including trailing zero
!:
cpx #$00
beq print_freq_packed_string_found // branch if no need to advance anymore
dex
ldy #$00
!:
lda (FRESPC), y
iny
cmp #$00
bne !- // branch if not the end of packed string
clc // advance FREESPC pointer
tya
adc FRESPC+0
sta FRESPC+0
lda #$00
adc FRESPC+1
sta FRESPC+1
jmp !--
print_freq_packed_string_found:
jsr print_packed_search
// At this point FRESPC contains a pointer to the string to display
// and we should start from the lower nibble
+40
View File
@@ -0,0 +1,40 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
print_packed_search:
// First store the initial address of the packed strings list
sta FRESPC+0
sty FRESPC+1
// Now find the address of the string to print out
// The implementation assumes no packed string is longer than 255 bytes, including trailing zero
!:
cpx #$00
beq print_packed_done // branch if no need to advance anymore
dex
ldy #$00
!:
lda (FRESPC), y
iny
cmp #$00
bne !- // branch if not the end of packed string
clc // advance FREESPC pointer
tya
adc FRESPC+0
sta FRESPC+0
lda #$00
adc FRESPC+1
sta FRESPC+1
jmp !--
print_packed_done:
rts