more sane directory name, updated binaries

This commit is contained in:
FeralChild64 committed 2020-06-26 19:44:01 +02:00
1 parent d4d32095d1
commit 76aaf298b8
697 files changed
+56 -56

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Jumptable for BASIC V2 dialect commands
//
.const command_list = List().add(
// $80 - $8F
cmd_end,
cmd_for,
cmd_next,
cmd_data,
cmd_inputhash,
cmd_input,
cmd_dim,
cmd_read,
cmd_let,
cmd_goto,
cmd_run,
cmd_if,
cmd_restore,
cmd_gosub,
cmd_return,
cmd_rem,
// $90-$9F
cmd_stop,
cmd_on,
cmd_wait,
cmd_load,
cmd_save,
cmd_verify,
cmd_def,
cmd_poke,
cmd_printhash,
cmd_print,
cmd_cont,
cmd_list,
cmd_clr,
cmd_cmd,
cmd_sys,
cmd_open,
// $A0-$A6
cmd_close,
cmd_get,
cmd_new,
cmd_tab, // XXX this token probably does not belong here
do_SYNTAX_error, // 'TO' is not a standalone command
do_SYNTAX_error, // 'FN' is not a standalone command
cmd_spc, // XXX this token probably does not belong here
// 'THEN' ($A7) and 'STEP' ($A9) are not standalone commands
// 'NOT' ($A8) is an operator, not a command
// $CB, but remapped to $A7
cmd_go
)
#if !HAS_OPCODES_65C02
command_jumptable_lo:
put_jumptable_lo(command_list)
command_jumptable_hi:
put_jumptable_hi(command_list)
#else // HAS_OPCODES_65C02
__before_command_jumptable:
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
command_jumptable:
put_jumptable(command_list)
// Make sure routine size is always the same - build system limitation
.if (__before_command_jumptable == command_jumptable) { brk }
#endif
@@ -0,0 +1,65 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Default handler for all not-yet-implemented commands
//
// Note: NOPs are here just to make debugging easier (no duplicated labels)!
//
cmd_for:
nop
cmd_next:
nop
cmd_data:
nop
cmd_inputhash:
nop
cmd_input:
nop
cmd_dim:
nop
cmd_read:
nop
cmd_let:
nop
cmd_if:
nop
cmd_restore:
nop
cmd_gosub:
nop
cmd_return:
nop
cmd_on:
nop
cmd_wait:
nop
cmd_def:
nop
cmd_poke:
nop
cmd_printhash:
nop
cmd_cont:
nop
cmd_cmd:
nop
cmd_open:
nop
cmd_close:
nop
cmd_get:
nop
cmd_tab:
nop
cmd_spc:
nop
cmd_go:
nop
// Unimplemented tokens
jmp do_NOT_IMPLEMENTED_error
+12
View File
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_clr:
jsr basic_do_clr
// CLR command does not stop execution (confirmed on a C64)
jmp execute_statements
+44
View File
@@ -0,0 +1,44 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// LIST basic text.
// XXX - Does not currently support line number ranges
cmd_list:
// Set current line pointer to start of memory
jsr init_oldtxt
list_loop:
ldy #1
#if CONFIG_MEMORY_MODEL_60K
ldx #<OLDTXT+0
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
bne list_more_lines
// LIST terminates any running program,
// because it has fiddled with the current line pointer.
// (Confirmed by testing on a C64)
jmp basic_main_loop
list_more_lines:
lda STKEY
bmi !+
jmp cmd_stop
!:
jsr list_single_line
// Now link to the next line
jsr basic_find_next_line
jmp list_loop
@@ -0,0 +1,83 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_verify:
// LOAD and VERIFY are very similar, from BASIC perspective there is almost no difference;
// just different parameter passed to Kernal and different error message in case of failure
lda #$01 // mark operation as VERIFY
skip_2_bytes_trash_nvz
cmd_load:
lda #$00 // mark operation as LOAD
jsr helper_load_init_params
jsr helper_load_setnam_any // if no file name found, use "*"
// Fetch the file name
jsr helper_load_fetch_filename
bcs !+
// Try to fetch device number and secondary address
jsr helper_load_fetch_devnum
bcs !+
jsr helper_load_fetch_secondary
!:
// FALLTROUGH
cmd_load_got_params: // input for tape wedge
// Perform loading
ldy TXTTAB+1
ldx TXTTAB+0
lda VERCKB // LOAD or VERIFY
jsr JLOAD
bcs_16 do_kernal_error
cmd_load_no_error:
// Store last loaded address
stx VARTAB+0
sty VARTAB+1
// For VERIFY - this is it
lda VERCKB
bne_16 execute_statements
// C64 BASIC apparently does not clear variables after a LOAD in the
// middle of a program. For safety, we do.
jsr basic_do_clr
// Now relink the loaded program, as we cannot trust the line
// links supplied. For example, the VICE virtual drive emulation
// always supplies $0101 as the address of the next line
jsr LINKPRG
// Now we either start the program from the beginning,
// or go back to the READY prompt if LOAD was called from direct mode.
// Reset to start of program
jsr init_oldtxt
// If loading was done when running a program - run it
ldx CURLIN+1
inx
beq cmd_load_end // branch if direct mode
jmp execute_line
cmd_load_end:
jmp basic_main_loop
+12
View File
@@ -0,0 +1,12 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_new:
jsr basic_do_new
// NEW command terminates execution (confirmed on a C64)
jmp basic_main_loop
+92
View File
@@ -0,0 +1,92 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_print:
// First check if we have anything to print
jsr end_of_statement_check
bcs cmd_print_new_line_done
jsr fetch_character
cmp #$3B // semicolon
beq cmd_print_done
// FALLTROUGH
cmd_print_loop:
jsr unconsume_character
// FALLTROUGH
cmd_print_after_comma:
// Now evaluate the expression
jsr FRMEVL
lda VALTYP
bpl cmd_print_float
// FALLTROUGH
cmd_print_string:
// Print a string value
ldy #$00
!:
cpy __FAC1 + 0
beq cmd_print_next_arg
#if CONFIG_MEMORY_MODEL_60K
ldx #<(__FAC1 + 1)
jsr peek_under_roms
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
jsr peek_under_roms_via_FAC1_PLUS_1
#else // CONFIG_MEMORY_MODEL_38K
lda (__FAC1 + 1), y
#endif
jsr JCHROUT
iny
jmp !-
cmd_print_float:
// XXX probably we should also check INTFLG here
// XXX provide implementation
// FALLTROUGH
cmd_print_next_arg:
// Look for the next argument
jsr end_of_statement_check
bcs cmd_print_new_line_done
cmp #$2C // comma XXX on C64 behavior is more complicated, fix it
beq cmd_print_after_comma
cmp #$3B // semicolon
beq cmd_print_done
bne cmd_print_loop
cmd_print_new_line_done:
jsr print_return
// FALLTROUGH
cmd_print_done:
jmp execute_statements
+10
View File
@@ -0,0 +1,10 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// REM statement just skips to the next line
cmd_rem:
jmp execute_statements_end_of_line
+27
View File
@@ -0,0 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_run:
// RUN clears all variables
jsr basic_do_clr
cmd_goto:
// Disable Kernal messages
lda #$00
jsr JSETMSG
// Reset line pointer to first line of program.
jsr init_oldtxt
jsr end_of_statement_check
bcs !+
jsr basic_parse_line_number
jsr basic_find_line
bcc !+
// Line does not exist, so report error
jmp do_UNDEFD_STATEMENT_error
!:
// Run it!
jmp execute_line
+43
View File
@@ -0,0 +1,43 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_save:
// Set default device and secondary address
jsr helper_load_init_params_no_VERCKB
// Fetch the file name
jsr helper_load_fetch_filename
bcs_16 do_MISSING_FILENAME_error
// Try to fetch device number and secondary address
jsr helper_load_fetch_devnum
bcs !+
jsr helper_load_fetch_secondary
!:
// Setup the start address
lda #TXTTAB
// Setup the end address
ldx VARTAB+0
ldy VARTAB+1
// FALLTROUGH
cmd_save_do: // entry point for BSAVE
// Perform saving
jsr JSAVE
bcs_16 do_kernal_error
// The end
jmp execute_statements
+30
View File
@@ -0,0 +1,30 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_stop:
jsr print_return
ldx #IDX__EV2_1E // "BREAK"
jsr print_packed_error
// Are we in direct mode
lda CURLIN+1
cmp #$FF
beq cmd_end
// Not direct mode
ldx #IDX__STR_IN
jsr print_packed_misc_str
lda CURLIN+1
ldx CURLIN+0
jsr print_integer
// FALLTROUGH
cmd_end:
jmp basic_main_loop
+73
View File
@@ -0,0 +1,73 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
cmd_sys:
jsr end_of_statement_check
bcc !+
// SYS requires an argument
jmp do_SYNTAX_error
!:
//
// XXX Temporary ugly hack to support 'SYS PI*656'
//
ldy #$00
cmd_sys_hack_loop:
lda (TXTPTR), y
cmp cmd_sys_hack_str, y
bne cmd_sys_hack_not_needed
lda (TXTPTR), y
beq cmd_sys_hack_apply
iny
bne cmd_sys_hack_loop // branch always
cmd_sys_hack_apply:
lda #<2060
sta LINNUM+0
lda #>2060
sta LINNUM+1
bne cmd_sys_setup_call // always jumps
cmd_sys_hack_not_needed:
//
// XXX End of hack
//
jsr basic_parse_line_number
cmd_sys_setup_call:
lda #$4C // JMP opcode
sta USRPOK
lda LINNUM+0
sta USRADD+0
lda LINNUM+1
sta USRADD+1
// Setup the register values
lda SPREG
pha
ldy SYREG
ldx SXREG
lda SAREG
plp
// Call the routine.
jsr USRPOK
jmp execute_statements
//
// XXX Temporary ugly hack to support 'SYS PI*656'
//
cmd_sys_hack_str:
.byte $FF, $AC, $36, $35, $36, $00
@@ -0,0 +1,20 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Tries to fetch device number - sets Carry if failure
//
helper_load_fetch_devnum:
// Fetch the device number
jsr fetch_coma_uint8
bcs !+
sta FA
!:
rts
@@ -0,0 +1,41 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Fetches file name, Carry set if not found
//
helper_load_fetch_filename:
// Check if end of statement
jsr end_of_statement_check
bcs !+
// Call the expression parser, make sure it returned a string
jsr FRMEVL
lda VALTYP
bpl_16 do_SYNTAX_error
// Set the filename address and pointer
lda __FAC1+0
sta FNLEN
lda __FAC1+1
sta FNADDR+0
lda __FAC1+2
sta FNADDR+1
// Mark success
clc
// FALLTROUGH
!:
rts
@@ -0,0 +1,20 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Tries to fetch secondary address - sets Carry if failure
//
helper_load_fetch_secondary:
// Fetch the device number
jsr fetch_coma_uint8
bcs !+
sta SA
!:
rts
@@ -0,0 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Sets initial parameters for LOAD and simiar commands
//
// Input:
// - VERCKB content in .A
//
helper_load_init_params:
// Set LOAD/VERIFY flag
sta VERCKB
// FALLTROUGH
helper_load_init_params_no_VERCKB:
// Set default device, set secondary address to 0
jsr select_device
ldy #$00 // secondary address
jmp JSETFLS
@@ -0,0 +1,15 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Set '*' as file name
//
helper_load_setnam_any:
lda #$01 // name length
ldx #<filename_any
ldy #>filename_any
jmp JSETNAM