more work towards Mega65 native mode, added NSYS command

This commit is contained in:
FeralChild64 committed 2020-08-08 17:24:09 +02:00
1 parent ffdc67d5ca
commit 83cdf37c0d
23 files changed
+266 -21

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 BASIC_1 #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if ROM_LAYOUT_M65
packed_freq_keywords_03:
put_packed_freq_keywords_03()
#endif
+30 -6
View File
@@ -3,15 +3,39 @@
// #LAYOUT# * * #IGNORE
#if ROM_LAYOUT_M65
cmd_nsys:
// NSYS requires an argument
jsr is_end_of_statement
bcs_16 do_SYNTAX_error
bra cmd_sys_nsys_common
#endif
cmd_sys:
jsr is_end_of_statement
bcc !+
// SYS requires an argument
jmp do_SYNTAX_error
!:
jsr is_end_of_statement
bcs_16 do_SYNTAX_error
#if ROM_LAYOUT_M65
// Make sure we are in C64 compatibility mode
jsr M65_ISMODE65
bne cmd_sys_nsys_common
jsr M65_MODE64
// FALLTROUGH
cmd_sys_nsys_common:
#endif
//
// XXX Temporary ugly hack to support 'SYS PI*656'
//
@@ -0,0 +1,17 @@
// #LAYOUT# M65 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Jumptable for BASIC commands with tokens prefixed by $03
//
.const command_03_list = List().add(
cmd_nsys
)
command_03_jumptable:
// Note: 65C02 has the page boundary vector bug fixed!
put_jumptable(command_03_list)
@@ -0,0 +1,7 @@
// #LAYOUT# M65 BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// PLACEHOLDER for completeness - jumptable contains direct address
// NSYS command is implemented together with SYS
+25
View File
@@ -98,6 +98,18 @@ tokenise_line_loop:
jsr tk_search
bcc tokenise_line_keyword_02 // branch if keyword identified
#endif
#if ROM_LAYOUT_M65
lda #<packed_freq_keywords_03
sta FRESPC+0
lda #>packed_freq_keywords_03
sta FRESPC+1
jsr tk_search
bcc tokenise_line_keyword_03 // branch if keyword identified
#endif
// Shorten packed keyword candidate and try again
@@ -173,6 +185,19 @@ tokenise_line_char:
// Support for extended keyword lists
#if ROM_LAYOUT_M65
tokenise_line_keyword_03:
// Store the token list index
lda #$03
skip_2_bytes_trash_nvz
// FALLTROUGH
#endif
#if !HAS_SMALL_BASIC
tokenise_line_keyword_02:
@@ -46,7 +46,11 @@ execute_statements:
#else
#if ROM_LAYOUT_M65
cpx #$04
#else
cpx #$03
#endif
bcc execute_statements_extended
#endif
@@ -93,6 +97,13 @@ execute_statements_extended:
cpx #$02
beq execute_statements_02
#if ROM_LAYOUT_M65
cpx #$03
beq execute_statements_03
#endif
jmp do_SYNTAX_error
#endif
@@ -171,6 +182,27 @@ execute_statements_02:
#endif // !HAS_SMALL_BASIC
#if ROM_LAYOUT_M65
execute_statements_03:
// Get the sub-token, check that it is valid
jsr fetch_character
cmp #$00
beq_16 do_SYNTAX_error
cmp #(TK__MAXTOKEN_keywords_03+1)
bcs_16 do_SYNTAX_error
// Use jumptable to go to the command routine
asl
tax
jmp (command_03_jumptable - 2, x)
#endif // ROM_LAYOUT_M65
execute_statements_end_of_line:
// First check, if we are in direct mode - if so,
+22
View File
@@ -94,6 +94,10 @@ list_not_quote:
cmp #$02
beq list_display_token_02
#endif
#if ROM_LAYOUT_M65
cmp #$03
beq list_display_token_03
#endif
// Check for literals
cmp #$7F
@@ -228,6 +232,24 @@ list_display_token_02:
#endif
#if ROM_LAYOUT_M65
list_display_token_03:
// Display a 2-byte token - for extended BASIC
jsr list_fetch_subtoken
// Check if token is known
cpx #TK__MAXTOKEN_keywords_03
bcs list_is_unknown
// Now ask for it to be printed
phy_trash_a
jsr print_packed_keyword_03
jmp_8 list_display_token_ext_done
#endif
list_fetch_subtoken:
// Fetch the sub-token
@@ -55,6 +55,16 @@ print_packed_keyword_02: // .X - token number
#endif
#if ROM_LAYOUT_M65
print_packed_keyword_03: // .X - token number
lda #<packed_freq_keywords_03
ldy #>packed_freq_keywords_03
bne print_freq_packed_string // branch always
#endif
print_packed_keyword_V2: // .X - token number
lda #<packed_freq_keywords_V2