90 files changed
+2439
-2221
No files matched your search
@@ -285,9 +285,9 @@ Feature needs about 330 bytes in BASIC segment. If unsure - enable.
|
||||
|
||||
### `CONFIG_TAPE_WEDGE`
|
||||
|
||||
If enabled, a simple DOS wedge is available from the direct mode for tape loading - supports `←L` only.
|
||||
If enabled, a simple DOS wedge is available from the direct mode for tape loading - supports `←L` (for `LOAD`) and `←M` (for `MERGE`), optionally with a file name.
|
||||
|
||||
Feature needs few bytes in BASIC segment. If unsure - enable.
|
||||
Feature needs several bytes in BASIC segment. If unsure - enable.
|
||||
|
||||
### `CONFIG_TAPE_HEAD_ALIGN`
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
|
||||
src/basic/basic_functions \
|
||||
src/basic/board_m65 \
|
||||
src/basic/board_x16 \
|
||||
src/basic/editor \
|
||||
src/basic/engine \
|
||||
src/basic/init \
|
||||
src/basic/math \
|
||||
@@ -28,7 +29,6 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
|
||||
src/basic/memory \
|
||||
src/basic/print \
|
||||
src/basic/rom_revision \
|
||||
src/basic/tokenizer \
|
||||
src/basic/wedge
|
||||
|
||||
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
|
||||
|
||||
@@ -12,7 +12,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
|
||||
* DOS wedge (direct mode only) - `@<drive_number>`, `@<command>`, `@$`, `@$<params>`, `@`
|
||||
* BASIC extensions, see the [documentation](doc/Extended-BASIC.md)
|
||||
|
||||
* turbo tape load support (as device 7, or using `←L`), quite sophisticated: up to 250 blocks (can store bytes under I/O), automatically adjusts for tape speed differences
|
||||
* turbo tape load support (as device 7, or using `←L` / `←M`, optionally with a file name), quite sophisticated: up to 250 blocks (can store bytes under I/O), automatically adjusts for tape speed differences
|
||||
* normal tape load error log is limited by free stack space only (no artificial limitation like in original ROMs)
|
||||
* tape format autodetection; normal vs turbo is mostly transparent to user
|
||||
* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators
|
||||
@@ -22,6 +22,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
|
||||
* start/end addresses are displayed, in the Final cartridge style
|
||||
* command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
|
||||
* command without parameters tries to load first file from drive chosen as above
|
||||
* `LIST` command should never damage the screen if trying to list memory content which is not a BASIC program
|
||||
|
||||
* uses RAM under ROM and I/O: 51199 bytes free (up to `$CFFF`) by default, but 61438 is also possible
|
||||
* cold/warm start silences multiple SID chips
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+43
-3
@@ -1,9 +1,45 @@
|
||||
|
||||
# Extended BASIC
|
||||
|
||||
NOTE: Command syntax, behaviour details, and tokens are still subject to change! In the future most (if not all) extended commands will be available only on machines with extended ROM, like the Mega65.
|
||||
NOTE: Command syntax, behaviour details, and tokens are still subject to change! Currently the availability of some depends on the build configuration, in the future most (if not all) extended commands will be available only on machines with extended ROM, like the Mega65 or Ultimate 64.
|
||||
|
||||
## Additional commands
|
||||
## DOS Wedge
|
||||
|
||||
The DOS Wedge commands are only available in direct mode, and they have to start from the first character of the line.
|
||||
|
||||
### `@`
|
||||
|
||||
Displays the error/status read from the current drive. Current drive is either the last device used by any I/O command, the one set by DOS Wedge command, or 8 as a fallback.
|
||||
|
||||
### `@$`
|
||||
|
||||
Displays the directory of the current drive. Does not destroy BASIC program in memory.
|
||||
|
||||
### `@device_number`
|
||||
|
||||
Changes the current drive number.
|
||||
|
||||
### `@command`
|
||||
|
||||
Sends the DOS command to the current drive.
|
||||
|
||||
## Tape Wedge
|
||||
|
||||
The Tape Wedge commands are only available in direct mode, and they have to start from the first character of the line.
|
||||
|
||||
### `←L ["file_name"]`
|
||||
|
||||
Loads the file from tape. Depending on the configuration, it tries to load the file in TurboTape 64 format, in the standard CBM format, or autodetects the file format.
|
||||
|
||||
### `←M ["file_name"]`
|
||||
|
||||
Like above, but merges a BASIC program to the one already stored in memory.
|
||||
|
||||
### `←H`
|
||||
|
||||
Launches a built-in tape head alignment tool. Destorys program in memory. Press `RUN/STOP` to terminate the tool.
|
||||
|
||||
## Additional BASIC commands
|
||||
|
||||
### `FAST`
|
||||
|
||||
@@ -13,9 +49,13 @@ Tries to switch the machine to turbo mode - details differ depending on the conf
|
||||
|
||||
Tries to switch the machine back to 1 MHz operation mode.
|
||||
|
||||
### `OLD`
|
||||
|
||||
Tries to restore program destroyed by `NEW` or a reset.
|
||||
|
||||
### `MERGE "file_name" [, device_number]`
|
||||
|
||||
Appends the BASIC program from a storage medium to the one currently present in memory. NOTE: due to bug in BASIC editor (improper VARTAB handling) it currently works only with programs loaded from the storage medium, not the ones typed in!
|
||||
Appends the BASIC program from a storage medium to the one currently present in memory.
|
||||
|
||||
### `BLOAD "file_name", device_number, start_address`
|
||||
|
||||
|
||||
@@ -32,19 +32,19 @@
|
||||
.label LASTPT = $17 // $17-$18 pointer to the last used slot in the temporary string descriptor
|
||||
.label TEMPST = $19 // $19-$21 temporary string stack descriptors
|
||||
.label INDEX = $22 // $22-$25 temporary variables, [!] our usage might be different
|
||||
.label RESHO = $26 // $26-$2A -- NOT IMPLEMENTED --
|
||||
.label RESHO = $26 // $26-$2A temporary variables, [!] our usage might be different
|
||||
.label TXTTAB = $2B // $2B-$2C start of BASIC code
|
||||
.label VARTAB = $2D // $2D-$2E end of BASIC code, start of variables
|
||||
.label ARYTAB = $2F // $2F-$30 -- NOT IMPLEMENTED --
|
||||
.label STREND = $31 // $31-$32 -- NOT IMPLEMENTED --
|
||||
.label FRETOP = $33 // $33-$34 -- NOT IMPLEMENTED --
|
||||
.label FRETOP = $33 // $33-$34 pointer to bottom of strings area
|
||||
.label FRESPC = $35 // $35-$36 [!] our implementation uses this as temporary string pointer
|
||||
.label MEMSIZ = $37 // $37-$38 highest address of BASIC memory + 1
|
||||
.label CURLIN = $39 // $39-$3A current BASIC line number
|
||||
.label OLDLIN = $3B // $3B-$3C previous BASIC line number
|
||||
.label OLDTXT = $3D // $3D-$3E current BASIC line pointer
|
||||
.label DATLIN = $3F // $3F-$40 -- NOT IMPLEMENTED --
|
||||
.label DATPTR = $41 // $41-$42 -- NOT IMPLEMENTED --
|
||||
.label DATPTR = $41 // $41-$42 pointer for READ/DATA copmmands
|
||||
.label INPPTR = $43 // $43-$44 -- NOT IMPLEMENTED --
|
||||
.label VARNAM = $45 // $45-$46 -- NOT IMPLEMENTED --
|
||||
.label VARPNT = $47 // $47-$48 -- NOT IMPLEMENTED --
|
||||
@@ -71,6 +71,12 @@
|
||||
.label FAC2_mantissa = $6A // $6A - $6D
|
||||
.label FAC2_sign = $6E
|
||||
|
||||
// We re-use FAC2 for memory move pointers, since we cannot be doing calculations while moving memory
|
||||
.label memmove__src = $69
|
||||
.label memmove__dst = $6B
|
||||
.label memmove__size = $6D
|
||||
|
||||
|
||||
.label ARISGN = $6F // -- NOT IMPLEMENTED --
|
||||
.label FACOV = $70 // FAC1 low order mantissa
|
||||
.label FBUFPT = $71 // $71-$72 -- NOT IMPLEMENTED --
|
||||
@@ -229,15 +235,15 @@
|
||||
// IRQs are disabled when doing such accesses, and a default NMI handler only increments
|
||||
// a counter, so that if an NMI occurs, it does not crash the machine, but can be captured.
|
||||
|
||||
.label missed_nmi_flag = $2A7
|
||||
.label tiny_nmi_handler = $2A8
|
||||
.label peek_under_roms = tiny_nmi_handler + peek_under_roms_routine - tiny_nmi_handler_routine
|
||||
.label poke_under_roms = tiny_nmi_handler + poke_under_roms_routine - tiny_nmi_handler_routine
|
||||
.label memmap_allram = tiny_nmi_handler + memmap_allram_routine - tiny_nmi_handler_routine
|
||||
.label memmap_normal = tiny_nmi_handler + memmap_normal_routine - tiny_nmi_handler_routine
|
||||
.label missed_nmi_flag = $2A7
|
||||
.label tiny_nmi_handler = $2A8
|
||||
.label peek_under_roms = tiny_nmi_handler + peek_under_roms_routine - tiny_nmi_handler_routine
|
||||
.label poke_under_roms = tiny_nmi_handler + poke_under_roms_routine - tiny_nmi_handler_routine
|
||||
.label memmap_allram = tiny_nmi_handler + memmap_allram_routine - tiny_nmi_handler_routine
|
||||
.label memmap_normal = tiny_nmi_handler + memmap_normal_routine - tiny_nmi_handler_routine
|
||||
#if SEGMENT_BASIC
|
||||
.label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine
|
||||
.label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine
|
||||
.label shift_mem_up_internal = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine
|
||||
.label shift_mem_down_internal = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
@@ -11,9 +11,3 @@
|
||||
.label __tokenise_work3 = $0B // COUNT
|
||||
.label __tokenise_work4 = $0F // GARBFL
|
||||
.label __tokenise_work5 = $0C // DIMFLG
|
||||
|
||||
// We re-use FAC2 for memory move pointers, since
|
||||
// we can't be doing calculations while moving memory
|
||||
.label __memmove_src = $69
|
||||
.label __memmove_dst = $6B
|
||||
.label __memmove_size = $6D
|
||||
@@ -10,6 +10,7 @@
|
||||
// print string routine
|
||||
|
||||
STROUT:
|
||||
|
||||
// Setup pointer
|
||||
sty FRESPC+1
|
||||
sta FRESPC+0
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// String - question mark in reverse
|
||||
|
||||
str_rev_question:
|
||||
|
||||
.byte $12, $3F, $92, $00
|
||||
@@ -27,8 +27,6 @@ cmd_let:
|
||||
nop
|
||||
cmd_if:
|
||||
nop
|
||||
cmd_restore:
|
||||
nop
|
||||
cmd_gosub:
|
||||
nop
|
||||
cmd_return:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
cmd_clr:
|
||||
|
||||
jsr basic_do_clr
|
||||
jsr do_clr
|
||||
|
||||
// CLR command does not stop execution (confirmed on a C64)
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ list_loop:
|
||||
// LIST terminates any running program,
|
||||
// because it has fiddled with the current line pointer.
|
||||
// (Confirmed by testing on a C64)
|
||||
jmp basic_main_loop
|
||||
jmp shell_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
|
||||
jsr follow_link_to_next_line
|
||||
jmp list_loop
|
||||
@@ -56,7 +56,7 @@ cmd_load_no_error:
|
||||
|
||||
// C64 BASIC apparently does not clear variables after a LOAD in the
|
||||
// middle of a program. For safety, we do.
|
||||
jsr basic_do_clr
|
||||
jsr do_clr
|
||||
|
||||
// Now relink the loaded program, as we cannot trust the line
|
||||
// links supplied. For example, the VICE virtual drive emulation
|
||||
@@ -80,4 +80,4 @@ cmd_load_no_error:
|
||||
|
||||
cmd_load_end:
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
cmd_new:
|
||||
|
||||
jsr basic_do_new
|
||||
jsr do_new
|
||||
|
||||
// NEW command terminates execution (confirmed on a C64)
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -0,0 +1,12 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
cmd_restore:
|
||||
|
||||
jsr do_restore
|
||||
|
||||
// RESTORE command does not stop execution (confirmed on a C64)
|
||||
|
||||
jmp execute_statements
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
cmd_run:
|
||||
// RUN clears all variables
|
||||
jsr basic_do_clr
|
||||
jsr do_clr
|
||||
cmd_goto:
|
||||
// Disable Kernal messages
|
||||
lda #$00
|
||||
@@ -18,7 +18,7 @@ cmd_goto:
|
||||
bcs !+
|
||||
|
||||
jsr basic_parse_line_number
|
||||
jsr basic_find_line
|
||||
jsr find_line
|
||||
bcc !+
|
||||
// Line does not exist, so report error
|
||||
jmp do_UNDEFD_STATEMENT_error
|
||||
|
||||
@@ -27,4 +27,4 @@ cmd_stop:
|
||||
|
||||
cmd_end:
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
cmd_bload,
|
||||
cmd_bsave,
|
||||
cmd_bverify
|
||||
cmd_bverify,
|
||||
|
||||
cmd_old
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -39,4 +39,4 @@ cmd_bload:
|
||||
|
||||
// XXX when number parsing is done, change to continue execution
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -16,9 +16,15 @@ cmd_merge:
|
||||
|
||||
jsr helper_load_fetch_devnum
|
||||
|
||||
// Perform loading - just for a different address
|
||||
// FALLTROUGH
|
||||
|
||||
// XXX sometimes works, sometimes does not - probably improper handling of VARTAB somewhere
|
||||
cmd_merge_got_params:
|
||||
|
||||
// Make sure VARTAB is correctly set
|
||||
|
||||
jsr update_VARTAB_do_clr
|
||||
|
||||
// Perform loading - just for a different address
|
||||
|
||||
sec
|
||||
lda VARTAB+0
|
||||
@@ -36,18 +42,10 @@ cmd_merge:
|
||||
|
||||
cmd_merge_no_error:
|
||||
|
||||
// Store last loaded address
|
||||
// Relink loaded program, clear variables
|
||||
|
||||
stx VARTAB+0
|
||||
sty VARTAB+1
|
||||
|
||||
// Clear the variables
|
||||
jsr basic_do_clr
|
||||
|
||||
// Now relink the loaded program, line links supplied are almost certainly wrong
|
||||
|
||||
jsr LINKPRG
|
||||
jsr update_LINKPRG_VARTAB_do_clr
|
||||
|
||||
// XXX when number parsing is done, change to continue execution
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -0,0 +1,24 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
cmd_old:
|
||||
|
||||
// First make sure we are in direct mode
|
||||
|
||||
ldx CURLIN+1
|
||||
inx
|
||||
bne_16 do_DIRECT_MODE_ONLY_error
|
||||
|
||||
// Now try to restore program linkage and VARTAB
|
||||
|
||||
ldy #$01
|
||||
tya
|
||||
sta (TXTTAB),y
|
||||
|
||||
jsr update_LINKPRG_VARTAB_do_clr
|
||||
|
||||
// Quit
|
||||
|
||||
jmp shell_main_loop
|
||||
@@ -1,99 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
basic_do_new:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__basic_do_new
|
||||
jmp map_NORMAL
|
||||
|
||||
basic_do_clr:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__basic_do_clr
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
// Setup pointers to memory storage XXX should depend on text start vector
|
||||
lda #<$0801
|
||||
sta TXTTAB+0
|
||||
lda #>$0801
|
||||
sta TXTTAB+1
|
||||
sta VARTAB+1
|
||||
lda #<$0803
|
||||
sta VARTAB+0
|
||||
|
||||
// Zero line pointer
|
||||
// XXX - We should also zero $0800, i.e., TXTTAB - 1
|
||||
ldy #$00
|
||||
tya
|
||||
sta (TXTTAB),y
|
||||
iny
|
||||
sta (TXTTAB),y
|
||||
|
||||
|
||||
// Get top of memory.
|
||||
// If a cart is present, then it is $7FFF,
|
||||
// if not, then it is $F7FF, since we support having
|
||||
// programs and variables under ROM.
|
||||
// i.e., we support 56KB RAM for BASIC, keeping some space
|
||||
// free for some optimisation structures, e.g., FOR/NEXT loop
|
||||
// records (without them going on the stack), GOSUB stack
|
||||
// (same story), expression value cache?
|
||||
|
||||
sec // Read, not write value
|
||||
jsr JMEMTOP
|
||||
cpx #$80
|
||||
beq !+
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#elif CONFIG_MEMORY_MODEL_50K
|
||||
lda #>$D000
|
||||
#elif CONFIG_MEMORY_MODEL_46K
|
||||
lda #>$C000
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
skip_2_bytes_trash_nvz
|
||||
!:
|
||||
lda #>$8000
|
||||
sta MEMSIZ+1
|
||||
sta FRETOP+1
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
cpx #$80
|
||||
beq !+
|
||||
lda #$FF
|
||||
skip_2_bytes_trash_nvz
|
||||
!:
|
||||
lda #<$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
lda #<$00
|
||||
#endif
|
||||
sta MEMSIZ+0
|
||||
sta FRETOP+0
|
||||
|
||||
// FALLTHROUGH
|
||||
|
||||
basic_do_clr:
|
||||
|
||||
// XXX shouldnt FRETOP go here?
|
||||
|
||||
// Clear variables, arrays and strings
|
||||
|
||||
lda VARTAB+0
|
||||
sta ARYTAB+0
|
||||
sta STREND+0
|
||||
lda VARTAB+1
|
||||
sta ARYTAB+1
|
||||
sta STREND+1
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -1,35 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// Advance OLDTXT by following the
|
||||
// link to the next line
|
||||
|
||||
basic_find_next_line:
|
||||
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
pha
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sta OLDTXT+1
|
||||
pla
|
||||
sta OLDTXT+0
|
||||
rts
|
||||
@@ -1,179 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
basic_shift_mem_down_and_relink:
|
||||
// Shift memory down to basic_current_line_pointer
|
||||
// from X bytes further along.
|
||||
|
||||
// Destination is OLDTXT
|
||||
lda OLDTXT+0
|
||||
sta __memmove_dst+0
|
||||
lda OLDTXT+1
|
||||
sta __memmove_dst+1
|
||||
|
||||
// Source is that plus X
|
||||
txa
|
||||
pha // also keep for later
|
||||
clc
|
||||
adc OLDTXT+0
|
||||
sta __memmove_src+0
|
||||
lda OLDTXT+1
|
||||
adc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
// Size is distance from source to end of BASIC text.
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc __memmove_src+0
|
||||
sta __memmove_size+0
|
||||
lda VARTAB+1
|
||||
sbc __memmove_src+1
|
||||
sta __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "TOP OF BASIC = $"
|
||||
// .byte $f1,<VARTAB,>VARTAB
|
||||
// .byte $f0,<VARTAB,>VARTAB
|
||||
// .byte $0d
|
||||
// .text "SHIFTING DOWN $"
|
||||
// .byte $f1,<__memmove_size,>__memmove_size
|
||||
// .byte $f0,<__memmove_size,>__memmove_size
|
||||
// .text " BYTES FROM $"
|
||||
// .byte $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .text " TO $"
|
||||
// .byte $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .byte $0d,0
|
||||
|
||||
// The copy routine that copies under the ROMs is as simple
|
||||
// as possible to be as small as possible, so we have
|
||||
// to adjust the pointers and counts so that the simple
|
||||
// increment and decrement bounds checks work.
|
||||
|
||||
// Specifically we want Y pre-set so that the end of the
|
||||
// copy ends when Y = $00.
|
||||
// So if copying 1 byte, we want Y=$FF
|
||||
// This means we have to then reduce the source and
|
||||
// target pointers by the same amount
|
||||
|
||||
lda __memmove_size+0
|
||||
eor #$ff
|
||||
sta __tokenise_work3
|
||||
sta __memmove_size+0
|
||||
|
||||
lda __memmove_src+0
|
||||
sec
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
lda __memmove_src+1
|
||||
sbc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta __memmove_dst+1
|
||||
|
||||
// Increase copy page count so we can post-decrement compare with $00
|
||||
inc __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "REVISED BOUNDS $"
|
||||
// .byte $f1,<__memmove_size,>__memmove_size
|
||||
// .byte $f0,<__memmove_size,>__memmove_size
|
||||
// .text " BYTES FROM $"
|
||||
// .byte $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .text " TO $"
|
||||
// .byte $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .byte $0d,0
|
||||
|
||||
// Get Y value ready for the copy
|
||||
ldy __memmove_size+0
|
||||
|
||||
jsr shift_mem_down
|
||||
|
||||
// Get length of deletion back
|
||||
pla
|
||||
sta __tokenise_work3
|
||||
|
||||
// Check if we still have any lines left
|
||||
ldy #0
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_down_next_line
|
||||
// Nope, so just return
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
relink_down_next_line:
|
||||
// inc $d020
|
||||
// jmp relink_down_next_line
|
||||
|
||||
// Subtract __tokenise_work3 from the pointer
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sec
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sbc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
ldy #0
|
||||
lda __memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda __memmove_src+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
relink_down_loop:
|
||||
// Now advance pointer to the next line,
|
||||
lda __memmove_src+0
|
||||
sta OLDTXT+0
|
||||
lda __memmove_src+1
|
||||
sta OLDTXT+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_down_next_line
|
||||
|
||||
clc
|
||||
rts
|
||||
@@ -1,211 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
basic_shift_mem_up_and_relink:
|
||||
// Shift memory up from OLDTXT
|
||||
// X bytes.
|
||||
|
||||
// NOTE: Pointers need to be reduced by one, due to the way
|
||||
// the copyroutine works, so we do that here.
|
||||
// Work out end point of destination
|
||||
txa
|
||||
clc
|
||||
adc VARTAB+0
|
||||
sta __memmove_dst+0
|
||||
lda VARTAB+1
|
||||
adc #0
|
||||
sta __memmove_dst+1
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc #1
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta __memmove_dst+1
|
||||
|
||||
// End point of source is just current end of BASIC text
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc #1
|
||||
sta __memmove_src+0
|
||||
lda VARTAB+1
|
||||
sbc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
// Work out size of region to copy
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc OLDTXT+0
|
||||
sta __memmove_size+0
|
||||
lda VARTAB+1
|
||||
sbc OLDTXT+1
|
||||
sta __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "TOP OF BASIC = $"
|
||||
// .byte $f1,<VARTAB,>VARTAB
|
||||
// .byte $f0,<VARTAB,>VARTAB
|
||||
// .byte $0d
|
||||
// .text "SHIFTING UP $"
|
||||
// .byte $f1,<__memmove_size,>__memmove_size
|
||||
// .byte $f0,<__memmove_size,>__memmove_size
|
||||
// .text " BYTES FROM $"
|
||||
// .byte $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .text " TO $"
|
||||
// .byte $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .byte $0d,0
|
||||
|
||||
// To make life simple for the copy routine that lives in RAM,
|
||||
// we have to adjust the end pointers down one page and set Y to the low
|
||||
// byte of the copy size.
|
||||
lda __memmove_src+0
|
||||
sec
|
||||
sbc __memmove_size+0
|
||||
sta __memmove_src+0
|
||||
lda __memmove_src+1
|
||||
sbc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc __memmove_size+0
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta __memmove_dst+1
|
||||
|
||||
// Now make exit easy, by being able to check for zero on size high byte when done
|
||||
inc __memmove_size+1
|
||||
|
||||
// Then set Y to the number offset required
|
||||
ldy __memmove_size+0
|
||||
iny
|
||||
|
||||
stx __tokenise_work3
|
||||
|
||||
// jsr printf
|
||||
// .text "REVISED BOUNDS $"
|
||||
// .byte $f1,<__memmove_size,>__memmove_size
|
||||
// .byte $f0,<__memmove_size,>__memmove_size
|
||||
// .text " BYTES FROM $"
|
||||
// .byte $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .text " TO $"
|
||||
// .byte $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .byte $0d,0
|
||||
|
||||
// Do the copy
|
||||
jsr shift_mem_up
|
||||
|
||||
// Now fix the pointer to the next line
|
||||
|
||||
// First, we need to point the current BASIC line
|
||||
// pointer to itself, so that we can add the shift
|
||||
// to make it end up pointing to the next line
|
||||
ldy #0
|
||||
|
||||
lda OLDTXT+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda OLDTXT+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
relink_up_next_line:
|
||||
// inc $d020
|
||||
// jmp relink_up_next_line
|
||||
|
||||
// Advance pointer by tokenise_word3 bytes
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr peek_under_roms
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sta __memmove_dst+0
|
||||
clc
|
||||
adc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
iny
|
||||
php
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#elif CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
jsr peek_under_roms_via_OLDTXT
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sta __memmove_dst+1
|
||||
plp
|
||||
adc #0
|
||||
sta __memmove_src+1
|
||||
|
||||
// jsr printf
|
||||
// .text "LINE ADDR = $"
|
||||
// .byte $f1,<OLDTXT,>VARTAB
|
||||
// .byte $f0,<OLDTXT,>VARTAB
|
||||
// .text $d," BEFORE = $"
|
||||
// .byte $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .text ", AFTER = $"
|
||||
// .byte $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .byte $d
|
||||
// .byte 0
|
||||
|
||||
// Write __memmove_src back to current line pointer
|
||||
ldy #0
|
||||
lda __memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda __memmove_src+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
relink_up_loop:
|
||||
// Now advance pointer to the next line,
|
||||
lda __memmove_src+0
|
||||
sta OLDTXT+0
|
||||
lda __memmove_src+1
|
||||
sta OLDTXT+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs relink_up_next_line
|
||||
|
||||
rts
|
||||
@@ -17,8 +17,9 @@
|
||||
.label VB1__list_single_line = $4000 + 2 * 3
|
||||
.label VB1__print_packed_error = $4000 + 2 * 4
|
||||
.label VB1__print_packed_misc_str = $4000 + 2 * 5
|
||||
.label VB1__basic_do_clr = $4000 + 2 * 6
|
||||
.label VB1__basic_do_new = $4000 + 2 * 7
|
||||
.label VB1__do_new = $4000 + 2 * 6
|
||||
.label VB1__do_clr = $4000 + 2 * 7
|
||||
.label VB1__do_restore = $4000 + 2 * 8
|
||||
|
||||
#else
|
||||
|
||||
@@ -30,7 +31,8 @@
|
||||
.word list_single_line
|
||||
.word print_packed_error
|
||||
.word print_packed_misc_str
|
||||
.word basic_do_clr
|
||||
.word basic_do_new
|
||||
.word do_new
|
||||
.word do_clr
|
||||
.word do_restore
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,7 @@
|
||||
.label peek_via_OLDTXT = BASIC_0.proxy_B1_peek_via_OLDTXT
|
||||
.label poke_via_OLDTXT = BASIC_0.proxy_B1_poke_via_OLDTXT
|
||||
.label JCHROUT = BASIC_0.proxy_B1_JCHROUT
|
||||
.label JCLALL = BASIC_0.proxy_B1_JCLALL
|
||||
.label JMEMTOP = KERNAL_0.JMEMTOP
|
||||
.label plot_set = KERNAL_0.plot_set
|
||||
.label init_oldtxt = BASIC_0.init_oldtxt
|
||||
@@ -22,3 +23,4 @@
|
||||
.label print_features = BASIC_0.proxy_B1_print_features
|
||||
#endif
|
||||
.label do_STRING_TOO_LONG_error = BASIC_0.do_STRING_TOO_LONG_error
|
||||
.label str_rev_question = BASIC_0.str_rev_question
|
||||
@@ -30,6 +30,13 @@ proxy_B1_poke_via_OLDTXT:
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_JCLALL:
|
||||
|
||||
jsr map_NORMAL
|
||||
jsr JCLALL
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
proxy_B1_JCHROUT:
|
||||
|
||||
jsr map_NORMAL
|
||||
@@ -57,6 +64,7 @@ proxy_B1_print_space:
|
||||
jsr print_space
|
||||
jmp map_BASIC_1
|
||||
|
||||
|
||||
#if CONFIG_SHOW_FEATURES
|
||||
|
||||
proxy_B1_print_features:
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -2,14 +2,12 @@
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
// Delete the current BASIC line, which is assumed to have already
|
||||
// been found with basic_find_line.
|
||||
// Really only consists of copying memory down.
|
||||
// The only complication is that we have to do the copy with ROMs
|
||||
// banked out. Oh, yes, and we have to update all the links in
|
||||
// the following basic lines.
|
||||
//
|
||||
// Delete the current BASIC line, which is assumed to have already been found with find_line.
|
||||
// Consists of copying memory down and lline linkage update.
|
||||
//
|
||||
|
||||
basic_delete_line:
|
||||
delete_line:
|
||||
|
||||
// jsr printf
|
||||
// .text "DELETING LINE AT $"
|
||||
@@ -18,7 +16,7 @@ basic_delete_line:
|
||||
// .byte $0d,0
|
||||
|
||||
// Get address of next line
|
||||
ldy #0
|
||||
ldy #$00
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT
|
||||
@@ -61,30 +59,20 @@ basic_delete_line:
|
||||
sbc #0
|
||||
cmp #$00
|
||||
beq !+
|
||||
|
||||
// Line length is <0 or >255 bytes.
|
||||
// Either way, things are bad, so abort.
|
||||
|
||||
jmp do_MEMORY_CORRUPT_error
|
||||
!:
|
||||
// Length can now be safely assumed to be in the low
|
||||
// byte only, i.e., stored in __tokenise_work3
|
||||
|
||||
lda __tokenise_work3
|
||||
pha
|
||||
tax
|
||||
ldx __tokenise_work3
|
||||
|
||||
// Shuffle everything down
|
||||
jsr basic_shift_mem_down_and_relink
|
||||
jsr shift_txt_down
|
||||
|
||||
// Now decrease top of BASIC mem
|
||||
pla
|
||||
sta __tokenise_work3
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc __tokenise_work3
|
||||
sta VARTAB+0
|
||||
lda VARTAB+1
|
||||
sbc #0
|
||||
sta VARTAB+1
|
||||
// Finish by fixing program linkage and calculating new
|
||||
|
||||
clc
|
||||
rts
|
||||
jmp update_LINKPRG_VARTAB_do_clr
|
||||
@@ -5,19 +5,30 @@
|
||||
|
||||
// Find the BASIC line with number LINNUM
|
||||
|
||||
// XXX it should be possible to start from the current line (OLDTXT), or from the startup,
|
||||
// depending on the current and target line number
|
||||
|
||||
|
||||
find_line:
|
||||
|
||||
basic_find_line:
|
||||
// Get pointer to start of BASIC text
|
||||
lda TXTTAB+0
|
||||
sta OLDTXT+0
|
||||
lda TXTTAB+1
|
||||
sta OLDTXT+1
|
||||
|
||||
basic_find_line_loop:
|
||||
// Then search for line number
|
||||
// Line number
|
||||
|
||||
ldy #3
|
||||
// FALLTROUGH
|
||||
|
||||
find_line_loop:
|
||||
|
||||
// Check if line is not empty
|
||||
|
||||
jsr peek_line_pointer_null_check
|
||||
bcc find_line_fail
|
||||
|
||||
|
||||
// Fetch the high byte of line number and compare
|
||||
ldy #$03
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
@@ -30,10 +41,11 @@ basic_find_line_loop:
|
||||
|
||||
cmp LINNUM+1
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
bcs find_line_fail // branch if line number too high
|
||||
bne find_line_next
|
||||
!:
|
||||
|
||||
|
||||
// Fetch the low byte of line number and compare
|
||||
dey
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -45,27 +57,23 @@ basic_find_line_loop:
|
||||
#endif
|
||||
|
||||
cmp LINNUM+0
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
!:
|
||||
beq find_line_success
|
||||
bcs find_line_fail // branch if line number too high
|
||||
bne find_line_next
|
||||
|
||||
find_line_success:
|
||||
|
||||
clc
|
||||
rts
|
||||
not_this_line:
|
||||
// Not this line, so advance to next line
|
||||
|
||||
find_line_next:
|
||||
|
||||
// Advance to the next line
|
||||
|
||||
jsr peek_line_pointer_null_check
|
||||
bcs more_lines_exist
|
||||
bcc find_line_fail // branch in no more lines exist
|
||||
|
||||
// no more lines exist, return failure
|
||||
line_num_too_high:
|
||||
sec
|
||||
rts
|
||||
more_lines_exist:
|
||||
|
||||
// XXX - Add program mangled check here to be triggered
|
||||
// if the link goes backwards.
|
||||
// Follow link to next line
|
||||
ldy #0
|
||||
ldy #$00
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
@@ -76,7 +84,7 @@ more_lines_exist:
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
sta $0100
|
||||
pha
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -88,7 +96,16 @@ more_lines_exist:
|
||||
#endif
|
||||
|
||||
sta OLDTXT+1
|
||||
lda $0100
|
||||
pla
|
||||
sta OLDTXT+0
|
||||
|
||||
jmp basic_find_line_loop
|
||||
#if HAS_OPCODES_65C02
|
||||
bra find_line_loop
|
||||
#else
|
||||
jmp find_line_loop
|
||||
#endif
|
||||
|
||||
find_line_fail:
|
||||
|
||||
sec
|
||||
rts
|
||||
@@ -2,23 +2,18 @@
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Insert the tokenised line stored at $0200.
|
||||
// First work out where in the list to put it
|
||||
// (basic_find_line with the line number can be used to work
|
||||
// out the insertion point, as it should abort once it finds a
|
||||
// line number too high).
|
||||
//
|
||||
// First work out where in the list to put it (find_line with the line number can be used to work
|
||||
// out the insertion point, as it should abort once it finds a line number too high).
|
||||
// Then all we have to do is push the rest of the BASIC text up,
|
||||
// and update the pointers in all following basic lines.
|
||||
//
|
||||
|
||||
basic_insert_line:
|
||||
insert_line:
|
||||
|
||||
// ASSUMES basic_find_line has been called to set the insert point.
|
||||
// We need to insert space for the link link token, the line number,
|
||||
// and the zero-terminated line itself. This means 2+2+1 plus length
|
||||
// of tokenised string after the line number
|
||||
|
||||
// But first, remember where the pointer will be, so that we can
|
||||
// put the line in there after.
|
||||
// ASSUMES find_line has been called to set the insert point.
|
||||
|
||||
// jsr printf
|
||||
// .text "INSERTING LINE AT $"
|
||||
@@ -26,43 +21,22 @@ basic_insert_line:
|
||||
// .byte $f0,<OLDTXT,>OLDTXT
|
||||
// .byte $0d,0
|
||||
|
||||
lda OLDTXT+0
|
||||
pha
|
||||
lda OLDTXT+1
|
||||
|
||||
pha
|
||||
|
||||
// Get number of bytes in tokenised line after line number
|
||||
lda __tokenise_work2
|
||||
sec
|
||||
sbc __tokenise_work1
|
||||
// Add on the four bytes space we need
|
||||
|
||||
// Add on the five bytes space we need (2 bytes for linkage, 2 bytes for line number, 1 byte for terminator)
|
||||
clc
|
||||
adc #5
|
||||
pha
|
||||
adc #$05
|
||||
tax
|
||||
|
||||
|
||||
// Make the space
|
||||
jsr basic_shift_mem_up_and_relink
|
||||
jsr shift_txt_up
|
||||
|
||||
// Now increase top of BASIC mem
|
||||
pla
|
||||
clc
|
||||
adc VARTAB+0
|
||||
sta VARTAB+0
|
||||
lda VARTAB+1
|
||||
adc #0
|
||||
sta VARTAB+1
|
||||
|
||||
// Get pointer back
|
||||
pla
|
||||
sta OLDTXT+1
|
||||
pla
|
||||
sta OLDTXT+0
|
||||
|
||||
// Write the line number
|
||||
ldy #2
|
||||
lda LINNUM+0
|
||||
// Put dummy linkage, we will correct it later
|
||||
ldy #$01
|
||||
tya
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<OLDTXT+0
|
||||
@@ -71,6 +45,16 @@ basic_insert_line:
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
// Put the line number
|
||||
iny
|
||||
lda LINNUM+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
sta (OLDTXT),y
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda LINNUM+1
|
||||
|
||||
@@ -82,7 +66,7 @@ basic_insert_line:
|
||||
|
||||
// Now store the line body itself
|
||||
inc __tokenise_work2
|
||||
line_store_loop:
|
||||
!:
|
||||
ldx __tokenise_work1
|
||||
lda $0200,x
|
||||
inc __tokenise_work1
|
||||
@@ -97,8 +81,13 @@ line_store_loop:
|
||||
|
||||
lda __tokenise_work1
|
||||
cmp __tokenise_work2
|
||||
bne line_store_loop
|
||||
dec __tokenise_work2
|
||||
|
||||
clc
|
||||
rts
|
||||
bne !-
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
update_LINKPRG_VARTAB_do_clr:
|
||||
|
||||
// Finish by fixing program linkage and calculating new VARTAB
|
||||
|
||||
jsr LINKPRG
|
||||
jmp update_VARTAB_do_clr
|
||||
@@ -3,7 +3,7 @@
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
basic_main_loop:
|
||||
shell_main_loop:
|
||||
|
||||
// Tell user we are ready
|
||||
ldx #IDX__STR_READY
|
||||
@@ -13,87 +13,110 @@ basic_main_loop:
|
||||
lda #$80
|
||||
jsr JSETMSG
|
||||
|
||||
basic_read_next_line:
|
||||
shell_read_next_line:
|
||||
|
||||
// Read a line of input
|
||||
ldx #$00
|
||||
read_line_loop:
|
||||
!:
|
||||
jsr JCHRIN
|
||||
bcs read_line_loop
|
||||
bcs !-
|
||||
|
||||
cmp #$0d
|
||||
beq got_line_of_input
|
||||
// Check for RETURN key
|
||||
cmp #$0D
|
||||
beq shell_got_line
|
||||
|
||||
// Not carriage return, so try to append to line so far
|
||||
cpx #80
|
||||
bcs_16 do_STRING_TOO_LONG_error // see Computes Mapping the 64 p93
|
||||
bcs_16 do_STRING_TOO_LONG_error // see Computes Mapping the 64 p93
|
||||
|
||||
sta BUF,x
|
||||
inx
|
||||
jmp read_line_loop
|
||||
jmp !-
|
||||
|
||||
got_line_of_input:
|
||||
shell_got_line:
|
||||
|
||||
// Store length of input buffer ready for tokenising
|
||||
stx __tokenise_work1
|
||||
|
||||
// Store 0 as the sentinel
|
||||
lda #$00
|
||||
sta BUF, x
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
shell_strip_leading_spaces:
|
||||
|
||||
// Strip leading spaces from the line
|
||||
remove_leading_spaces:
|
||||
lda BUF
|
||||
cmp #$20
|
||||
bne !+
|
||||
ldx #1
|
||||
rsl_l1:
|
||||
bne shell_process_line // branch if no more leading spaces
|
||||
|
||||
// We have a leading space - strip it away
|
||||
ldx #$01
|
||||
!:
|
||||
lda BUF,x
|
||||
sta BUF-1,x
|
||||
inx
|
||||
cpx __tokenise_work1
|
||||
bne rsl_l1
|
||||
bne !-
|
||||
|
||||
// Reduce length of input by one
|
||||
dec __tokenise_work1
|
||||
|
||||
// Stop trying to rim if we run out of input
|
||||
bne remove_leading_spaces
|
||||
!:
|
||||
// Do printing of the new line
|
||||
bne shell_strip_leading_spaces
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
shell_process_line:
|
||||
|
||||
// Print a new line
|
||||
jsr print_return
|
||||
|
||||
// Ignore empty lines
|
||||
lda __tokenise_work1
|
||||
beq basic_read_next_line
|
||||
beq shell_read_next_line
|
||||
|
||||
// Check if a wedge should take over
|
||||
|
||||
#if CONFIG_DOS_WEDGE
|
||||
|
||||
ldx __tokenise_work1 // size of the input, DOS wedges needs this XXX this should not be needed
|
||||
|
||||
#endif
|
||||
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE
|
||||
|
||||
ldx __tokenise_work1 // here is the size of input
|
||||
|
||||
// Check if DOS wedge should take over
|
||||
lda BUF
|
||||
|
||||
#if CONFIG_DOS_WEDGE
|
||||
|
||||
cmp #$40 // '@'
|
||||
beq_16 wedge_dos
|
||||
|
||||
#endif
|
||||
#if CONFIG_TAPE_WEDGE
|
||||
|
||||
cmp #$5F // left arrow
|
||||
beq_16 wedge_tape
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Else, tokenise the line
|
||||
// Tokenise the line
|
||||
jsr tokenise_line
|
||||
|
||||
// Has the user entered a line of BASIC beginning with a number?
|
||||
lda BUF
|
||||
cmp #$30
|
||||
bcc not_a_line
|
||||
bcc shell_execute_line
|
||||
cmp #$39
|
||||
bcs not_a_line
|
||||
bcs shell_execute_line
|
||||
|
||||
// Yes, the line begins with a number.
|
||||
// Parse the line number and check validity
|
||||
// Yes, the line begins with a number - parse it and check validity
|
||||
|
||||
// injest_number follows __tokenise_work1 as the offset into the line,
|
||||
// The injest_number follows __tokenise_work1 as the offset into the line,
|
||||
// so remember the line length somewhere else for now.
|
||||
lda __tokenise_work1
|
||||
sta __tokenise_work2
|
||||
@@ -112,62 +135,47 @@ rsl_l1:
|
||||
lda TXTPTR+0
|
||||
sta __tokenise_work1
|
||||
|
||||
// Got a valid line number -- so do add/del line
|
||||
// Got a valid line number - we will be adding/deleting a new line
|
||||
|
||||
// Skip any spaces after the line number
|
||||
ldx __tokenise_work1
|
||||
skip_spaces:
|
||||
!:
|
||||
lda BUF,x
|
||||
cmp #$20
|
||||
bne !+
|
||||
inx
|
||||
bne skip_spaces
|
||||
!: stx __tokenise_work1
|
||||
bne !-
|
||||
!:
|
||||
stx __tokenise_work1
|
||||
|
||||
// First, clear all variables, so that we only have to shove BASIC text around.
|
||||
// (We could later remove this requirement, and the only effect should be
|
||||
// to slow things down, and that you might have to either CLR if there is no
|
||||
// memory free, or else it would auto CLR when you ran out of program space).
|
||||
jsr basic_do_clr
|
||||
// FALLTROUGH
|
||||
|
||||
// Delete line if present
|
||||
jsr basic_find_line
|
||||
shell_add_delete_line:
|
||||
|
||||
// First make sure VARTAB is correct and clear all the variables
|
||||
jsr update_VARTAB_do_clr
|
||||
|
||||
// Check if line already present
|
||||
jsr find_line
|
||||
bcs !+
|
||||
|
||||
// Delete the line, whether we are deleting or
|
||||
// replacing the line
|
||||
jsr basic_delete_line
|
||||
// Line already present - delete it
|
||||
jsr delete_line
|
||||
jsr find_line // refresh OLDTXT
|
||||
!:
|
||||
// Insert new line if non-zero length, i.e., that
|
||||
// we are not just deleting the line.
|
||||
lda __tokenise_work1
|
||||
cmp __tokenise_work2
|
||||
beq !+
|
||||
jsr basic_insert_line
|
||||
jsr insert_line
|
||||
!:
|
||||
// No READY message after entering or deleting a line of BASIC
|
||||
jmp basic_read_next_line
|
||||
jmp shell_read_next_line
|
||||
|
||||
not_a_line:
|
||||
|
||||
// Actually interpret the line
|
||||
|
||||
// Setup pointer to the statement
|
||||
lda #<BUF
|
||||
sta TXTPTR+0
|
||||
lda #>BUF
|
||||
sta TXTPTR+1
|
||||
|
||||
// There is no stored line, so zero that pointer out
|
||||
lda #$00
|
||||
sta OLDTXT+0
|
||||
sta OLDTXT+1
|
||||
|
||||
// Put invalid line number in current line number value,
|
||||
// so that we know we are in direct mode
|
||||
// (Computes Mapping the 64 p19)
|
||||
lda #$FF
|
||||
sta CURLIN+1
|
||||
shell_execute_line:
|
||||
|
||||
jsr prepare_direct_execution
|
||||
jmp execute_statements
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
//
|
||||
// Shift the BASIC program down to cover the area of removed line
|
||||
//
|
||||
|
||||
|
||||
shift_txt_down:
|
||||
|
||||
// First byte of destination is OLDTXT
|
||||
|
||||
lda OLDTXT+0
|
||||
sta memmove__dst+0
|
||||
lda OLDTXT+1
|
||||
sta memmove__dst+1
|
||||
|
||||
// First byte of source is memmove__dst + .X
|
||||
|
||||
clc
|
||||
txa
|
||||
|
||||
adc memmove__dst+0
|
||||
sta memmove__src+0
|
||||
lda memmove__dst+1
|
||||
adc #$00
|
||||
sta memmove__src+1
|
||||
|
||||
// Size is distance from source to the end of BASIC text (VARTAB)
|
||||
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc memmove__src+0
|
||||
sta memmove__size+0
|
||||
lda VARTAB+1
|
||||
sbc memmove__src+1
|
||||
sta memmove__size+1
|
||||
|
||||
// Perform the copy
|
||||
|
||||
jmp shift_mem_down
|
||||
@@ -0,0 +1,58 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
//
|
||||
// Shift the BASIC program up to make space for a new line
|
||||
//
|
||||
|
||||
|
||||
shift_txt_up:
|
||||
|
||||
// Last byte of source is VARTAB-1
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
|
||||
sec
|
||||
lda VARTAB+0
|
||||
sbc #$01
|
||||
sta memmove__src+0
|
||||
lda VARTAB+1
|
||||
sbc #$00
|
||||
sta memmove__src+1
|
||||
|
||||
#else // HAS_OPCODES_65CE02
|
||||
|
||||
lda VARTAB+0
|
||||
sta memmove__src+0
|
||||
lda VARTAB+1
|
||||
sta memmove__src+1
|
||||
dew memmove__src
|
||||
|
||||
#endif
|
||||
|
||||
// Last byte of destination is memmove__src + .X
|
||||
|
||||
clc
|
||||
txa
|
||||
|
||||
adc memmove__src+0
|
||||
sta memmove__dst+0
|
||||
lda memmove__src+1
|
||||
adc #$00
|
||||
sta memmove__dst+1
|
||||
|
||||
// Size is distance from OLDTXT to the end of BASIC text (VARTAB)
|
||||
|
||||
lda VARTAB+0
|
||||
sec
|
||||
sbc OLDTXT+0
|
||||
sta memmove__size+0
|
||||
lda VARTAB+1
|
||||
sbc OLDTXT+1
|
||||
sta memmove__size+1
|
||||
|
||||
// Perform the copy
|
||||
|
||||
jmp shift_mem_up
|
||||
@@ -18,6 +18,15 @@ tk_cut_away_1: // for single-byte tokenized keywords
|
||||
|
||||
dec tk__len_unpacked // keyword length, afterwards number of bytes to cut away
|
||||
|
||||
// Correct the line length
|
||||
|
||||
sec
|
||||
lda tk__length
|
||||
sbc tk__len_unpacked
|
||||
sta tk__length
|
||||
|
||||
// Copy the remaining,. untokenized part in the proper place
|
||||
|
||||
inc tk__offset
|
||||
ldy tk__offset
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
|
||||
tk_pack:
|
||||
|
||||
// Reuse the CPU stack - addresses below $102 are used by 'tokenise_line.s'
|
||||
// Reuse the CPU stack - address $100 is used by 'tokenise_line.s'
|
||||
|
||||
.label tk__len_unpacked = $103 // length of unpacked data; it could replace 'tk__nibble_flag', but at the cost of code size/performance
|
||||
.label tk__shorten_bits = $104 // 2 bytes for quick shortening of packed candidate
|
||||
.label tk__nibble_flag = $106 // $00 = start from new byte, $FF = start from high nibble
|
||||
.label tk__byte_offset = $107 // offset of the current byte (to place new data) in tk__packed
|
||||
.label tk__len_unpacked = $101 // length of unpacked data; it could replace 'tk__nibble_flag', but at the cost of code size/performance
|
||||
.label tk__shorten_bits = $102 // 2 bytes for quick shortening of packed candidate
|
||||
.label tk__nibble_flag = $104 // $00 = start from new byte, $FF = start from high nibble
|
||||
.label tk__byte_offset = $105 // offset of the current byte (to place new data) in tk__packed
|
||||
|
||||
.label tk__packed = $108 // packed candidate, 25 bytes is enough for worst case - a 16 byte keyword
|
||||
.label tk__packed = $106 // packed candidate, 25 bytes is enough for worst case - a 16 byte keyword
|
||||
|
||||
// Initialize variables
|
||||
|
||||
File renamed without changes.
@@ -31,9 +31,8 @@ tk_shorten_1n:
|
||||
ldy tk__byte_offset // will be needed in both cases
|
||||
|
||||
// Now we need to check which nibble to cut away
|
||||
|
||||
bit tk__nibble_flag
|
||||
bcs tk_shorten_1n_lo
|
||||
bmi tk_shorten_1n_lo
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -45,7 +44,7 @@ tk_shorten_1n_hi: // tk__nibble_flag = $00, both nibbles fr
|
||||
sty tk__byte_offset
|
||||
|
||||
lda tk__packed, y
|
||||
and #$F0
|
||||
and #$0F
|
||||
sta tk__packed, y
|
||||
|
||||
// Adjust remaining counters / flags, and quit
|
||||
@@ -78,7 +77,7 @@ tk_shorten_3n:
|
||||
// Now we need to check which nibble to cut away
|
||||
|
||||
bit tk__nibble_flag
|
||||
bcs tk_shorten_3n_2bytes
|
||||
bmi tk_shorten_3n_2bytes
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -21,22 +21,20 @@ tokenise_line:
|
||||
|
||||
#else
|
||||
|
||||
// Reuse the CPU stack - addresses above $101 are used by 'tk_pack.s'
|
||||
// Reuse the CPU stack - addresses above $100 are used by 'tk_pack.s'
|
||||
|
||||
.label tk__offset = $100 // offset into string
|
||||
.label tk__length = $101 // length of the raw string XXX reuse __tokenise_work1?
|
||||
.label tk__length = __tokenise_work1 // length of the raw string
|
||||
|
||||
// Initialize variables
|
||||
|
||||
lda #$00
|
||||
sta tk__offset
|
||||
|
||||
ldx __tokenise_work1
|
||||
stx tk__length
|
||||
|
||||
// Terminate input string with $00
|
||||
|
||||
// XXX do we need this?
|
||||
ldx tk__length
|
||||
sta BUF, x
|
||||
|
||||
// FALLTROUGH
|
||||
@@ -123,23 +121,19 @@ tokenise_line_keyword_V2:
|
||||
sta BUF, x
|
||||
|
||||
// Cut away unnecessary bytes
|
||||
|
||||
jsr tk_cut_away_1
|
||||
|
||||
// Special handling for REM command - after this one nothing more should be tokenised
|
||||
|
||||
pla
|
||||
cmp #$0F // REM token index
|
||||
jmp tokenise_line_loop
|
||||
bne tokenise_line_loop
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
tokenise_line_done:
|
||||
|
||||
// Update line length and quit
|
||||
|
||||
lda tk__length
|
||||
sta __tokenise_work1
|
||||
// Quit
|
||||
|
||||
rts
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Calculate the VARTAB value - to mark the end of BASIC program code. Also clears all variables.
|
||||
//
|
||||
|
||||
update_VARTAB_do_clr:
|
||||
|
||||
lda TXTTAB+0
|
||||
sta OLDTXT+0
|
||||
lda TXTTAB+1
|
||||
sta OLDTXT+1
|
||||
!:
|
||||
lda OLDTXT+0
|
||||
sta VARTAB+0
|
||||
lda OLDTXT+1
|
||||
sta VARTAB+1
|
||||
|
||||
jsr follow_link_to_next_line
|
||||
|
||||
lda OLDTXT+0
|
||||
ora OLDTXT+1
|
||||
bne !- // branch if pointer not NULL
|
||||
|
||||
// Correct VARTAB by 2 bytes NULL pointer
|
||||
|
||||
#if HAS_OPCODES_65CE02
|
||||
|
||||
inw VARTAB
|
||||
inw VARTAB
|
||||
|
||||
#else
|
||||
|
||||
clc
|
||||
lda VARTAB+0
|
||||
adc #$02
|
||||
sta VARTAB+0
|
||||
bcc !+
|
||||
inc VARTAB+1
|
||||
!:
|
||||
#endif
|
||||
|
||||
// Call CLR to set-up remaining variables
|
||||
|
||||
jmp do_clr
|
||||
@@ -196,4 +196,4 @@ do_basic_error: // error code in .X
|
||||
ldx #$FE
|
||||
txs
|
||||
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -0,0 +1,103 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# M65 * #TAKE
|
||||
// #LAYOUT# X16 BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
// See https://www.c64-wiki.com/wiki/Memory_(BASIC) for BASIC memory organization
|
||||
|
||||
|
||||
do_new:
|
||||
|
||||
#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0)
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__do_new
|
||||
jmp map_NORMAL
|
||||
|
||||
do_clr:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__do_clr
|
||||
jmp map_NORMAL
|
||||
|
||||
do_restore:
|
||||
|
||||
jsr map_BASIC_1
|
||||
jsr_ind VB1__do_restore
|
||||
jmp map_NORMAL
|
||||
|
||||
#else
|
||||
|
||||
// See Computes Mapping the Commodore 64 - page 96
|
||||
|
||||
ldy #$00
|
||||
tya
|
||||
sta (TXTTAB),y
|
||||
iny
|
||||
sta (TXTTAB),y
|
||||
|
||||
// The book does not mention this, but IMHO it is necessary to initialize VARTAB here too
|
||||
|
||||
clc
|
||||
lda TXTTAB+0
|
||||
adc #$02
|
||||
sta VARTAB+0
|
||||
lda TXTTAB+1
|
||||
adc #$00
|
||||
sta VARTAB+1
|
||||
|
||||
do_clr:
|
||||
|
||||
// See Computes Mapping the Commodore 64 - page 96
|
||||
|
||||
// XXX check on real ROMs that it is being done too when entering new line
|
||||
jsr JCLALL
|
||||
|
||||
lda MEMSIZ+0
|
||||
sta FRETOP+0
|
||||
lda MEMSIZ+1
|
||||
sta FRETOP+1
|
||||
|
||||
// The book is not precise here $31-$32 is definitely not the end of BASIC text
|
||||
|
||||
lda VARTAB+0
|
||||
sta ARYTAB+0
|
||||
sta STREND+0
|
||||
|
||||
lda VARTAB+1
|
||||
sta ARYTAB+1
|
||||
sta STREND+1
|
||||
|
||||
// FALLTROUGH (confirmed on real C64 that CLR indeed resets DATPTR)
|
||||
|
||||
do_restore:
|
||||
|
||||
// See Computes Mapping the Commodore 64 - page 98
|
||||
// Initial DATPTR value checked on real C64
|
||||
|
||||
#if HAS_OPCODES_65CE02
|
||||
|
||||
lda TXTTAB+0
|
||||
sta DATPTR+0
|
||||
lda TXTTAB+1
|
||||
sta DATPTR+1
|
||||
|
||||
dew DATPTR
|
||||
|
||||
#else
|
||||
|
||||
sec
|
||||
lda TXTTAB+0
|
||||
sbc #$01
|
||||
sta DATPTR+0
|
||||
lda TXTTAB+1
|
||||
sbc #$00
|
||||
sta DATPTR+1
|
||||
|
||||
#endif
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -164,7 +164,7 @@ execute_statements_end_of_line:
|
||||
|
||||
ldx CURLIN+1
|
||||
inx
|
||||
beq_16 basic_main_loop
|
||||
beq_16 shell_main_loop
|
||||
|
||||
// Advance to the next line - first copy the line number
|
||||
// to previous line number
|
||||
@@ -177,11 +177,11 @@ execute_statements_end_of_line:
|
||||
// Advance the basic line pointer to the next line; if end,
|
||||
// go to the main loop
|
||||
|
||||
jsr basic_follow_link_to_next_line
|
||||
jsr follow_link_to_next_line
|
||||
|
||||
lda OLDTXT+0
|
||||
ora OLDTXT+1
|
||||
beq_16 basic_main_loop
|
||||
beq_16 shell_main_loop
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -191,7 +191,7 @@ execute_line:
|
||||
|
||||
ldy #0
|
||||
jsr peek_line_pointer_null_check
|
||||
bcc_16 basic_main_loop // branch if end of program reached
|
||||
bcc_16 shell_main_loop // branch if end of program reached
|
||||
|
||||
// Skip pointer and line number to get address of first statement
|
||||
|
||||
|
||||
+3
-1
@@ -2,7 +2,8 @@
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
basic_follow_link_to_next_line:
|
||||
follow_link_to_next_line:
|
||||
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -28,4 +29,5 @@ basic_follow_link_to_next_line:
|
||||
sta OLDTXT+1
|
||||
pla
|
||||
sta OLDTXT+0
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,27 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Prepare interpreter to execute commands in direct mode
|
||||
//
|
||||
|
||||
prepare_direct_execution:
|
||||
|
||||
// Setup pointer to the statement
|
||||
lda #<BUF
|
||||
sta TXTPTR+0
|
||||
lda #>BUF
|
||||
sta TXTPTR+1
|
||||
|
||||
// There is no stored line, so zero that pointer out
|
||||
lda #$00
|
||||
sta OLDTXT+0
|
||||
sta OLDTXT+1
|
||||
|
||||
// Put invalid line number in current line number value,
|
||||
// so that we know we are in direct mode (Computes Mapping the 64 p19)
|
||||
lda #$FF
|
||||
sta CURLIN+1
|
||||
|
||||
rts
|
||||
File renamed without changes.
@@ -27,4 +27,4 @@ basic_warm_start_real:
|
||||
lda CMP0+0
|
||||
jsr print_hex_byte
|
||||
!:
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
@@ -10,7 +10,59 @@
|
||||
|
||||
initmsg_bytes_free:
|
||||
|
||||
jsr basic_do_new
|
||||
// Setup pointers to BASIC memory storage
|
||||
|
||||
lda #<$0801
|
||||
sta TXTTAB+0
|
||||
lda #>$0801
|
||||
sta TXTTAB+1
|
||||
|
||||
// Get top of memory.
|
||||
// If a cart is present, then it is $7FFF,
|
||||
// if not, then it is $F7FF, since we support having
|
||||
// programs and variables under ROM.
|
||||
// i.e., we support 56KB RAM for BASIC, keeping some space
|
||||
// free for some optimisation structures, e.g., FOR/NEXT loop
|
||||
// records (without them going on the stack), GOSUB stack
|
||||
// (same story), expression value cache?
|
||||
|
||||
sec // Read, not write value
|
||||
jsr JMEMTOP
|
||||
cpx #$80
|
||||
beq !+
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
lda #>$F7FF
|
||||
#elif CONFIG_MEMORY_MODEL_50K
|
||||
lda #>$D000
|
||||
#elif CONFIG_MEMORY_MODEL_46K
|
||||
lda #>$C000
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda #>$A000
|
||||
#endif
|
||||
skip_2_bytes_trash_nvz
|
||||
!:
|
||||
lda #>$8000
|
||||
sta MEMSIZ+1
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
cpx #$80
|
||||
beq !+
|
||||
lda #$FF
|
||||
skip_2_bytes_trash_nvz
|
||||
!:
|
||||
lda #<$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||
lda #<$00
|
||||
#endif
|
||||
sta MEMSIZ+0
|
||||
|
||||
// XXX move the part above to a more suitable place
|
||||
|
||||
// Initialize other variables by performing NEW
|
||||
|
||||
jsr do_new
|
||||
|
||||
// Print number of bytes free
|
||||
|
||||
sec
|
||||
lda MEMSIZ+0
|
||||
sbc TXTTAB+0
|
||||
@@ -20,6 +72,5 @@ initmsg_bytes_free:
|
||||
|
||||
jsr print_integer
|
||||
|
||||
// Print rest of the start up message
|
||||
ldx #IDX__STR_BYTES
|
||||
jmp print_packed_misc_str
|
||||
@@ -0,0 +1,36 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine for memory copy. Moves down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
|
||||
//
|
||||
|
||||
|
||||
shift_mem_adapt_pointers:
|
||||
|
||||
sty RESHO+4
|
||||
|
||||
// Adapt source pointer
|
||||
|
||||
sec
|
||||
lda memmove__src+0
|
||||
sbc RESHO+4
|
||||
sta memmove__src+0
|
||||
bcs !+
|
||||
dec memmove__src+1
|
||||
!:
|
||||
// Adapt destination pointer
|
||||
|
||||
sec
|
||||
lda memmove__dst+0
|
||||
sbc RESHO+4
|
||||
sta memmove__dst+0
|
||||
bcs !+
|
||||
dec memmove__dst+1
|
||||
!:
|
||||
// Adapt data size
|
||||
|
||||
inc memmove__size+1
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,59 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
//
|
||||
// Copies the memory down
|
||||
//
|
||||
// Input:
|
||||
// - memmove__src - pointer to the first byte of source
|
||||
// - memmove__dst - pointer to the first byte of destination
|
||||
// - memmove__size - number of bytes to copy
|
||||
//
|
||||
// All the input variables, .A, and .Y register, are destroyed. Also uses RESHO+4 variable.
|
||||
//
|
||||
|
||||
|
||||
shift_mem_down:
|
||||
|
||||
// The copy routine is simplified, so that it is fast and (for memory model 60K)
|
||||
// can fit in a small RAM area - therefore it requires to pre-set .Y, so that
|
||||
// the copy ends when it reaches 0; so if copying one byte we want .Y = $FF
|
||||
|
||||
sec
|
||||
lda #$00
|
||||
sbc memmove__size+0
|
||||
tay
|
||||
|
||||
// Now we have to move down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
|
||||
|
||||
jsr shift_mem_adapt_pointers
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
shift_mem_down_internal:
|
||||
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
php
|
||||
!:
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
iny
|
||||
bne !-
|
||||
inc memmove__src+1
|
||||
inc memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
plp
|
||||
rts
|
||||
|
||||
#else
|
||||
|
||||
jmp shift_mem_down_internal
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
shift_mem_down:
|
||||
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
|
||||
php
|
||||
!:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
iny
|
||||
bne !-
|
||||
inc __memmove_src+1
|
||||
inc __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne !-
|
||||
plp
|
||||
rts
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
//
|
||||
// Copies the memory up
|
||||
//
|
||||
// Input:
|
||||
// - memmove__src - pointer to the last byte of source
|
||||
// - memmove__dst - pointer to the last byte of destination
|
||||
// - memmove__size - number of bytes to copy
|
||||
//
|
||||
// All the input variables, .A, and .Y register, are destroyed. Also uses RESHO+4 variable.
|
||||
//
|
||||
|
||||
|
||||
shift_mem_up:
|
||||
|
||||
// The copy routine is simplified, so that it is fast and (for memory model 60K)
|
||||
// can fit in a small RAM area - therefore it requires to pre-set .Y, so that
|
||||
// the copy ends when it reaches 0; so if copying one byte we want .Y = $01
|
||||
|
||||
ldy memmove__size+0
|
||||
|
||||
// Now we have to move down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
|
||||
|
||||
jsr shift_mem_adapt_pointers
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
shift_mem_up_internal:
|
||||
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
php
|
||||
!:
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
dey
|
||||
bne !-
|
||||
dec memmove__src+1
|
||||
dec memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
plp
|
||||
rts
|
||||
|
||||
#else
|
||||
|
||||
jmp shift_mem_up_internal
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_38K
|
||||
|
||||
shift_mem_up:
|
||||
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
|
||||
php
|
||||
!:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
dey
|
||||
bne !-
|
||||
dec __memmove_src+1
|
||||
dec __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne !-
|
||||
plp
|
||||
rts
|
||||
|
||||
#endif
|
||||
@@ -70,14 +70,12 @@ peek_under_roms_via_FAC1_PLUS_1:
|
||||
|
||||
|
||||
|
||||
shift_mem_up:
|
||||
shift_mem_up_internal:
|
||||
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
// Unmap BASIC lower ROM
|
||||
|
||||
@@ -88,30 +86,28 @@ shift_mem_up:
|
||||
|
||||
// Perform the copying
|
||||
!:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
dey
|
||||
bne !-
|
||||
dec __memmove_src+1
|
||||
dec __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
dec memmove__src+1
|
||||
dec memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
bra shift_mem_finalize
|
||||
bra shift_mem_internal_finalize
|
||||
#else
|
||||
jmp shift_mem_finalize
|
||||
jmp shift_mem_internal_finalize
|
||||
#endif
|
||||
|
||||
|
||||
shift_mem_down:
|
||||
shift_mem_down_internal:
|
||||
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
// Unmap BASIC lower ROM
|
||||
|
||||
@@ -122,17 +118,18 @@ shift_mem_down:
|
||||
|
||||
// Perform the copying
|
||||
!:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
iny
|
||||
bne !-
|
||||
inc __memmove_src+1
|
||||
inc __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
inc memmove__src+1
|
||||
inc memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
shift_mem_finalize:
|
||||
shift_mem_internal_finalize:
|
||||
|
||||
// Restore memory mapping and quit
|
||||
|
||||
|
||||
@@ -70,44 +70,44 @@ memmap_allram_routine:
|
||||
rts
|
||||
|
||||
shift_mem_up_routine:
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
php
|
||||
jsr memmap_allram
|
||||
smu1:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
!:
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
dey
|
||||
bne smu1
|
||||
dec __memmove_src+1
|
||||
dec __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smu1
|
||||
bne !-
|
||||
dec memmove__src+1
|
||||
dec memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
plp
|
||||
jmp memmap_normal
|
||||
|
||||
shift_mem_down_routine:
|
||||
// Move __memmove_size bytes from __memmove_src to __memmove_dst,
|
||||
// where __memmove_dst > __memmove_src
|
||||
|
||||
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
|
||||
//
|
||||
// This means we have to copy from the back end down.
|
||||
// This routine assumes the pointers are already pointed
|
||||
// to the end of the areas, and that Y is correctly initialised
|
||||
// to allow the copy to begin.
|
||||
// This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized
|
||||
|
||||
php
|
||||
jsr memmap_allram
|
||||
smd1:
|
||||
lda (__memmove_src),y
|
||||
sta (__memmove_dst),y
|
||||
!:
|
||||
lda (memmove__src),y
|
||||
sta (memmove__dst),y
|
||||
iny
|
||||
bne smd1
|
||||
inc __memmove_src+1
|
||||
inc __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smd1
|
||||
bne !-
|
||||
inc memmove__src+1
|
||||
inc memmove__dst+1
|
||||
dec memmove__size+1
|
||||
bne !-
|
||||
plp
|
||||
jmp memmap_normal
|
||||
|
||||
|
||||
@@ -67,7 +67,9 @@ list_print_loop:
|
||||
lda (OLDTXT),y
|
||||
#endif
|
||||
|
||||
beq list_end_of_line
|
||||
bne !+
|
||||
rts // end of line
|
||||
!:
|
||||
cmp #$22
|
||||
bne list_not_quote
|
||||
lda QTSW
|
||||
@@ -118,6 +120,10 @@ list_display_token_CC:
|
||||
// Subtract $1 from token to get offset in token list
|
||||
dex
|
||||
|
||||
// Check if token is known
|
||||
cpx #TK__MAXTOKEN_keywords_CC
|
||||
bcs list_display_unknown_token // XXX consider displaying two question marks here
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_CC
|
||||
|
||||
@@ -156,6 +162,10 @@ list_display_token_CD:
|
||||
// Subtract $1 from token to get offset in token list
|
||||
dex
|
||||
|
||||
// Check if token is known
|
||||
cpx #TK__MAXTOKEN_keywords_CD
|
||||
bcs list_display_unknown_token // XXX consider displaying two question marks here
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_CD
|
||||
|
||||
@@ -174,9 +184,13 @@ list_display_token_V2:
|
||||
|
||||
// Subtract $80 from token to get offset in token list
|
||||
txa
|
||||
and #$7f
|
||||
and #$7F
|
||||
tax
|
||||
|
||||
// Check if token is known
|
||||
cpx #TK__MAXTOKEN_keywords_V2
|
||||
bcs list_display_unknown_token
|
||||
|
||||
// Now ask for it to be printed
|
||||
jsr print_packed_keyword_V2
|
||||
|
||||
@@ -188,12 +202,14 @@ list_token_displayed:
|
||||
ply_trash_a
|
||||
pla
|
||||
|
||||
cmp #$8f
|
||||
cmp #$8F
|
||||
bne list_not_rem
|
||||
// REM command locks quote flag on until the end of the line, allowing
|
||||
// funny characters in REM statements without problem.
|
||||
sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here
|
||||
// FALL THROUGH
|
||||
|
||||
// FALLTHROUGH
|
||||
|
||||
list_not_rem:
|
||||
|
||||
iny
|
||||
@@ -205,13 +221,52 @@ list_is_pi:
|
||||
// FALLTROUGH
|
||||
|
||||
list_is_literal:
|
||||
jsr JCHROUT
|
||||
iny
|
||||
bne list_print_loop
|
||||
|
||||
list_end_of_line:
|
||||
|
||||
rts
|
||||
|
||||
pha
|
||||
bit QTSW
|
||||
bpl list_is_literal_known // in quote mode every character is allowed
|
||||
and #$7F
|
||||
cmp #$12
|
||||
beq list_is_literal_known // enabling/disabling reverse mode is allowed
|
||||
and #%01100000
|
||||
bne list_is_literal_known
|
||||
pla
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
list_is_unknown:
|
||||
|
||||
phy_trash_a
|
||||
lda #<str_rev_question
|
||||
ldy #>str_rev_question
|
||||
jsr STROUT
|
||||
ply_trash_a
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
bra !+
|
||||
#else
|
||||
jmp !+
|
||||
#endif
|
||||
|
||||
list_is_literal_known:
|
||||
|
||||
pla
|
||||
jsr JCHROUT
|
||||
!:
|
||||
iny
|
||||
bne_16 list_print_loop
|
||||
|
||||
rts // end of line
|
||||
|
||||
list_display_unknown_token:
|
||||
|
||||
pla
|
||||
pla
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
bra list_is_unknown
|
||||
#else
|
||||
jmp list_is_unknown
|
||||
#endif
|
||||
|
||||
#endif // ROM layout
|
||||
@@ -96,7 +96,7 @@ wedge_dos_change_drive:
|
||||
jmp do_ILLEGAL_DEVICE_NUMBER_error
|
||||
!:
|
||||
sta FA
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
|
||||
wedge_dos_status_get:
|
||||
|
||||
@@ -238,7 +238,7 @@ wedge_dos_directory_display:
|
||||
|
||||
wedge_dos_clean_exit:
|
||||
jsr JCLALL
|
||||
jmp basic_main_loop
|
||||
jmp shell_main_loop
|
||||
|
||||
wedge_dos_basic_error:
|
||||
pha
|
||||
|
||||
@@ -6,20 +6,21 @@
|
||||
#if CONFIG_TAPE_WEDGE
|
||||
|
||||
|
||||
// .X has to contain size of the buffer
|
||||
|
||||
wedge_tape:
|
||||
|
||||
lda #$FF
|
||||
sta CURLIN+1 // in case of error do not print line number
|
||||
// Prepare for execution
|
||||
|
||||
cpx #$02
|
||||
bne_16 do_SYNTAX_error
|
||||
jsr prepare_direct_execution
|
||||
jsr fetch_character
|
||||
|
||||
lda BUF+1
|
||||
// First character is a 'left arrow', we can ignore it - determine the command
|
||||
|
||||
jsr fetch_character
|
||||
|
||||
cmp #$4C // 'L'
|
||||
beq wedge_arrow_L
|
||||
cmp #$4D // 'M'
|
||||
beq wedge_arrow_M
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
|
||||
@@ -30,31 +31,18 @@ wedge_tape:
|
||||
|
||||
jmp do_SYNTAX_error
|
||||
|
||||
wedge_arrow_L:
|
||||
|
||||
// Execute 'arrow + L'
|
||||
|
||||
lda #$00
|
||||
sta FNLEN // default file name is empty
|
||||
sta VERCKB // operation is LOAD, not VERIFY
|
||||
|
||||
ldy #$01
|
||||
#if CONFIG_TAPE_TURBO
|
||||
ldx #$07 // turbo tape device
|
||||
#else
|
||||
ldx #$01 // normal tape device
|
||||
#endif
|
||||
|
||||
jsr JSETFLS
|
||||
|
||||
// Perform loading
|
||||
|
||||
jmp cmd_load_got_params
|
||||
|
||||
#if CONFIG_TAPE_HEAD_ALIGN
|
||||
|
||||
wedge_arrow_H:
|
||||
|
||||
// Make sure the syntax is correct
|
||||
|
||||
jsr injest_spaces
|
||||
jsr fetch_character
|
||||
|
||||
cmp #$00
|
||||
bne_16 do_SYNTAX_error
|
||||
|
||||
jsr tape_head_align
|
||||
|
||||
jsr print_return
|
||||
@@ -62,5 +50,23 @@ wedge_arrow_H:
|
||||
|
||||
#endif
|
||||
|
||||
wedge_arrow_L:
|
||||
|
||||
jsr wedge_tape_prepare_load
|
||||
|
||||
// Perform loading
|
||||
|
||||
jmp cmd_load_got_params
|
||||
|
||||
wedge_arrow_M:
|
||||
|
||||
jsr wedge_tape_prepare_load
|
||||
ldy #$00
|
||||
sty SA // for MERGE secondary address has to be 0!
|
||||
|
||||
// Perform merging
|
||||
|
||||
jmp cmd_merge_got_params
|
||||
|
||||
|
||||
#endif // CONFIG_TAPE_WEDGE
|
||||
@@ -0,0 +1,68 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
#if CONFIG_TAPE_WEDGE
|
||||
|
||||
//
|
||||
// Common part for LOAD and MERGE operations via tape wedge
|
||||
//
|
||||
|
||||
wedge_tape_prepare_load:
|
||||
|
||||
// Make sure the syntax is correct
|
||||
|
||||
jsr injest_spaces
|
||||
jsr fetch_character
|
||||
|
||||
cmp #$00
|
||||
beq wedge_tape_prepare_load_no_filename // branch if no file name given
|
||||
cmp #$22
|
||||
bne_16 do_SYNTAX_error // branch if no opening quote
|
||||
|
||||
// Fetch the file name
|
||||
|
||||
lda TXTPTR+0
|
||||
sta FNADDR+0
|
||||
lda TXTPTR+1
|
||||
sta FNADDR+1
|
||||
|
||||
ldx #$00
|
||||
!:
|
||||
jsr fetch_character
|
||||
|
||||
cmp #$00
|
||||
beq !+
|
||||
cmp #$22
|
||||
beq !+
|
||||
|
||||
inx
|
||||
bne !-
|
||||
!:
|
||||
stx FNLEN
|
||||
|
||||
lda #$00
|
||||
beq wedge_tape_prepare_load_got_filename
|
||||
|
||||
wedge_tape_prepare_load_no_filename:
|
||||
|
||||
sta FNLEN // .A is 0 here, default file name is empty
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
wedge_tape_prepare_load_got_filename: // .A has to be 0
|
||||
|
||||
sta VERCKB // operation is LOAD, not VERIFY
|
||||
|
||||
ldy #$01
|
||||
#if CONFIG_TAPE_TURBO
|
||||
ldx #$07 // turbo tape device
|
||||
#else
|
||||
ldx #$01 // normal tape device
|
||||
#endif
|
||||
|
||||
jmp JSETFLS
|
||||
|
||||
|
||||
#endif // CONFIG_TAPE_WEDGE
|
||||
@@ -282,10 +282,20 @@ tape_match_loop:
|
||||
cmp #KEY_ASTERISK
|
||||
beq tape_return_ok
|
||||
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
|
||||
cmp (TAPE1), y
|
||||
bne tape_return_not_ok
|
||||
|
||||
iny
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
|
||||
cpy #$10
|
||||
bne tape_match_loop
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
sequence 0, 1, 2, 3, 4
|
||||
|
||||
Trivial sequence of bytes. Not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
$00 + STA $26 + STA $27 + STA $28 + STA $29 (temporary variables)
|
||||
|
||||
Couple of instructions settin 0 into temporary zeropage variables. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
sequence 1, 2, 3, 4
|
||||
|
||||
Trivial sequence of bytes. Not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
BCS (offset matches) + JSR (address only partially matches)
|
||||
|
||||
Instruction + some part. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
$07 + CMP #$22 + BEQ (offset does not match)
|
||||
|
||||
Instruction + some parts. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
CLC + LDA $2B + ADC #(value does not match)
|
||||
|
||||
Small part of code performing addition with a given zeropage variable. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
JSR $FFE7 + LDA $37
|
||||
|
||||
Calling a documented routine (CLALL) and fetching a byte from zeropage variable. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
$2C + SEC + JSR $FF99 (MEMTOP)
|
||||
|
||||
Call of a well-known routine, following operation type set and some part. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
SEC + LDA $2B + SBC #$01
|
||||
|
||||
Small part of code performing subtraction from a given zeropage variable. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
RTS + LDA $61 + BEQ (offset does not match)
|
||||
|
||||
End of pprevious routine + a new one starting from checking, whether zeropage variable is 0 or not. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
RTS + CMP #$22 + BNE (offset matches)
|
||||
|
||||
End of the routine + beginning of a new one, which starts by checking for a particular character. Not creative - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
ADC #$02 + STA $2D
|
||||
|
||||
Add 2, store value in zeropage variable. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
ADC #$02 + STA $2D + LDA $2C + ADC #$00 + STA $2E + JSR (address does not match)
|
||||
|
||||
Code calculatin VARTAB value from TXTTAB - by adding 2. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
LDX #$00 + LDY #$00
|
||||
|
||||
Load $00 into both index registers. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
LDA $61 + RTS + LDA (zeropage address does not match)
|
||||
|
||||
One routine ending with returning a zeropage variable, another one starting with fetching data to acccumulator (not even the same address). Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
$B9 + BCC (offset matches) + JSR (addres does not match)
|
||||
|
||||
Instruction + some parts. Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
CMP #$01 + BEQ (offset matches) + CMP #$03
|
||||
|
||||
Two decisions based on accumulator value (second not even the same one). Trivial - not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
CMP #$22 + BNE (offset matches) + LDA $D4 (QTSW) + EOR #(value does not match)
|
||||
|
||||
Small piece of code handling QTSW flag - telling whether we are in the quote mode. Nothing complicated here - not creative, not copyrightable.
|
||||
@@ -0,0 +1,3 @@
|
||||
$FF, $FF, $00, $00
|
||||
|
||||
Sequence of bytes being similar most likely fue to ROM not being filled in completely. Trivial - not copyrightable.
|
||||
+1323
-1297
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user