more work on extended command set
This commit is contained in:
1 parent
e74fd4140a
commit
9846b69c71
12 files changed
+367
-37
No files matched your search
@@ -187,10 +187,17 @@
|
|||||||
|
|
||||||
#if CONFIG_MB_MEGA_65
|
#if CONFIG_MB_MEGA_65
|
||||||
|
|
||||||
.const C65_EXTKEYS_PR = $D607
|
.label C65_EXTKEYS_PR = $D607
|
||||||
.const C65_EXTKEYS_DDR = $D608
|
.label C65_EXTKEYS_DDR = $D608
|
||||||
|
|
||||||
.const M65_BADL_SLI = $D710
|
.label M65_BADL_SLI = $D710
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// SuperCPU registers
|
||||||
|
|
||||||
|
.label SCPU_SPEED_NORMAL = $D07A
|
||||||
|
.label SCPU_SPEED_TURBO = $D07B
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||||
|
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
packed_str_keywords_CC:
|
||||||
|
|
||||||
|
put_freq_packed_keywords_CC()
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||||
|
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
packed_str_keywords_CD:
|
||||||
|
|
||||||
|
put_freq_packed_keywords_CD()
|
||||||
@@ -5,4 +5,36 @@
|
|||||||
|
|
||||||
cmd_fast:
|
cmd_fast:
|
||||||
|
|
||||||
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
|
#if CONFIG_MB_MEGA_65
|
||||||
|
|
||||||
|
// Command implementation for Mega65
|
||||||
|
|
||||||
|
// XXX provide better implementation
|
||||||
|
|
||||||
|
jmp execute_statements
|
||||||
|
|
||||||
|
#elif CONFIG_MB_ULTIMATE_64
|
||||||
|
|
||||||
|
// Try to enable turbo in SuperCPU compatible way
|
||||||
|
sta SCPU_SPEED_TURBO
|
||||||
|
|
||||||
|
jmp execute_statements
|
||||||
|
|
||||||
|
#elif CONFIG_PLATFORM_COMMODORE_64
|
||||||
|
|
||||||
|
// Command implementation for generic C64 platform
|
||||||
|
|
||||||
|
// Try to enable turbo mode in C128 compatible way
|
||||||
|
lda #$01
|
||||||
|
sta VIC_CLKRATE
|
||||||
|
|
||||||
|
// Try to enable turbo in SuperCPU compatible way
|
||||||
|
sta SCPU_SPEED_TURBO
|
||||||
|
|
||||||
|
jmp execute_statements
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
jmp do_NOT_IMPLEMENTED_error
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,4 +5,41 @@
|
|||||||
|
|
||||||
cmd_slow:
|
cmd_slow:
|
||||||
|
|
||||||
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
|
.break
|
||||||
|
|
||||||
|
#if CONFIG_MB_MEGA_65
|
||||||
|
|
||||||
|
// Command implementation for Mega65
|
||||||
|
|
||||||
|
// XXX provide implementation
|
||||||
|
|
||||||
|
jmp do_NOT_IMPLEMENTED_error
|
||||||
|
|
||||||
|
#elif CONFIG_MB_ULTIMATE_64
|
||||||
|
|
||||||
|
// Command implementation for Ultimate 64
|
||||||
|
|
||||||
|
// Try to disable turbo in SuperCPU compatible way
|
||||||
|
sta SCPU_SPEED_NORMAL
|
||||||
|
|
||||||
|
jmp execute_statements
|
||||||
|
|
||||||
|
#elif CONFIG_PLATFORM_COMMODORE_64
|
||||||
|
|
||||||
|
// Command implementation for generic C64 platform
|
||||||
|
|
||||||
|
// Try to disable turbo mode in C128 compatible way
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta VIC_CLKRATE
|
||||||
|
|
||||||
|
// Try to disable turbo in SuperCPU compatible way
|
||||||
|
sta SCPU_SPEED_NORMAL
|
||||||
|
|
||||||
|
jmp execute_statements
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
jmp do_NOT_IMPLEMENTED_error
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -17,9 +17,8 @@
|
|||||||
.label VB1__list_single_line = $4000 + 2 * 3
|
.label VB1__list_single_line = $4000 + 2 * 3
|
||||||
.label VB1__print_packed_error = $4000 + 2 * 4
|
.label VB1__print_packed_error = $4000 + 2 * 4
|
||||||
.label VB1__print_packed_misc_str = $4000 + 2 * 5
|
.label VB1__print_packed_misc_str = $4000 + 2 * 5
|
||||||
.label VB1__print_packed_keyword_V2 = $4000 + 2 * 6
|
.label VB1__basic_do_clr = $4000 + 2 * 6
|
||||||
.label VB1__basic_do_clr = $4000 + 2 * 7
|
.label VB1__basic_do_new = $4000 + 2 * 7
|
||||||
.label VB1__basic_do_new = $4000 + 2 * 8
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@
|
|||||||
.word list_single_line
|
.word list_single_line
|
||||||
.word print_packed_error
|
.word print_packed_error
|
||||||
.word print_packed_misc_str
|
.word print_packed_misc_str
|
||||||
.word print_packed_keyword_V2
|
|
||||||
.word basic_do_clr
|
.word basic_do_clr
|
||||||
.word basic_do_new
|
.word basic_do_new
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ execute_statements:
|
|||||||
|
|
||||||
#else // HAS_OPCODES_65C02
|
#else // HAS_OPCODES_65C02
|
||||||
|
|
||||||
// Use jumptable to go to the token
|
// Use jumptable to go to the command routine
|
||||||
|
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
@@ -70,14 +70,93 @@ execute_statements:
|
|||||||
|
|
||||||
execute_statements_extended:
|
execute_statements_extended:
|
||||||
|
|
||||||
// XXX here is the place for possible extended BASIC command set
|
// Support for extended BASIC commands
|
||||||
|
|
||||||
|
cmp #$CC
|
||||||
|
beq execute_statements_CC
|
||||||
|
cmp #$CD
|
||||||
|
beq execute_statements_CD
|
||||||
|
|
||||||
|
// 'GO' command has a strange token, it is placed after function tokens
|
||||||
|
|
||||||
cmp #$CB
|
cmp #$CB
|
||||||
beq_16 cmd_go // 'GO' command has a strange token, it is placed after function tokens
|
beq_16 cmd_go
|
||||||
|
|
||||||
jmp do_SYNTAX_error
|
jmp do_SYNTAX_error
|
||||||
|
|
||||||
|
|
||||||
|
execute_statements_CC:
|
||||||
|
|
||||||
|
// Get the sub-token, check that it is valid
|
||||||
|
|
||||||
|
jsr fetch_character
|
||||||
|
cmp #$00
|
||||||
|
beq_16 do_SYNTAX_error
|
||||||
|
|
||||||
|
cmp #(TK__MAXTOKEN_keywords_CC+1)
|
||||||
|
bcs_16 do_SYNTAX_error
|
||||||
|
|
||||||
|
// Execute command
|
||||||
|
|
||||||
|
#if !HAS_OPCODES_65C02
|
||||||
|
|
||||||
|
// Get the jump table entry for it, push it on the stack, and then RTS to start it.
|
||||||
|
|
||||||
|
tax
|
||||||
|
lda command_CC_jumptable_hi - 1, x
|
||||||
|
pha
|
||||||
|
lda command_CC_jumptable_lo - 1, x
|
||||||
|
pha
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
#else // HAS_OPCODES_65C02
|
||||||
|
|
||||||
|
// Use jumptable to go to the command routine
|
||||||
|
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
jmp (command_CC_jumptable - 2, x)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
execute_statements_CD:
|
||||||
|
|
||||||
|
// Get the sub-token, check that it is valid
|
||||||
|
|
||||||
|
jsr fetch_character
|
||||||
|
cmp #$00
|
||||||
|
beq_16 do_SYNTAX_error
|
||||||
|
|
||||||
|
cmp #(TK__MAXTOKEN_keywords_CD+1)
|
||||||
|
bcs_16 do_SYNTAX_error
|
||||||
|
|
||||||
|
// Execute command
|
||||||
|
|
||||||
|
#if !HAS_OPCODES_65C02
|
||||||
|
|
||||||
|
// Get the jump table entry for it, push it on the stack, and then RTS to start it.
|
||||||
|
|
||||||
|
tax
|
||||||
|
lda command_CD_jumptable_hi - 1, x
|
||||||
|
pha
|
||||||
|
lda command_CD_jumptable_lo - 1, x
|
||||||
|
pha
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
#else // HAS_OPCODES_65C02
|
||||||
|
|
||||||
|
// Use jumptable to go to the command routine
|
||||||
|
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
jmp (command_CD_jumptable - 2, x)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
execute_statements_end_of_line:
|
execute_statements_end_of_line:
|
||||||
|
|
||||||
// First check, if we are in direct mode - if so,
|
// First check, if we are in direct mode - if so,
|
||||||
|
|||||||
@@ -82,11 +82,82 @@ list_not_quote:
|
|||||||
|
|
||||||
// Display a token
|
// 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
|
||||||
|
#else
|
||||||
|
lda (OLDTXT),y
|
||||||
|
#endif
|
||||||
|
|
||||||
// Save registers
|
// Save registers
|
||||||
tax
|
tax
|
||||||
pha
|
pha
|
||||||
phy_trash_a
|
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
|
||||||
|
#else
|
||||||
|
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
|
// Subtract $80 from token to get offset in token list
|
||||||
txa
|
txa
|
||||||
@@ -96,6 +167,10 @@ list_not_quote:
|
|||||||
// Now ask for it to be printed
|
// Now ask for it to be printed
|
||||||
jsr print_packed_keyword_V2
|
jsr print_packed_keyword_V2
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
list_token_displayed:
|
||||||
|
|
||||||
// Restore registers
|
// Restore registers
|
||||||
ply_trash_a
|
ply_trash_a
|
||||||
pla
|
pla
|
||||||
|
|||||||
@@ -21,12 +21,6 @@ print_packed_misc_str:
|
|||||||
jsr_ind VB1__print_packed_misc_str
|
jsr_ind VB1__print_packed_misc_str
|
||||||
jmp map_NORMAL
|
jmp map_NORMAL
|
||||||
|
|
||||||
print_packed_keyword_V2:
|
|
||||||
|
|
||||||
jsr map_BASIC_1
|
|
||||||
jsr_ind VB1__print_packed_keyword_V2
|
|
||||||
jmp map_NORMAL
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
print_packed_error: // .X - error string index
|
print_packed_error: // .X - error string index
|
||||||
@@ -41,6 +35,18 @@ print_packed_misc_str: // .X - misc string index
|
|||||||
ldy #>packed_str_misc
|
ldy #>packed_str_misc
|
||||||
bne print_freq_packed_string // branch always
|
bne print_freq_packed_string // branch always
|
||||||
|
|
||||||
|
print_packed_keyword_CC: // .X - token number
|
||||||
|
|
||||||
|
lda #<packed_str_keywords_CC
|
||||||
|
ldy #>packed_str_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
|
||||||
|
bne print_freq_packed_string // branch always
|
||||||
|
|
||||||
print_packed_keyword_V2: // .X - token number
|
print_packed_keyword_V2: // .X - token number
|
||||||
|
|
||||||
lda #<packed_str_keywords_V2
|
lda #<packed_str_keywords_V2
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# M65 BASIC_1 #TAKE
|
||||||
|
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cuts away unnecessary characters after tokenizing a keyword
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
tk_cut_away:
|
||||||
|
|
||||||
|
inc tk__offset
|
||||||
|
ldy tk__offset
|
||||||
|
|
||||||
|
dec tk__len_unpacked // keyword length, afterwards number of bytes to cut away
|
||||||
|
lda tk__len_unpacked
|
||||||
|
clc
|
||||||
|
adc tk__offset
|
||||||
|
tax
|
||||||
|
!:
|
||||||
|
lda BUF, x
|
||||||
|
sta BUF, y
|
||||||
|
beq !+
|
||||||
|
|
||||||
|
inx
|
||||||
|
iny
|
||||||
|
bne !-
|
||||||
|
!:
|
||||||
|
rts
|
||||||
@@ -70,6 +70,8 @@ tokenise_line_loop:
|
|||||||
lda tk__len_unpacked
|
lda tk__len_unpacked
|
||||||
beq tokenise_line_char // branch if attempt to tokenise failed
|
beq tokenise_line_char // branch if attempt to tokenise failed
|
||||||
|
|
||||||
|
// Check for BASIC V2 tokens
|
||||||
|
|
||||||
lda #<packed_str_keywords_V2
|
lda #<packed_str_keywords_V2
|
||||||
sta FRESPC+0
|
sta FRESPC+0
|
||||||
lda #>packed_str_keywords_V2
|
lda #>packed_str_keywords_V2
|
||||||
@@ -78,7 +80,23 @@ tokenise_line_loop:
|
|||||||
jsr tk_search
|
jsr tk_search
|
||||||
bcc tokenise_line_keyword_V2 // branch if keyword identified
|
bcc tokenise_line_keyword_V2 // branch if keyword identified
|
||||||
|
|
||||||
// XXX add support for additional keyword lists here
|
// Check for extended tokens
|
||||||
|
|
||||||
|
lda #<packed_str_keywords_CC
|
||||||
|
sta FRESPC+0
|
||||||
|
lda #>packed_str_keywords_CC
|
||||||
|
sta FRESPC+1
|
||||||
|
|
||||||
|
jsr tk_search
|
||||||
|
bcc tokenise_line_keyword_CC // branch if keyword identified
|
||||||
|
|
||||||
|
lda #<packed_str_keywords_CD
|
||||||
|
sta FRESPC+0
|
||||||
|
lda #>packed_str_keywords_CD
|
||||||
|
sta FRESPC+1
|
||||||
|
|
||||||
|
jsr tk_search
|
||||||
|
bcc tokenise_line_keyword_CD // branch if keyword identified
|
||||||
|
|
||||||
// Shorten packed keyword candidate and try again
|
// Shorten packed keyword candidate and try again
|
||||||
|
|
||||||
@@ -106,28 +124,13 @@ tokenise_line_keyword_V2:
|
|||||||
|
|
||||||
// Cut away unnecessary bytes
|
// Cut away unnecessary bytes
|
||||||
|
|
||||||
inc tk__offset
|
jsr tk_cut_away
|
||||||
ldx tk__offset
|
|
||||||
|
|
||||||
dec tk__len_unpacked // keyword length, afterwards number of bytes to cut away
|
|
||||||
lda tk__len_unpacked
|
|
||||||
clc
|
|
||||||
adc tk__offset
|
|
||||||
tay
|
|
||||||
!:
|
|
||||||
lda BUF, y
|
|
||||||
sta BUF, x
|
|
||||||
beq !+
|
|
||||||
|
|
||||||
inx
|
|
||||||
iny
|
|
||||||
bne !-
|
|
||||||
!:
|
|
||||||
// Special handling for REM command - after this one nothing more should be tokenised
|
// Special handling for REM command - after this one nothing more should be tokenised
|
||||||
|
|
||||||
pla
|
pla
|
||||||
cmp #$0F // REM token index
|
cmp #$0F // REM token index
|
||||||
bne tokenise_line_loop
|
jmp tokenise_line_loop
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
@@ -173,4 +176,41 @@ tokenise_line_char:
|
|||||||
inc tk__offset
|
inc tk__offset
|
||||||
jmp tokenise_line_loop
|
jmp tokenise_line_loop
|
||||||
|
|
||||||
|
|
||||||
|
// Support for extended keyword lists
|
||||||
|
|
||||||
|
tokenise_line_keyword_CC:
|
||||||
|
|
||||||
|
// Store the token list index
|
||||||
|
|
||||||
|
lda #$CC
|
||||||
|
skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
tokenise_line_keyword_CD:
|
||||||
|
|
||||||
|
// Store the token list index
|
||||||
|
|
||||||
|
lda #$CD
|
||||||
|
|
||||||
|
ldy tk__offset
|
||||||
|
sta BUF, y
|
||||||
|
|
||||||
|
// Store the sub-token itself
|
||||||
|
|
||||||
|
inx
|
||||||
|
txa
|
||||||
|
iny
|
||||||
|
sty tk__offset
|
||||||
|
sta BUF, y
|
||||||
|
|
||||||
|
// Cut away unnecessary bytes
|
||||||
|
|
||||||
|
inc tk__offset
|
||||||
|
dec tk__len_unpacked
|
||||||
|
|
||||||
|
jsr tk_cut_away
|
||||||
|
jmp tokenise_line_loop
|
||||||
|
|
||||||
#endif // ROM layout
|
#endif // ROM layout
|
||||||
@@ -826,6 +826,14 @@ void DataSet::prepareOutput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For the token list - put the number of tokens available
|
||||||
|
|
||||||
|
if (stringEntryList.type == ListType::KEYWORDS)
|
||||||
|
{
|
||||||
|
stream << std::endl << ".label TK__MAXTOKEN_" << stringEntryList.name << " = " <<
|
||||||
|
std::dec << stringEncodedList.size() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
stream << std::endl << ".macro put_freq_packed_" << stringEntryList.name << "()" << std::endl << "{" << std::endl;
|
stream << std::endl << ".macro put_freq_packed_" << stringEntryList.name << "()" << std::endl << "{" << std::endl;
|
||||||
|
|
||||||
enum LastStr { NONE, SKIPPED, WRITTEN } lastStr = LastStr::NONE;
|
enum LastStr { NONE, SKIPPED, WRITTEN } lastStr = LastStr::NONE;
|
||||||
@@ -867,7 +875,7 @@ void DataSet::prepareOutput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For the token list - pu the 'end of keywords' mark
|
// For the token list - put the 'end of keywords' mark
|
||||||
|
|
||||||
if (stringEntryList.type == ListType::KEYWORDS)
|
if (stringEntryList.type == ListType::KEYWORDS)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user