more work towards Mega65 native mode, added NSYS command
This commit is contained in:
1 parent
ffdc67d5ca
commit
83cdf37c0d
23 files changed
+266
-21
No files matched your search
@@ -16,6 +16,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
|
|||||||
src/basic/basic_commands \
|
src/basic/basic_commands \
|
||||||
src/basic/basic_commands_01 \
|
src/basic/basic_commands_01 \
|
||||||
src/basic/basic_commands_02 \
|
src/basic/basic_commands_02 \
|
||||||
|
src/basic/basic_commands_03_m65 \
|
||||||
src/basic/basic_operators \
|
src/basic/basic_operators \
|
||||||
src/basic/basic_functions \
|
src/basic/basic_functions \
|
||||||
src/basic/board_m65 \
|
src/basic/board_m65 \
|
||||||
|
|||||||
@@ -91,3 +91,11 @@ Clears the screen content.
|
|||||||
### `DISPOSE` (all)
|
### `DISPOSE` (all)
|
||||||
|
|
||||||
Runs the garbage collector - disposes outdated strings.
|
Runs the garbage collector - disposes outdated strings.
|
||||||
|
|
||||||
|
### `NSYS` (Mega65)
|
||||||
|
|
||||||
|
A 'native' `SYS` - same as `SYS`, but does not switch to C64 compatibility mode.
|
||||||
|
|
||||||
|
### `GO 64`, `GO 65` (Mega65)
|
||||||
|
|
||||||
|
Switches machine to C64 compatibility mode or to MEGA65 native mode. Performs `CLR`
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
// VIC-IV registers
|
// VIC-IV registers
|
||||||
|
|
||||||
.label VIC_KEY = $D02F
|
.label VIC_KEY = $D02F
|
||||||
|
.label VIC_CTRLA = $D030
|
||||||
.label VIC_CTRLB = $D031
|
.label VIC_CTRLB = $D031
|
||||||
|
|
||||||
.label VIC_XPOS = $D050
|
.label VIC_XPOS = $D050
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -3,15 +3,39 @@
|
|||||||
// #LAYOUT# * * #IGNORE
|
// #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:
|
cmd_sys:
|
||||||
|
|
||||||
jsr is_end_of_statement
|
|
||||||
bcc !+
|
|
||||||
|
|
||||||
// SYS requires an argument
|
// 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'
|
// 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
|
||||||
@@ -98,6 +98,18 @@ tokenise_line_loop:
|
|||||||
jsr tk_search
|
jsr tk_search
|
||||||
bcc tokenise_line_keyword_02 // branch if keyword identified
|
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
|
#endif
|
||||||
|
|
||||||
// Shorten packed keyword candidate and try again
|
// Shorten packed keyword candidate and try again
|
||||||
@@ -173,6 +185,19 @@ tokenise_line_char:
|
|||||||
|
|
||||||
// Support for extended keyword lists
|
// 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
|
#if !HAS_SMALL_BASIC
|
||||||
|
|
||||||
tokenise_line_keyword_02:
|
tokenise_line_keyword_02:
|
||||||
|
|||||||
@@ -46,7 +46,11 @@ execute_statements:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
cpx #$04
|
||||||
|
#else
|
||||||
cpx #$03
|
cpx #$03
|
||||||
|
#endif
|
||||||
bcc execute_statements_extended
|
bcc execute_statements_extended
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -93,6 +97,13 @@ execute_statements_extended:
|
|||||||
cpx #$02
|
cpx #$02
|
||||||
beq execute_statements_02
|
beq execute_statements_02
|
||||||
|
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
|
||||||
|
cpx #$03
|
||||||
|
beq execute_statements_03
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
jmp do_SYNTAX_error
|
jmp do_SYNTAX_error
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -171,6 +182,27 @@ execute_statements_02:
|
|||||||
|
|
||||||
#endif // !HAS_SMALL_BASIC
|
#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:
|
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,
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ list_not_quote:
|
|||||||
cmp #$02
|
cmp #$02
|
||||||
beq list_display_token_02
|
beq list_display_token_02
|
||||||
#endif
|
#endif
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
cmp #$03
|
||||||
|
beq list_display_token_03
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for literals
|
// Check for literals
|
||||||
cmp #$7F
|
cmp #$7F
|
||||||
@@ -228,6 +232,24 @@ list_display_token_02:
|
|||||||
|
|
||||||
#endif
|
#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:
|
list_fetch_subtoken:
|
||||||
|
|
||||||
// Fetch the sub-token
|
// Fetch the sub-token
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ print_packed_keyword_02: // .X - token number
|
|||||||
|
|
||||||
#endif
|
#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
|
print_packed_keyword_V2: // .X - token number
|
||||||
|
|
||||||
lda #<packed_freq_keywords_V2
|
lda #<packed_freq_keywords_V2
|
||||||
|
|||||||
@@ -18,10 +18,11 @@
|
|||||||
.label VK1__load_tape_turbo = $4000 + 2 * 4
|
.label VK1__load_tape_turbo = $4000 + 2 * 4
|
||||||
.label VK1__load_tape_auto = $4000 + 2 * 5
|
.label VK1__load_tape_auto = $4000 + 2 * 5
|
||||||
.label VK1__tape_head_align = $4000 + 2 * 6
|
.label VK1__tape_head_align = $4000 + 2 * 6
|
||||||
.label VK1__M65_MODE64 = $4000 + 2 * 7
|
.label VK1__m65_chrout_screen = $4000 + 2 * 7
|
||||||
.label VK1__M65_MODE65 = $4000 + 2 * 8
|
.label VK1__M65_MODE64 = $4000 + 2 * 8
|
||||||
.label VK1__M65_SCRMODEGET = $4000 + 2 * 9
|
.label VK1__M65_MODE65 = $4000 + 2 * 9
|
||||||
.label VK1__M65_SCRMODESET = $4000 + 2 * 10
|
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
|
||||||
|
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -55,6 +56,8 @@
|
|||||||
.word $0000
|
.word $0000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.word m65_chrout_screen
|
||||||
|
|
||||||
.word M65_MODE64
|
.word M65_MODE64
|
||||||
.word M65_MODE65
|
.word M65_MODE65
|
||||||
.word M65_SCRMODEGET
|
.word M65_SCRMODEGET
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// ROM routine call redirect for Mega65 screen routines
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
m65_chrout_screen:
|
||||||
|
|
||||||
|
jsr map_KERNAL_1
|
||||||
|
jsr_ind VK1__m65_chrout_screen
|
||||||
|
jsr map_NORMAL
|
||||||
|
jmp chrout_done_success
|
||||||
|
|
||||||
@@ -22,6 +22,11 @@ M65_MODE64:
|
|||||||
lda #$03
|
lda #$03
|
||||||
sta MISC_EMU
|
sta MISC_EMU
|
||||||
|
|
||||||
|
// Set misc VIC-IV flags
|
||||||
|
|
||||||
|
lda %00000000 // enable C64 character set
|
||||||
|
sta VIC_CTRLA
|
||||||
|
|
||||||
// Switch to VIC-II mode
|
// Switch to VIC-II mode
|
||||||
|
|
||||||
sta VIC_KEY
|
sta VIC_KEY
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ M65_MODE65:
|
|||||||
lda #$00
|
lda #$00
|
||||||
sta MISC_EMU
|
sta MISC_EMU
|
||||||
|
|
||||||
|
// Set misc VIC-IV flags
|
||||||
|
|
||||||
|
lda %01000000 // enable C65 character set
|
||||||
|
sta VIC_CTRLA
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
|
|
||||||
// Set screen mode to 80x25
|
// Set screen mode to 80x25
|
||||||
|
|||||||
@@ -15,11 +15,30 @@ default_irq_handler:
|
|||||||
|
|
||||||
#endif // CONFIG_RS232_UP9600
|
#endif // CONFIG_RS232_UP9600
|
||||||
|
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
|
||||||
|
jsr M65_ISMODE65
|
||||||
|
bne !+
|
||||||
|
|
||||||
|
jsr m65_cursor_blink
|
||||||
|
|
||||||
|
bra default_irq_handler_common
|
||||||
|
!:
|
||||||
|
jsr cursor_blink
|
||||||
|
|
||||||
|
default_irq_handler_common:
|
||||||
|
|
||||||
|
jsr JSCNKEY
|
||||||
|
jsr JUDTIM // update jiffy clock
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
jsr cursor_blink
|
jsr cursor_blink
|
||||||
jsr JSCNKEY
|
jsr JSCNKEY
|
||||||
jsr JUDTIM // update jiffy clock
|
jsr JUDTIM // update jiffy clock
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,13 @@
|
|||||||
|
|
||||||
chrout_screen:
|
chrout_screen:
|
||||||
|
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
|
||||||
|
jsr M65_ISMODE65
|
||||||
|
beq_16 m65_chrout_screen
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
jsr cursor_hide_if_visible
|
jsr cursor_hide_if_visible
|
||||||
|
|
||||||
lda SCHAR
|
lda SCHAR
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if ((CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) && !CONFIG_MB_MEGA_65) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
|
#if ((CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K)
|
||||||
|
|
||||||
|
|
||||||
screen_off:
|
screen_off:
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
m65_chrout_screen:
|
||||||
|
|
||||||
|
// Provide implementation
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
m65_cursor_blink:
|
||||||
|
|
||||||
|
// XXX provide implementation
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
// Table of parameters for VIC control register B
|
||||||
|
|
||||||
|
m65_scrtab_vic_ctrlb:
|
||||||
|
|
||||||
|
.byte %00100000 // 40x25 + extended attributes
|
||||||
|
.byte %10100000 // 80x25 + extended attributes
|
||||||
|
.byte %10100100 // 80x50 + extended attributes
|
||||||
@@ -60,7 +60,7 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
|
|||||||
stx VIC_SCRNPTR+1
|
stx VIC_SCRNPTR+1
|
||||||
stx M65_SCRTXTBASE+1
|
stx M65_SCRTXTBASE+1
|
||||||
|
|
||||||
// Set flags/varaibles for 40/80 columns and 25/50 rows
|
// Set flags/variables for 40/80 columns and 25/50 rows
|
||||||
|
|
||||||
tax
|
tax
|
||||||
|
|
||||||
@@ -68,11 +68,3 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
|
|||||||
sta VIC_CTRLB
|
sta VIC_CTRLB
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m65_scrtab_vic_ctrlb:
|
|
||||||
|
|
||||||
.byte %00000000 // 40x25
|
|
||||||
.byte %10000000 // 80x25
|
|
||||||
.byte %10000100 // 80x50
|
|
||||||
@@ -206,6 +206,17 @@ const StringEntryList GLOBAL_Keywords_02 = { ListType::KEYWORDS, "keywords_02",
|
|||||||
// (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c
|
// (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c
|
||||||
} };
|
} };
|
||||||
|
|
||||||
|
// extended BASIC keywords - list reserved for hardware dependent BASIC commands
|
||||||
|
|
||||||
|
const StringEntryList GLOBAL_Keywords_03_M65 = { ListType::KEYWORDS, "keywords_03",
|
||||||
|
{
|
||||||
|
// STD M65 U64 X16
|
||||||
|
|
||||||
|
{ false, true, false, false, "K03_01", "NSYS", }, // Not present in CBM BASIC dialects, Open ROMs specific
|
||||||
|
|
||||||
|
} };
|
||||||
|
|
||||||
|
|
||||||
// BASIC errors - all dialects
|
// BASIC errors - all dialects
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1760,6 +1771,7 @@ void writeStrings()
|
|||||||
dataSetM65.addStrings(GLOBAL_Keywords_V2);
|
dataSetM65.addStrings(GLOBAL_Keywords_V2);
|
||||||
dataSetM65.addStrings(GLOBAL_Keywords_01);
|
dataSetM65.addStrings(GLOBAL_Keywords_01);
|
||||||
dataSetM65.addStrings(GLOBAL_Keywords_02);
|
dataSetM65.addStrings(GLOBAL_Keywords_02);
|
||||||
|
dataSetM65.addStrings(GLOBAL_Keywords_03_M65);
|
||||||
dataSetM65.addStrings(GLOBAL_Errors);
|
dataSetM65.addStrings(GLOBAL_Errors);
|
||||||
dataSetM65.addStrings(GLOBAL_MiscStrings);
|
dataSetM65.addStrings(GLOBAL_MiscStrings);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user