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

+1
View File
@@ -16,6 +16,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
src/basic/basic_commands \
src/basic/basic_commands_01 \
src/basic/basic_commands_02 \
src/basic/basic_commands_03_m65 \
src/basic/basic_operators \
src/basic/basic_functions \
src/basic/board_m65 \
+8
View File
@@ -91,3 +91,11 @@ Clears the screen content.
### `DISPOSE` (all)
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`
+1 -1
View File
@@ -11,7 +11,7 @@
// VIC-IV registers
.label VIC_KEY = $D02F
.label VIC_CTRLA = $D030
.label VIC_CTRLB = $D031
.label VIC_XPOS = $D050
+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
@@ -18,10 +18,11 @@
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__M65_MODE64 = $4000 + 2 * 7
.label VK1__M65_MODE65 = $4000 + 2 * 8
.label VK1__M65_SCRMODEGET = $4000 + 2 * 9
.label VK1__M65_SCRMODESET = $4000 + 2 * 10
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__M65_MODE64 = $4000 + 2 * 8
.label VK1__M65_MODE65 = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
#else
@@ -55,6 +56,8 @@
.word $0000
#endif
.word m65_chrout_screen
.word M65_MODE64
.word M65_MODE65
.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
+5
View File
@@ -22,6 +22,11 @@ M65_MODE64:
lda #$03
sta MISC_EMU
// Set misc VIC-IV flags
lda %00000000 // enable C64 character set
sta VIC_CTRLA
// Switch to VIC-II mode
sta VIC_KEY
+5
View File
@@ -32,6 +32,11 @@ M65_MODE65:
lda #$00
sta MISC_EMU
// Set misc VIC-IV flags
lda %01000000 // enable C65 character set
sta VIC_CTRLA
// XXX
// Set screen mode to 80x25
@@ -15,11 +15,30 @@ default_irq_handler:
#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 JSCNKEY
jsr JUDTIM // update jiffy clock
#endif
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
+7
View File
@@ -10,6 +10,13 @@
chrout_screen:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
beq_16 m65_chrout_screen
#endif
jsr cursor_hide_if_visible
lda SCHAR
+1 -1
View File
@@ -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:
@@ -0,0 +1,9 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_chrout_screen:
// Provide implementation
rts
+9
View File
@@ -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
+1 -9
View File
@@ -60,7 +60,7 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
stx VIC_SCRNPTR+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
@@ -68,11 +68,3 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
sta VIC_CTRLB
rts
m65_scrtab_vic_ctrlb:
.byte %00000000 // 40x25
.byte %10000000 // 80x25
.byte %10000100 // 80x50
+12
View File
@@ -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
} };
// 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
/*
@@ -1760,6 +1771,7 @@ void writeStrings()
dataSetM65.addStrings(GLOBAL_Keywords_V2);
dataSetM65.addStrings(GLOBAL_Keywords_01);
dataSetM65.addStrings(GLOBAL_Keywords_02);
dataSetM65.addStrings(GLOBAL_Keywords_03_M65);
dataSetM65.addStrings(GLOBAL_Errors);
dataSetM65.addStrings(GLOBAL_MiscStrings);