more sane directory name, updated binaries
This commit is contained in:
1 parent
d4d32095d1
commit
76aaf298b8
697 files changed
+56
-56
No files matched your search
@@ -0,0 +1,217 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
list_single_line:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__list_single_line
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
// Print line number - in a new line
|
||||
jsr print_return
|
||||
ldy #3
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
dey
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
tax
|
||||
pla
|
||||
jsr print_integer
|
||||
jsr print_space
|
||||
|
||||
// Iterate through printing out the line
|
||||
// contents
|
||||
lda #0
|
||||
sta QTSW
|
||||
|
||||
ldy #4
|
||||
|
||||
list_print_loop:
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
beq list_end_of_line
|
||||
cmp #$22
|
||||
bne list_not_quote
|
||||
lda QTSW
|
||||
eor #$FF
|
||||
sta QTSW
|
||||
lda #$22
|
||||
jmp list_is_literal
|
||||
|
||||
list_not_quote:
|
||||
// Check quote mode, and display as literal if required
|
||||
ldx QTSW
|
||||
bne list_is_literal
|
||||
|
||||
cmp #$FF
|
||||
beq list_is_pi
|
||||
|
||||
cmp #$7F
|
||||
bcc list_is_literal
|
||||
|
||||
// Display a token
|
||||
|
||||
list_display_token_CC:
|
||||
|
||||
cmp #$CC
|
||||
bne list_display_token_CD
|
||||
|
||||
// Fetch the sub-token
|
||||
|
||||
iny
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
// Save registers
|
||||
tax
|
||||
pha
|
||||
phy_trash_a
|
||||
|
||||
// Subtract $1 from token to get offset in token list
|
||||
dex
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_CC
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
bra list_token_displayed
|
||||
#else
|
||||
jmp list_token_displayed
|
||||
#endif
|
||||
|
||||
list_display_token_CD:
|
||||
|
||||
cmp #$CD
|
||||
bne list_display_token_V2
|
||||
|
||||
// Fetch the sub-token
|
||||
|
||||
iny
|
||||
#if ROM_LAYOUT_M65
|
||||
jsr peek_via_OLDTXT
|
||||
#elif CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
// Save registers
|
||||
tax
|
||||
pha
|
||||
phy_trash_a
|
||||
|
||||
// Subtract $1 from token to get offset in token list
|
||||
dex
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_CD
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
bra list_token_displayed
|
||||
#else
|
||||
jmp list_token_displayed
|
||||
#endif
|
||||
|
||||
list_display_token_V2:
|
||||
|
||||
// Save registers
|
||||
tax
|
||||
pha
|
||||
phy_trash_a
|
||||
|
||||
// Subtract $80 from token to get offset in token list
|
||||
txa
|
||||
and #$7f
|
||||
tax
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_V2
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
list_token_displayed:
|
||||
|
||||
// Restore registers
|
||||
ply_trash_a
|
||||
pla
|
||||
|
||||
cmp #$8f
|
||||
bne list_not_rem
|
||||
// REM command locks quote flag on until the end of the line, allowing
|
||||
// funny characters in REM statements without problem.
|
||||
sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here
|
||||
// FALL THROUGH
|
||||
list_not_rem:
|
||||
|
||||
iny
|
||||
bne list_print_loop // branch always
|
||||
|
||||
list_is_pi:
|
||||
lda #$7E
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
list_is_literal:
|
||||
jsr JCHROUT
|
||||
iny
|
||||
bne list_print_loop
|
||||
|
||||
list_end_of_line:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -0,0 +1,28 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Print configured features and current video system on startup banner
|
||||
//
|
||||
|
||||
#if CONFIG_SHOW_FEATURES
|
||||
|
||||
print_features:
|
||||
|
||||
ldx #IDX__STR_FEATURES
|
||||
jsr print_packed_misc_str
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
print_pal_ntsc:
|
||||
|
||||
ldx #IDX__STR_NTSC
|
||||
lda TVSFLG
|
||||
beq !+
|
||||
ldx #IDX__STR_PAL
|
||||
!:
|
||||
jmp print_packed_misc_str
|
||||
|
||||
#endif // CONFIG_SHOW_FEATURES
|
||||
@@ -0,0 +1,148 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// Works similar to $BDCD in original C64 BASIC
|
||||
// XXX Should eventually get replaced by a more flexible and optimal routine.
|
||||
// Temp result gets written to $0100-$0104
|
||||
|
||||
print_integer:
|
||||
|
||||
pha
|
||||
phx_trash_a
|
||||
|
||||
// Clear temporary output
|
||||
lda #$00
|
||||
ldy #5
|
||||
!: sta $0100,y
|
||||
dey
|
||||
bpl !-
|
||||
|
||||
pla
|
||||
ldy #23 // 8 x 3 - 1 = offset of last digit of 128
|
||||
lo_loop:
|
||||
cmp #$7f
|
||||
bcc bit_clear
|
||||
|
||||
// Bit set, so add the digits
|
||||
pha
|
||||
ldx #2
|
||||
clc
|
||||
lo_add_loop:
|
||||
lda $0102,x
|
||||
adc number_table_lo,y
|
||||
sta $0102,x
|
||||
|
||||
dey
|
||||
dex
|
||||
bpl lo_add_loop
|
||||
pla
|
||||
jmp next_lo_bit
|
||||
|
||||
bit_clear:
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
next_lo_bit:
|
||||
asl
|
||||
cpy #$7f
|
||||
bcc lo_loop
|
||||
|
||||
|
||||
// Now do the same for upper byte
|
||||
pla
|
||||
|
||||
ldy #39 // 8 x 5 - 1 = offset of last digit of 32768
|
||||
hi_loop:
|
||||
cmp #$7f
|
||||
bcc bit_clear_hi
|
||||
|
||||
|
||||
// Bit set, so add the digits
|
||||
pha
|
||||
ldx #4
|
||||
clc
|
||||
hi_add_loop:
|
||||
lda $0100,x
|
||||
adc number_table_hi,y
|
||||
sta $0100,x
|
||||
|
||||
dey
|
||||
dex
|
||||
bpl hi_add_loop
|
||||
pla
|
||||
jmp next_hi_bit
|
||||
|
||||
bit_clear_hi:
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
next_hi_bit:
|
||||
asl
|
||||
cpy #$7f
|
||||
bcc hi_loop
|
||||
|
||||
fix_carry:
|
||||
|
||||
// Deal with any carries
|
||||
ldx #3
|
||||
carry_fix_loop:
|
||||
lda $0101,x
|
||||
cmp #10
|
||||
bcc !+
|
||||
inc $0100,x
|
||||
sec
|
||||
sbc #10
|
||||
sta $0101,x
|
||||
|
||||
jmp carry_fix_loop
|
||||
|
||||
!: dex
|
||||
bpl carry_fix_loop
|
||||
|
||||
post_carry:
|
||||
|
||||
// Got digits.
|
||||
// Skip leading zeros, and print the resulting number
|
||||
|
||||
// Skip leading zeros
|
||||
ldy #0
|
||||
!: lda $0100,y
|
||||
bne found_start_of_number
|
||||
iny
|
||||
cpy #4
|
||||
bne !-
|
||||
|
||||
found_start_of_number:
|
||||
// Print digits
|
||||
!: lda $0100,y
|
||||
ora #$30
|
||||
jsr JCHROUT
|
||||
iny
|
||||
cpy #5
|
||||
bne !-
|
||||
|
||||
|
||||
rts
|
||||
|
||||
|
||||
number_table_lo:
|
||||
.byte 0,0,1
|
||||
.byte 0,0,2
|
||||
.byte 0,0,4
|
||||
.byte 0,0,8
|
||||
.byte 0,1,6
|
||||
.byte 0,3,2
|
||||
.byte 0,6,4
|
||||
.byte 1,2,8
|
||||
number_table_hi:
|
||||
.byte 0,0,2,5,6
|
||||
.byte 0,0,5,1,2
|
||||
.byte 0,1,0,2,4
|
||||
.byte 0,2,0,4,8
|
||||
.byte 0,4,0,9,6
|
||||
.byte 0,8,1,9,2
|
||||
.byte 1,6,3,8,4
|
||||
.byte 3,2,7,6,8
|
||||
@@ -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
|
||||
@@ -0,0 +1,165 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// This routine prints strings that have been packed using the 'generate_trings' tool.
|
||||
// The general idea is to save space in the ROM.
|
||||
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
print_packed_error:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__print_packed_error
|
||||
jmp map_NORMAL
|
||||
|
||||
print_packed_misc_str:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__print_packed_misc_str
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
#if !CONFIG_COMPRESSION_LVL_2
|
||||
|
||||
print_packed_error: // .X - error string index
|
||||
|
||||
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_freq_misc
|
||||
ldy #>packed_freq_misc
|
||||
bne print_freq_packed_string // branch always
|
||||
|
||||
#endif
|
||||
|
||||
print_packed_keyword_CC: // .X - token number
|
||||
|
||||
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_freq_keywords_CD
|
||||
ldy #>packed_freq_keywords_CD
|
||||
bne print_freq_packed_string // branch always
|
||||
|
||||
print_packed_keyword_V2: // .X - token number
|
||||
|
||||
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
|
||||
|
||||
// Search for the packed string on the list
|
||||
|
||||
jsr print_packed_search
|
||||
|
||||
// At this point FRESPC contains a pointer to the string to display
|
||||
// and we should start from the lower nibble
|
||||
|
||||
ldy #$00
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
print_freq_packed_string_nibble_lo:
|
||||
|
||||
// Get the low nibble and check for the end of packed string
|
||||
|
||||
lda (FRESPC), y
|
||||
and #$0F
|
||||
beq print_freq_packed_string_end
|
||||
|
||||
// Not the end - check if this is a common character, encoded by a single nibble
|
||||
|
||||
cmp #$0F
|
||||
beq print_freq_packed_string_3n_split
|
||||
|
||||
// Character is encoded by a single nibble - fetch it and display
|
||||
|
||||
tax
|
||||
lda packed_as_1n-1, x
|
||||
jsr JCHROUT // preserves .Y
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
print_freq_packed_string_nibble_hi:
|
||||
|
||||
// Get the high nibble and check for the end of packed string
|
||||
|
||||
lda (FRESPC), y
|
||||
and #$F0
|
||||
beq print_freq_packed_string_end
|
||||
|
||||
// Not the end - check if this is a common character, encoded by a single nibble
|
||||
|
||||
cmp #$F0
|
||||
beq print_freq_packed_string_3n_single
|
||||
|
||||
// Character is encoded by a single nibble - fetch it and display
|
||||
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
tax
|
||||
lda packed_as_1n-1, x
|
||||
jmp !+ // XXX should be bra on some CPUs
|
||||
|
||||
print_freq_packed_string_3n_single:
|
||||
|
||||
// Character is encoded using 3 nibbles (1st is a mark, already interpreted)
|
||||
|
||||
iny
|
||||
lda (FRESPC), y
|
||||
tax
|
||||
lda packed_as_3n-1, x
|
||||
!:
|
||||
jsr JCHROUT // preserves .Y
|
||||
|
||||
// Advance to next nibble
|
||||
|
||||
iny
|
||||
bne print_freq_packed_string_nibble_lo // branch always
|
||||
|
||||
print_freq_packed_string_3n_split:
|
||||
|
||||
// Character is encoded using 3 nibbles (1st is a mark, already interpreted),
|
||||
// but the 2 remaining nibbles are in two neighbour bytes; use a stack to combine them
|
||||
|
||||
lda (FRESPC), y
|
||||
and #$F0
|
||||
tsx
|
||||
pha
|
||||
|
||||
iny
|
||||
lda (FRESPC), y
|
||||
and #$0F
|
||||
|
||||
clc
|
||||
adc STACK, x
|
||||
|
||||
txs // one cycle faster than PLA
|
||||
|
||||
tax
|
||||
lda packed_as_3n-1, x
|
||||
jsr JCHROUT // preserves .Y
|
||||
|
||||
jmp print_freq_packed_string_nibble_hi
|
||||
|
||||
print_freq_packed_string_end:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -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
|
||||
Reference in new issue
Block a user