further aliases cleanup
This commit is contained in:
1 parent
1130db35e0
commit
4f58088207
21 files changed
+321
-330
No files matched your search
@@ -38,7 +38,7 @@
|
||||
.label ARYTAB = $2F // $2F-$30 -- NOT IMPLEMENTED --
|
||||
.label STREND = $31 // $31-$32 -- NOT IMPLEMENTED --
|
||||
.label FRETOP = $33 // $33-$34 -- NOT IMPLEMENTED --
|
||||
.label FRESPC = $35 // $35-$36 [!] our implementation might be different XXX give more details
|
||||
.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
|
||||
|
||||
+29
-38
@@ -1,44 +1,35 @@
|
||||
// Names of ZP and low memory locations
|
||||
// (Only those for now that we feel the need to implement initially)
|
||||
// (https://www.c64-wiki.com/wiki/Zeropage)
|
||||
//
|
||||
// Helper aliases to make the code more readable
|
||||
// Always use double underscore in label names
|
||||
// to allow automatic VICE label conflict prevention
|
||||
//
|
||||
|
||||
// XXX get rid of this file, use ,aliases_ram_lowmem.s instead
|
||||
// Temporary variables for various routines
|
||||
.label __tokenise_work1 = $07 // CHARAC
|
||||
.label __tokenise_work2 = $08 // ENDCHR
|
||||
.label __tokenise_work3 = $0B // COUNT
|
||||
.label __tokenise_work4 = $0F // GARBFL
|
||||
.label __tokenise_work5 = $0C // DIMFLG
|
||||
|
||||
.label tokenise_work1 = $7
|
||||
.label tokenise_work2 = $8
|
||||
.label tokenise_work3 = $B
|
||||
.label tokenise_work4 = $F
|
||||
.label basic_line_number = $14
|
||||
.label temp_string_ptr = $35
|
||||
.label load_or_verify_or_tokenise_work5 = $C
|
||||
.label basic_work22 = $22
|
||||
.label basic_work23 = $23
|
||||
.label basic_work24 = $24
|
||||
.label basic_work25 = $25
|
||||
// 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
|
||||
|
||||
// XXX cleanup lines below
|
||||
|
||||
// The various pointers that separate memory regions for BASIC storage
|
||||
// We have multiple names for the ones that mark the boundary of regions.
|
||||
.label basic_start_of_text_ptr = $2b
|
||||
.label basic_end_of_text_ptr = $2d
|
||||
.label basic_start_of_vars_ptr = $2d
|
||||
.label basic_end_of_vars_ptr = $2f
|
||||
.label basic_start_of_arrays_ptr = $2f
|
||||
.label basic_end_of_arrays_ptr = $31
|
||||
.label basic_start_of_text_ptr = $2b
|
||||
.label basic_end_of_text_ptr = $2d
|
||||
.label basic_start_of_vars_ptr = $2d
|
||||
.label basic_end_of_vars_ptr = $2f
|
||||
.label basic_start_of_arrays_ptr = $2f
|
||||
.label basic_end_of_arrays_ptr = $31
|
||||
.label basic_start_of_free_space_ptr = $31
|
||||
.label basic_start_of_strings_ptr = $33
|
||||
.label basic_top_of_memory_ptr = $37
|
||||
.label basic_current_line_number = $39
|
||||
.label basic_previous_line_number = $3b
|
||||
.label basic_current_line_ptr = $3d
|
||||
|
||||
// Note that the statement point is in the CHRGET/CHRGOT routine
|
||||
// in ZP RAM. (Compute's Mapping the 64, p25)
|
||||
.label basic_current_statement_ptr = $7a
|
||||
|
||||
.label basic_numeric_work_area = $57 // $57 - $60 inclusive = 10 bytes
|
||||
|
||||
// We also 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
|
||||
.label basic_start_of_strings_ptr = $33
|
||||
.label basic_top_of_memory_ptr = $37
|
||||
.label basic_current_line_number = $39
|
||||
.label basic_previous_line_number = $3b
|
||||
.label basic_current_line_ptr = $3d
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
STROUT:
|
||||
// Setup pointer
|
||||
sty temp_string_ptr+1
|
||||
sta temp_string_ptr+0
|
||||
sty FRESPC+1
|
||||
sta FRESPC+0
|
||||
|
||||
txa
|
||||
pha
|
||||
@@ -18,7 +18,7 @@ STROUT:
|
||||
tya
|
||||
tax
|
||||
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
beq !+
|
||||
|
||||
jsr JCHROUT
|
||||
|
||||
@@ -23,7 +23,7 @@ basic_delete_line:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work3
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -32,24 +32,24 @@ basic_delete_line:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta tokenise_work4
|
||||
sta __tokenise_work4
|
||||
|
||||
// Work out length of this line by looking at the pointer
|
||||
lda tokenise_work3
|
||||
lda __tokenise_work3
|
||||
sec
|
||||
sbc basic_current_line_ptr+0
|
||||
sta tokenise_work3
|
||||
lda tokenise_work4
|
||||
sta __tokenise_work3
|
||||
lda __tokenise_work4
|
||||
sbc basic_current_line_ptr+1
|
||||
sta tokenise_work4
|
||||
sta __tokenise_work4
|
||||
|
||||
// jsr printf
|
||||
// .text "LINE LENGTH IS $"
|
||||
// .byte $f0,<tokenise_work4,>tokenise_work4
|
||||
// .byte $f0,<tokenise_work3,>tokenise_work3
|
||||
// .byte $f0,<__tokenise_work4,>__tokenise_work4
|
||||
// .byte $f0,<__tokenise_work3,>__tokenise_work3
|
||||
// .byte $0d,0
|
||||
|
||||
lda tokenise_work4
|
||||
lda __tokenise_work4
|
||||
sbc #0
|
||||
cmp #$00
|
||||
beq !+
|
||||
@@ -58,9 +58,9 @@ basic_delete_line:
|
||||
jmp do_MEMORY_CORRUPT_error
|
||||
!:
|
||||
// Length can now be safely assumed to be in the low
|
||||
// byte only, i.e., stored in tokenise_work3
|
||||
// byte only, i.e., stored in __tokenise_work3
|
||||
|
||||
lda tokenise_work3
|
||||
lda __tokenise_work3
|
||||
pha
|
||||
tax
|
||||
|
||||
@@ -69,10 +69,10 @@ basic_delete_line:
|
||||
|
||||
// Now decrease top of BASIC mem
|
||||
pla
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work3
|
||||
lda basic_end_of_text_ptr+0
|
||||
sec
|
||||
sbc tokenise_work3
|
||||
sbc __tokenise_work3
|
||||
sta basic_end_of_text_ptr+0
|
||||
lda basic_end_of_text_ptr+1
|
||||
sbc #0
|
||||
|
||||
@@ -6,10 +6,10 @@ basic_end_of_statement_check:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
ldx #<TXTPTR
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
#endif
|
||||
|
||||
// Consume any spaces
|
||||
@@ -42,10 +42,10 @@ basic_execute_statement:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
ldx #<TXTPTR
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
#endif
|
||||
|
||||
jsr basic_end_of_statement_check
|
||||
@@ -56,8 +56,8 @@ basic_execute_statement:
|
||||
// .byte $f1,<basic_current_line_ptr,>basic_current_line_ptr
|
||||
// .byte $f0,<basic_current_line_ptr,>basic_current_line_ptr
|
||||
// .text ", STATEMENT PTR = $"
|
||||
// .byte $f1,<basic_current_statement_ptr,>basic_current_statement_ptr
|
||||
// .byte $f0,<basic_current_statement_ptr,>basic_current_statement_ptr
|
||||
// .byte $f1,<TXTPTR,>TXTPTR
|
||||
// .byte $f0,<TXTPTR,>TXTPTR
|
||||
// .byte $d,0
|
||||
|
||||
// Go through the line until its end is reached.
|
||||
@@ -73,11 +73,11 @@ basic_execute_statement:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
ldx #<TXTPTR
|
||||
jsr peek_under_roms
|
||||
cmp #$00
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
#endif
|
||||
|
||||
beq basic_end_of_line
|
||||
@@ -143,30 +143,30 @@ basic_fetch_and_consume_character:
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_statement_ptr
|
||||
ldx #<TXTPTR
|
||||
jsr peek_under_roms
|
||||
#else // CONFIG_MEMORY_MODEL_38K
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
#endif
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
basic_consume_character:
|
||||
// Advance basic text pointer
|
||||
inc basic_current_statement_ptr+0
|
||||
inc TXTPTR+0
|
||||
bne !+
|
||||
inc basic_current_statement_ptr+1
|
||||
inc TXTPTR+1
|
||||
!:
|
||||
rts
|
||||
|
||||
basic_unconsume_character:
|
||||
lda basic_current_statement_ptr+0
|
||||
lda TXTPTR+0
|
||||
sec
|
||||
sbc #1
|
||||
sta basic_current_statement_ptr+0
|
||||
lda basic_current_statement_ptr+1
|
||||
sta TXTPTR+0
|
||||
lda TXTPTR+1
|
||||
sbc #0
|
||||
sta basic_current_statement_ptr+1
|
||||
sta TXTPTR+1
|
||||
rts
|
||||
|
||||
basic_end_of_line:
|
||||
@@ -213,10 +213,10 @@ basic_execute_from_current_line:
|
||||
lda basic_current_line_ptr+0
|
||||
clc
|
||||
adc #4
|
||||
sta basic_current_statement_ptr+0
|
||||
sta TXTPTR+0
|
||||
lda basic_current_line_ptr+1
|
||||
adc #0
|
||||
sta basic_current_statement_ptr+1
|
||||
sta TXTPTR+1
|
||||
|
||||
ldy #2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Find the BASIC line with number basic_line_number
|
||||
// Find the BASIC line with number LINNUM
|
||||
|
||||
|
||||
basic_find_line:
|
||||
@@ -21,7 +21,7 @@ basic_find_line_loop:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
cmp basic_line_number+1
|
||||
cmp LINNUM+1
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
@@ -35,7 +35,7 @@ basic_find_line_loop:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
cmp basic_line_number+0
|
||||
cmp LINNUM+0
|
||||
beq !+
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
|
||||
@@ -29,9 +29,9 @@ basic_insert_line:
|
||||
pha
|
||||
|
||||
// Get number of bytes in tokenised line after line number
|
||||
lda tokenise_work2
|
||||
lda __tokenise_work2
|
||||
sec
|
||||
sbc tokenise_work1
|
||||
sbc __tokenise_work1
|
||||
// Add on the four bytes space we need
|
||||
clc
|
||||
adc #5
|
||||
@@ -58,7 +58,7 @@ basic_insert_line:
|
||||
|
||||
// Write the line number
|
||||
ldy #2
|
||||
lda basic_line_number+0
|
||||
lda LINNUM+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
@@ -68,7 +68,7 @@ basic_insert_line:
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda basic_line_number+1
|
||||
lda LINNUM+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
@@ -77,11 +77,11 @@ basic_insert_line:
|
||||
#endif
|
||||
|
||||
// Now store the line body itself
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
line_store_loop:
|
||||
ldx tokenise_work1
|
||||
ldx __tokenise_work1
|
||||
lda $0200,x
|
||||
inc tokenise_work1
|
||||
inc __tokenise_work1
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -91,10 +91,10 @@ line_store_loop:
|
||||
sta (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
lda tokenise_work1
|
||||
cmp tokenise_work2
|
||||
lda __tokenise_work1
|
||||
cmp __tokenise_work2
|
||||
bne line_store_loop
|
||||
dec tokenise_work2
|
||||
dec __tokenise_work2
|
||||
|
||||
clc
|
||||
rts
|
||||
+18
-18
@@ -31,7 +31,7 @@ read_line_loop:
|
||||
got_line_of_input:
|
||||
|
||||
// Store length of input buffer ready for tokenising
|
||||
stx tokenise_work1
|
||||
stx __tokenise_work1
|
||||
|
||||
// Strip leading spaces from the line
|
||||
remove_leading_spaces:
|
||||
@@ -42,11 +42,11 @@ remove_leading_spaces:
|
||||
rsl_l1: lda $0200,x
|
||||
sta $01ff,x
|
||||
inx
|
||||
cpx tokenise_work1
|
||||
cpx __tokenise_work1
|
||||
bne rsl_l1
|
||||
|
||||
// Reduce length of input by one
|
||||
dec tokenise_work1
|
||||
dec __tokenise_work1
|
||||
// Stop trying to rim if we run out of input
|
||||
bne remove_leading_spaces
|
||||
!:
|
||||
@@ -55,7 +55,7 @@ rsl_l1: lda $0200,x
|
||||
jsr JCHROUT
|
||||
|
||||
// Ignore empty lines
|
||||
lda tokenise_work1
|
||||
lda __tokenise_work1
|
||||
beq basic_read_next_line
|
||||
|
||||
// Else, tokenise the line
|
||||
@@ -71,36 +71,36 @@ rsl_l1: lda $0200,x
|
||||
// Yes, the line begins with a number.
|
||||
// Parse the line number and check validity
|
||||
|
||||
// injest_number follows tokenise_work1 as the offset into the line,
|
||||
// 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
|
||||
lda __tokenise_work1
|
||||
sta __tokenise_work2
|
||||
lda #$00
|
||||
sta tokenise_work1
|
||||
sta __tokenise_work1
|
||||
|
||||
// Try to read line number
|
||||
lda #<$0200
|
||||
sta basic_current_statement_ptr+0
|
||||
sta TXTPTR+0
|
||||
lda #>$0200
|
||||
sta basic_current_statement_ptr+1
|
||||
sta TXTPTR+1
|
||||
|
||||
jsr basic_parse_line_number
|
||||
|
||||
// Get pointer to next char
|
||||
lda basic_current_statement_ptr+0
|
||||
sta tokenise_work1
|
||||
lda TXTPTR+0
|
||||
sta __tokenise_work1
|
||||
|
||||
// Got a valid line number -- so do add/del line
|
||||
|
||||
// Skip any spaces after the line number
|
||||
ldx tokenise_work1
|
||||
ldx __tokenise_work1
|
||||
skip_spaces:
|
||||
lda $0200,x
|
||||
cmp #$20
|
||||
bne !+
|
||||
inx
|
||||
bne skip_spaces
|
||||
!: stx tokenise_work1
|
||||
!: 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
|
||||
@@ -119,8 +119,8 @@ skip_spaces:
|
||||
!:
|
||||
// Insert new line if non-zero length, i.e., that
|
||||
// we are not just deleting the line.
|
||||
lda tokenise_work1
|
||||
cmp tokenise_work2
|
||||
lda __tokenise_work1
|
||||
cmp __tokenise_work2
|
||||
beq !+
|
||||
jsr basic_insert_line
|
||||
!:
|
||||
@@ -133,9 +133,9 @@ not_a_line:
|
||||
|
||||
// Setup pointer to the statement
|
||||
lda #<$0200
|
||||
sta basic_current_statement_ptr+0
|
||||
sta TXTPTR+0
|
||||
lda #>$0200
|
||||
sta basic_current_statement_ptr+1
|
||||
sta TXTPTR+1
|
||||
|
||||
// There is no stored line, so zero that pointer out
|
||||
lda #$00
|
||||
|
||||
@@ -14,14 +14,14 @@ ml_bad_line_number:
|
||||
jmp do_ILLEGAL_QUANTITY_error
|
||||
!:
|
||||
// Line number are not allowed to have decimal points in them
|
||||
lda tokenise_work4
|
||||
lda __tokenise_work4
|
||||
cmp #$FF
|
||||
bne ml_bad_line_number
|
||||
|
||||
// Got a valid line number.
|
||||
lda FAC1_mantissa+0
|
||||
sta basic_line_number+0
|
||||
sta LINNUM+0
|
||||
lda FAC1_mantissa+1
|
||||
sta basic_line_number+1
|
||||
sta LINNUM+1
|
||||
clc
|
||||
rts
|
||||
@@ -4,28 +4,28 @@ basic_shift_mem_down_and_relink:
|
||||
|
||||
// Destination is basic_current_line_ptr
|
||||
lda basic_current_line_ptr+0
|
||||
sta memmove_dst+0
|
||||
sta __memmove_dst+0
|
||||
lda basic_current_line_ptr+1
|
||||
sta memmove_dst+1
|
||||
sta __memmove_dst+1
|
||||
|
||||
// Source is that plus X
|
||||
txa
|
||||
pha // also keep for later
|
||||
clc
|
||||
adc basic_current_line_ptr+0
|
||||
sta memmove_src+0
|
||||
sta __memmove_src+0
|
||||
lda basic_current_line_ptr+1
|
||||
adc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
// Size is distance from source to end of BASIC text.
|
||||
lda basic_end_of_text_ptr+0
|
||||
sec
|
||||
sbc memmove_src+0
|
||||
sta memmove_size+0
|
||||
sbc __memmove_src+0
|
||||
sta __memmove_size+0
|
||||
lda basic_end_of_text_ptr+1
|
||||
sbc memmove_src+1
|
||||
sta memmove_size+1
|
||||
sbc __memmove_src+1
|
||||
sta __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "TOP OF BASIC = $"
|
||||
@@ -33,14 +33,14 @@ basic_shift_mem_down_and_relink:
|
||||
// .byte $f0,<basic_end_of_text_ptr,>basic_end_of_text_ptr
|
||||
// .byte $0d
|
||||
// .text "SHIFTING DOWN $"
|
||||
// .byte $f1,<memmove_size,>memmove_size
|
||||
// .byte $f0,<memmove_size,>memmove_size
|
||||
// .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
|
||||
// .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 $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
|
||||
@@ -54,50 +54,50 @@ basic_shift_mem_down_and_relink:
|
||||
// This means we have to then reduce the source and
|
||||
// target pointers by the same amount
|
||||
|
||||
lda memmove_size+0
|
||||
lda __memmove_size+0
|
||||
eor #$ff
|
||||
sta tokenise_work3
|
||||
sta memmove_size+0
|
||||
sta __tokenise_work3
|
||||
sta __memmove_size+0
|
||||
|
||||
lda memmove_src+0
|
||||
lda __memmove_src+0
|
||||
sec
|
||||
sbc tokenise_work3
|
||||
sta memmove_src+0
|
||||
lda memmove_src+1
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
lda __memmove_src+1
|
||||
sbc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
lda memmove_dst+0
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc tokenise_work3
|
||||
sta memmove_dst+0
|
||||
lda memmove_dst+1
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta memmove_dst+1
|
||||
sta __memmove_dst+1
|
||||
|
||||
// Increase copy page count so we can post-decrement compare with $00
|
||||
inc memmove_size+1
|
||||
inc __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "REVISED BOUNDS $"
|
||||
// .byte $f1,<memmove_size,>memmove_size
|
||||
// .byte $f0,<memmove_size,>memmove_size
|
||||
// .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
|
||||
// .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 $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
|
||||
ldy __memmove_size+0
|
||||
|
||||
jsr shift_mem_down
|
||||
|
||||
// Get length of deletion back
|
||||
pla
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work3
|
||||
|
||||
// Check if we still have any lines left
|
||||
ldy #0
|
||||
@@ -112,7 +112,7 @@ relink_down_next_line:
|
||||
// inc $d020
|
||||
// jmp relink_down_next_line
|
||||
|
||||
// Subtract tokenise_work3 from the pointer
|
||||
// Subtract __tokenise_work3 from the pointer
|
||||
ldy #0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -123,8 +123,8 @@ relink_down_next_line:
|
||||
#endif
|
||||
|
||||
sec
|
||||
sbc tokenise_work3
|
||||
sta memmove_src+0
|
||||
sbc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
iny
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
@@ -134,10 +134,10 @@ relink_down_next_line:
|
||||
#endif
|
||||
|
||||
sbc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
ldy #0
|
||||
lda memmove_src+0
|
||||
lda __memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
@@ -147,7 +147,7 @@ relink_down_next_line:
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda memmove_src+1
|
||||
lda __memmove_src+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
@@ -157,9 +157,9 @@ relink_down_next_line:
|
||||
|
||||
relink_down_loop:
|
||||
// Now advance pointer to the next line,
|
||||
lda memmove_src+0
|
||||
lda __memmove_src+0
|
||||
sta basic_current_line_ptr+0
|
||||
lda memmove_src+1
|
||||
lda __memmove_src+1
|
||||
sta basic_current_line_ptr+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
|
||||
@@ -10,35 +10,35 @@ basic_shift_mem_up_and_relink:
|
||||
txa
|
||||
clc
|
||||
adc basic_end_of_text_ptr+0
|
||||
sta memmove_dst+0
|
||||
sta __memmove_dst+0
|
||||
lda basic_end_of_text_ptr+1
|
||||
adc #0
|
||||
sta memmove_dst+1
|
||||
lda memmove_dst+0
|
||||
sta __memmove_dst+1
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc #1
|
||||
sta memmove_dst+0
|
||||
lda memmove_dst+1
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta memmove_dst+1
|
||||
sta __memmove_dst+1
|
||||
|
||||
// End point of source is just current end of BASIC text
|
||||
lda basic_end_of_text_ptr+0
|
||||
sec
|
||||
sbc #1
|
||||
sta memmove_src+0
|
||||
sta __memmove_src+0
|
||||
lda basic_end_of_text_ptr+1
|
||||
sbc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
// Work out size of region to copy
|
||||
lda basic_end_of_text_ptr+0
|
||||
sec
|
||||
sbc basic_current_line_ptr+0
|
||||
sta memmove_size+0
|
||||
sta __memmove_size+0
|
||||
lda basic_end_of_text_ptr+1
|
||||
sbc basic_current_line_ptr+1
|
||||
sta memmove_size+1
|
||||
sta __memmove_size+1
|
||||
|
||||
// jsr printf
|
||||
// .text "TOP OF BASIC = $"
|
||||
@@ -46,54 +46,54 @@ basic_shift_mem_up_and_relink:
|
||||
// .byte $f0,<basic_end_of_text_ptr,>basic_end_of_text_ptr
|
||||
// .byte $0d
|
||||
// .text "SHIFTING UP $"
|
||||
// .byte $f1,<memmove_size,>memmove_size
|
||||
// .byte $f0,<memmove_size,>memmove_size
|
||||
// .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
|
||||
// .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 $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
|
||||
lda __memmove_src+0
|
||||
sec
|
||||
sbc memmove_size+0
|
||||
sta memmove_src+0
|
||||
lda memmove_src+1
|
||||
sbc __memmove_size+0
|
||||
sta __memmove_src+0
|
||||
lda __memmove_src+1
|
||||
sbc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
lda memmove_dst+0
|
||||
lda __memmove_dst+0
|
||||
sec
|
||||
sbc memmove_size+0
|
||||
sta memmove_dst+0
|
||||
lda memmove_dst+1
|
||||
sbc __memmove_size+0
|
||||
sta __memmove_dst+0
|
||||
lda __memmove_dst+1
|
||||
sbc #0
|
||||
sta memmove_dst+1
|
||||
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
|
||||
inc __memmove_size+1
|
||||
|
||||
// Then set Y to the number offset required
|
||||
ldy memmove_size+0
|
||||
ldy __memmove_size+0
|
||||
iny
|
||||
|
||||
stx tokenise_work3
|
||||
stx __tokenise_work3
|
||||
|
||||
// jsr printf
|
||||
// .text "REVISED BOUNDS $"
|
||||
// .byte $f1,<memmove_size,>memmove_size
|
||||
// .byte $f0,<memmove_size,>memmove_size
|
||||
// .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
|
||||
// .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 $f1,<__memmove_dst,>__memmove_dst
|
||||
// .byte $f0,<__memmove_dst,>__memmove_dst
|
||||
// .byte $0d,0
|
||||
|
||||
// Do the copy
|
||||
@@ -138,10 +138,10 @@ relink_up_next_line:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta memmove_dst+0
|
||||
sta __memmove_dst+0
|
||||
clc
|
||||
adc tokenise_work3
|
||||
sta memmove_src+0
|
||||
adc __tokenise_work3
|
||||
sta __memmove_src+0
|
||||
iny
|
||||
php
|
||||
|
||||
@@ -152,27 +152,27 @@ relink_up_next_line:
|
||||
lda (basic_current_line_ptr),y
|
||||
#endif
|
||||
|
||||
sta memmove_dst+1
|
||||
sta __memmove_dst+1
|
||||
plp
|
||||
adc #0
|
||||
sta memmove_src+1
|
||||
sta __memmove_src+1
|
||||
|
||||
// jsr printf
|
||||
// .text "LINE ADDR = $"
|
||||
// .byte $f1,<basic_current_line_ptr,>basic_end_of_text_ptr
|
||||
// .byte $f0,<basic_current_line_ptr,>basic_end_of_text_ptr
|
||||
// .text $d," BEFORE = $"
|
||||
// .byte $f1,<memmove_dst,>memmove_dst
|
||||
// .byte $f0,<memmove_dst,>memmove_dst
|
||||
// .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 $f1,<__memmove_src,>__memmove_src
|
||||
// .byte $f0,<__memmove_src,>__memmove_src
|
||||
// .byte $d
|
||||
// .byte 0
|
||||
|
||||
// Write memmove_src back to current line pointer
|
||||
// Write __memmove_src back to current line pointer
|
||||
ldy #0
|
||||
lda memmove_src+0
|
||||
lda __memmove_src+0
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
ldx #<basic_current_line_ptr+0
|
||||
@@ -182,7 +182,7 @@ relink_up_next_line:
|
||||
#endif
|
||||
|
||||
iny
|
||||
lda memmove_src+1
|
||||
lda __memmove_src+1
|
||||
|
||||
#if CONFIG_MEMORY_MODEL_60K
|
||||
jsr poke_under_roms
|
||||
@@ -192,9 +192,9 @@ relink_up_next_line:
|
||||
|
||||
relink_up_loop:
|
||||
// Now advance pointer to the next line,
|
||||
lda memmove_src+0
|
||||
lda __memmove_src+0
|
||||
sta basic_current_line_ptr+0
|
||||
lda memmove_src+1
|
||||
lda __memmove_src+1
|
||||
sta basic_current_line_ptr+1
|
||||
|
||||
// Have we run out of lines to patch?
|
||||
|
||||
@@ -105,9 +105,9 @@ list_not_quote:
|
||||
|
||||
// Get pointer to compressed keyword list
|
||||
lda #<packed_keywords
|
||||
sta temp_string_ptr+0
|
||||
sta FRESPC+0
|
||||
lda #>packed_keywords
|
||||
sta temp_string_ptr+1
|
||||
sta FRESPC+1
|
||||
|
||||
// Subtract $80 from token to get offset in word
|
||||
// list
|
||||
|
||||
@@ -36,9 +36,9 @@ cmd_load:
|
||||
jmp do_SYNTAX_error
|
||||
!:
|
||||
// Filename starts here so set pointer
|
||||
lda basic_current_statement_ptr+0
|
||||
lda TXTPTR+0
|
||||
sta FNADDR+0
|
||||
lda basic_current_statement_ptr+1
|
||||
lda TXTPTR+1
|
||||
sta FNADDR+1
|
||||
|
||||
// Now search for end of line or closing quote
|
||||
@@ -65,11 +65,11 @@ got_filename:
|
||||
bcs got_devicenumber
|
||||
|
||||
jsr basic_parse_line_number
|
||||
lda basic_line_number+1
|
||||
lda LINNUM+1
|
||||
beq !+
|
||||
jmp do_ILLEGAL_QUANTITY_error
|
||||
!:
|
||||
lda basic_line_number+0
|
||||
lda LINNUM+0
|
||||
sta FA
|
||||
|
||||
got_devicenumber:
|
||||
@@ -80,9 +80,9 @@ got_devicenumber:
|
||||
jsr injest_comma
|
||||
bcs got_secondaryaddress
|
||||
jsr basic_parse_line_number
|
||||
lda basic_line_number+1
|
||||
lda LINNUM+1
|
||||
bne !+
|
||||
lda basic_line_number+0
|
||||
lda LINNUM+0
|
||||
sta SA
|
||||
jmp got_secondaryaddress
|
||||
!:
|
||||
@@ -90,8 +90,8 @@ got_devicenumber:
|
||||
// Use it as load address instead
|
||||
// XXX temporary syntax, it would be better to use something
|
||||
// XXX like 'LOAD"FILE",8 TO 49152'
|
||||
ldx basic_line_number+0
|
||||
ldy basic_line_number+1
|
||||
ldx LINNUM+0
|
||||
ldy LINNUM+1
|
||||
bne got_loadaddress
|
||||
|
||||
got_secondaryaddress:
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@ cmd_sys:
|
||||
// setup call
|
||||
lda #$4C // JMP opcode
|
||||
sta USRPOK
|
||||
lda basic_line_number+0
|
||||
lda LINNUM+0
|
||||
sta USRADD+0
|
||||
lda basic_line_number+1
|
||||
lda LINNUM+1
|
||||
sta USRADD+1
|
||||
|
||||
// Setup the register values
|
||||
|
||||
@@ -15,13 +15,13 @@ fac1_mul10:
|
||||
jsr fac1_mantissa_mul2
|
||||
|
||||
// copy down to BASIC numeric work area at $57
|
||||
// (basic_numeric_work_area)
|
||||
// (TEMPF1)
|
||||
// (We copy all 7 bytes off the FAC1, so that we have
|
||||
// the overflow bits, and the copy is as small as possible)
|
||||
ldx #7
|
||||
f1m10_l1:
|
||||
lda FAC1_mantissa,x
|
||||
sta basic_numeric_work_area,x
|
||||
sta TEMPF1,x
|
||||
dex
|
||||
bpl f1m10_l1
|
||||
|
||||
@@ -35,13 +35,13 @@ f1m10_l1:
|
||||
clc
|
||||
f1m10_l2:
|
||||
lda FAC1_mantissa,x
|
||||
adc basic_numeric_work_area,x
|
||||
adc TEMPF1,x
|
||||
sta FAC1_mantissa,x
|
||||
inx
|
||||
dey
|
||||
bpl f1m10_l2
|
||||
lda BITS
|
||||
adc basic_numeric_work_area+7
|
||||
adc TEMPF1+7
|
||||
sta BITS
|
||||
|
||||
// Now shift right and increase exponent until overflow
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
// Parse a number from the input buffer at (basic_current_statement_ptr)
|
||||
// Parse a number from the input buffer at (TXTPTR)
|
||||
// Result is put into FAC1.
|
||||
// basic_current_statement_ptr is updated with first position after the number.
|
||||
// TXTPTR is updated with first position after the number.
|
||||
|
||||
// XXX - Remember decimal position and exponent, and apply them
|
||||
// after to produce normalised floating point number.
|
||||
@@ -20,7 +20,7 @@ ij_not_a_digit:
|
||||
// Look for decimal point
|
||||
cmp #$2e
|
||||
bne ij_not_decimal
|
||||
lda tokenise_work4
|
||||
lda __tokenise_work4
|
||||
cmp #$ff
|
||||
beq ij_found_decimal
|
||||
// More than one decimal point in a number means we have reached the end of the number
|
||||
@@ -33,7 +33,7 @@ ij_found_decimal:
|
||||
// can do the necessary number of divide by 10s on the final
|
||||
// number.
|
||||
lda #$00
|
||||
sta tokenise_work4
|
||||
sta __tokenise_work4
|
||||
|
||||
jmp ij_consider_next_digit
|
||||
|
||||
@@ -48,13 +48,13 @@ injest_number:
|
||||
|
||||
// Clear decimal position flag
|
||||
lda #$ff
|
||||
sta tokenise_work4
|
||||
sta __tokenise_work4
|
||||
|
||||
// Check if leading char is a - sign
|
||||
// Note: the - will have been tokenised to $AB
|
||||
// XXX - implement
|
||||
ldy #$00
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
cmp #$AB
|
||||
bne ij_not_minus
|
||||
|
||||
@@ -67,10 +67,10 @@ injest_number:
|
||||
|
||||
ij_not_minus:
|
||||
|
||||
|
||||
|
||||
ij_loop1:
|
||||
ldy #$00
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
cmp #$30
|
||||
bcc ij_not_a_digit
|
||||
cmp #$3a
|
||||
@@ -89,7 +89,7 @@ ij_loop1:
|
||||
// If we have seen a decimal point, then we can completely ignore
|
||||
// the digit, as it is contributing not recordable information
|
||||
|
||||
lda tokenise_work4
|
||||
lda __tokenise_work4
|
||||
cmp #$ff
|
||||
bne ij_seen_decimal_point
|
||||
|
||||
@@ -108,7 +108,7 @@ ij_accept_precision:
|
||||
|
||||
// Get digit
|
||||
ldy #$00
|
||||
lda (basic_current_statement_ptr),y
|
||||
lda (TXTPTR),y
|
||||
sec
|
||||
sbc #$30
|
||||
|
||||
|
||||
+29
-29
@@ -13,30 +13,30 @@
|
||||
pack_word:
|
||||
// Inputs:
|
||||
// X = offset of string to pack. Address is $0200 + X
|
||||
// tokenise_work1 = number of bytes to pack
|
||||
// tokenise_work2 = packed length of string
|
||||
// __tokenise_work1 = number of bytes to pack
|
||||
// __tokenise_work2 = packed length of string
|
||||
|
||||
// Outputs:
|
||||
// Output is written to $0100 (bottom of stack).
|
||||
|
||||
// Memory modified:
|
||||
// tokenise_work4 = temporary storage
|
||||
// tokenise_work3 = flag for whether we have a nybl prepared or not.
|
||||
// __tokenise_work4 = temporary storage
|
||||
// __tokenise_work3 = flag for whether we have a nybl prepared or not.
|
||||
// (This can also be checked on exit, to know whether the last byte
|
||||
// is incomplete, which is important for searching for abbreviated
|
||||
// key words.)
|
||||
|
||||
|
||||
// Make sure we have a sane request
|
||||
lda tokenise_work1
|
||||
lda __tokenise_work1
|
||||
bne !+
|
||||
sec
|
||||
rts
|
||||
!:
|
||||
// Initialise internal variables
|
||||
lda #$00
|
||||
sta tokenise_work2
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work2
|
||||
sta __tokenise_work3
|
||||
|
||||
pack_char_loop:
|
||||
|
||||
@@ -56,13 +56,13 @@ pack_char_loop:
|
||||
// either $FE or $FF, depending on whether this is the last
|
||||
// byte or not
|
||||
|
||||
lda tokenise_work3
|
||||
lda __tokenise_work3
|
||||
bne have_nybl_before_exception_char
|
||||
|
||||
// No nybl exists before the exception char, so prefix with $FE or $FF
|
||||
// based on whether we are at the end of the input string or not
|
||||
inx
|
||||
lda tokenise_work1
|
||||
lda __tokenise_work1
|
||||
cmp #$01
|
||||
beq at_end
|
||||
lda #$FF
|
||||
@@ -80,11 +80,11 @@ output_exception_byte:
|
||||
|
||||
have_nybl_before_exception_char:
|
||||
// Or existing byte with #$0F, and clear nybl flag
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
lda $0100,y
|
||||
ora #$0f
|
||||
sta $0100,y
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
@@ -92,7 +92,7 @@ write_literal_and_terminate_if_required:
|
||||
|
||||
// Clear have nybl flag
|
||||
lda #$00
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work3
|
||||
|
||||
lda $0200,x
|
||||
jsr write_unpacked_char
|
||||
@@ -102,7 +102,7 @@ write_literal_and_terminate_if_required:
|
||||
end_string_if_required:
|
||||
// Check if X points to last char of string to be packed
|
||||
inx
|
||||
lda tokenise_work1
|
||||
lda __tokenise_work1
|
||||
cmp #$01
|
||||
beq !+
|
||||
dex
|
||||
@@ -118,10 +118,10 @@ end_string:
|
||||
rts
|
||||
|
||||
write_unpacked_char:
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
sta $0100,y
|
||||
iny
|
||||
sty tokenise_work2
|
||||
sty __tokenise_work2
|
||||
rts
|
||||
|
||||
not_exception_char:
|
||||
@@ -130,7 +130,7 @@ not_exception_char:
|
||||
bcs whole_byte_symbol
|
||||
|
||||
// Nybl encoded value: Put in upper half or lower half of a byte?
|
||||
ldy tokenise_work3
|
||||
ldy __tokenise_work3
|
||||
bne store_low_nybl
|
||||
|
||||
// Store in high nybl -- so shift it into the hi nybl
|
||||
@@ -138,26 +138,26 @@ not_exception_char:
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
sta $0100,y
|
||||
bne stored_nybl // Must be taken, as A cannot be $00
|
||||
|
||||
store_low_nybl:
|
||||
// Low nybl gets added to high nybl already stored in the byte
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
ora $0100,y
|
||||
sta $0100,y
|
||||
|
||||
stored_nybl:
|
||||
// Now toggle the nybl flag
|
||||
lda tokenise_work3
|
||||
lda __tokenise_work3
|
||||
eor #$ff
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work3
|
||||
// And advance the offset if we filled this byte up
|
||||
bne consider_next_char // Taken if byte has a nybl free, i.e., don't advance pointer while half byte remains free
|
||||
|
||||
// Count the filled up byte
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
|
||||
// Add termination byte if required
|
||||
// (This re-writes the same byte again, which we don't care about)
|
||||
@@ -168,15 +168,15 @@ whole_byte_symbol:
|
||||
// But if we have a nybl to flush, then we handle it like
|
||||
// a full exception character
|
||||
|
||||
ldy tokenise_work3
|
||||
ldy __tokenise_work3
|
||||
beq nothing_to_flush
|
||||
|
||||
// Set low nybl to $F to mark next byte as literal
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
lda $0100,y
|
||||
ora #$0f
|
||||
sta $0100,y
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
|
||||
jmp write_literal_and_terminate_if_required
|
||||
|
||||
@@ -190,7 +190,7 @@ nothing_to_flush:
|
||||
consider_next_char:
|
||||
// Pack next char
|
||||
inx
|
||||
dec tokenise_work1
|
||||
dec __tokenise_work1
|
||||
beq !+
|
||||
jmp pack_char_loop
|
||||
!:
|
||||
@@ -198,18 +198,18 @@ consider_next_char:
|
||||
// (but leave flag set so the caller knows if the
|
||||
// bottom nybl might be different if the string were
|
||||
// longer).
|
||||
lda tokenise_work3
|
||||
lda __tokenise_work3
|
||||
beq !+
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
rts
|
||||
!:
|
||||
// Last byte was full, so we need at $00 on the end
|
||||
// (unless a $FE token was written 2 bytes ago)
|
||||
ldy tokenise_work2
|
||||
ldy __tokenise_work2
|
||||
iny
|
||||
lda #$00
|
||||
sta $0100,y
|
||||
inc tokenise_work2
|
||||
inc __tokenise_work2
|
||||
|
||||
rts
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ print_packed_word:
|
||||
|
||||
// Setup pointer to packed words
|
||||
lda #<packed_message_words
|
||||
sta temp_string_ptr+0
|
||||
sta FRESPC+0
|
||||
lda #>packed_message_words
|
||||
sta temp_string_ptr+1
|
||||
sta FRESPC+1
|
||||
|
||||
// Find the word in the list
|
||||
ldy #$ff
|
||||
@@ -69,14 +69,14 @@ packed_word_search:
|
||||
beq found_packed_word
|
||||
|
||||
// $x0 is an end of work marker
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
and #$0f
|
||||
cmp #$00
|
||||
bne !+
|
||||
dex
|
||||
!:
|
||||
// $FE $xx is an end of work marker
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
cmp #$fe
|
||||
bne !+
|
||||
dex
|
||||
@@ -90,7 +90,7 @@ packed_word_search:
|
||||
// Advance to next page if required
|
||||
cpy #$ff
|
||||
bne packed_word_search
|
||||
inc temp_string_ptr+1
|
||||
inc FRESPC+1
|
||||
jmp packed_word_search
|
||||
|
||||
found_packed_word:
|
||||
@@ -99,11 +99,11 @@ found_packed_word:
|
||||
// Make sure we don't wrap on a page boundary
|
||||
tya
|
||||
clc
|
||||
adc temp_string_ptr+0
|
||||
sta temp_string_ptr+0
|
||||
lda temp_string_ptr+1
|
||||
adc FRESPC+0
|
||||
sta FRESPC+0
|
||||
lda FRESPC+1
|
||||
adc #$00
|
||||
sta temp_string_ptr+1
|
||||
sta FRESPC+1
|
||||
|
||||
print_packed_string:
|
||||
ldy #$ff
|
||||
@@ -113,7 +113,7 @@ next_packed_word_char:
|
||||
iny
|
||||
|
||||
// Check for end of word
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
cmp #$00
|
||||
beq end_of_packed_word
|
||||
cmp #$fe
|
||||
@@ -124,13 +124,13 @@ next_packed_word_char:
|
||||
beq end_of_packed_word
|
||||
|
||||
// Check if it is an uncommon char
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
and #$f0
|
||||
cmp #$f0
|
||||
beq is_uncommon_char
|
||||
|
||||
// Is not an uncommon char, so get char of upper nybl
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
|
||||
// Put high nybl into low bits of X
|
||||
lsr
|
||||
@@ -150,7 +150,7 @@ next_packed_word_char:
|
||||
// See if there is a char in the low nybl to print
|
||||
pla
|
||||
tay
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
and #$0f
|
||||
beq end_of_packed_word
|
||||
cmp #$0f
|
||||
@@ -182,7 +182,7 @@ no_lo_nybl_char:
|
||||
|
||||
// If current byte has $0F in low nybl, then the next
|
||||
// byte is a whole byte.
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
and #$0f
|
||||
cmp #$0f
|
||||
beq next_is_literal_char
|
||||
@@ -207,7 +207,7 @@ unpack_literal_char:
|
||||
iny
|
||||
tya
|
||||
pha
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
jsr JCHROUT
|
||||
pla
|
||||
tay
|
||||
@@ -216,7 +216,7 @@ unpack_literal_char:
|
||||
is_uncommon_char:
|
||||
// Lower nybl has offset into low-frequency part of the table
|
||||
|
||||
lda (temp_string_ptr),y
|
||||
lda (FRESPC),y
|
||||
and #$0f
|
||||
clc
|
||||
adc #14
|
||||
|
||||
+24
-24
@@ -1,6 +1,6 @@
|
||||
// Tokenise a line of BASIC
|
||||
// Stored at $0200
|
||||
// Length in tokenise_work1
|
||||
// Length in __tokenise_work1
|
||||
|
||||
tokenise_line:
|
||||
|
||||
@@ -19,7 +19,7 @@ tokenise_line:
|
||||
sta $0112
|
||||
sta QTSW
|
||||
|
||||
lda tokenise_work1
|
||||
lda __tokenise_work1
|
||||
sta $0113
|
||||
|
||||
tokenise_char:
|
||||
@@ -32,11 +32,11 @@ tokenise_char:
|
||||
// End of line reached
|
||||
|
||||
// Finished tokenising line
|
||||
// Update tokenise_work1 and terminate with null
|
||||
// Update __tokenise_work1 and terminate with null
|
||||
ldx $0112
|
||||
lda #$00
|
||||
sta $0200,x
|
||||
stx tokenise_work1
|
||||
stx __tokenise_work1
|
||||
|
||||
// Clear quote mode flag that is also used by KERNAL for screen display
|
||||
lda #$00
|
||||
@@ -50,8 +50,8 @@ tokenise_char:
|
||||
sta $0111
|
||||
|
||||
tokenise_char_loop:
|
||||
// Pack the word from the start (start = X, raw len = tokenise_work1)
|
||||
// Returns packed length in tokenise_work2 and writes the packed
|
||||
// Pack the word from the start (start = X, raw len = __tokenise_work1)
|
||||
// Returns packed length in __tokenise_work2 and writes the packed
|
||||
// word at $0100+
|
||||
|
||||
ldx $0110
|
||||
@@ -88,7 +88,7 @@ tk_might_be_keyword:
|
||||
// Pack string
|
||||
ldx $0110
|
||||
lda $0111
|
||||
sta tokenise_work1
|
||||
sta __tokenise_work1
|
||||
|
||||
// XXX - We should implement an optimisation where we
|
||||
// trim the last symbol of successively, instead of re-packing the word
|
||||
@@ -97,7 +97,7 @@ tk_might_be_keyword:
|
||||
// that are available.
|
||||
|
||||
jsr pack_word
|
||||
lda tokenise_work2
|
||||
lda __tokenise_work2
|
||||
cmp #$10
|
||||
bcc !+
|
||||
// Packed string too long
|
||||
@@ -162,31 +162,31 @@ keyword_search:
|
||||
// Search for the compressed keyword stored at $0100 in the list
|
||||
// of compressed keywords
|
||||
|
||||
// tokenise_work1 = offset in line of input
|
||||
// tokenise_work2 = length of token we are matching
|
||||
// tokenise_work3 = offset in token list
|
||||
// load_or_verify_or_tokenise_work5 = temporary work space
|
||||
// __tokenise_work1 = offset in line of input
|
||||
// __tokenise_work2 = length of token we are matching
|
||||
// __tokenise_work3 = offset in token list
|
||||
// __tokenise_work5 = temporary work space
|
||||
// X and Y registers used as temporary space.
|
||||
// returns C=1 if no matching token, else C=0 and A=token
|
||||
|
||||
lda #$00
|
||||
sta tokenise_work1
|
||||
sta tokenise_work3
|
||||
sta __tokenise_work1
|
||||
sta __tokenise_work3
|
||||
next_kw_offset:
|
||||
// Advance offset in compressed keyword list, to see if a match
|
||||
// BEGINS here
|
||||
|
||||
// Get count of bytes to compare
|
||||
lda tokenise_work2
|
||||
sta load_or_verify_or_tokenise_work5
|
||||
lda __tokenise_work2
|
||||
sta __tokenise_work5
|
||||
|
||||
// Load current position
|
||||
ldy tokenise_work3
|
||||
ldx tokenise_work1
|
||||
ldy __tokenise_work3
|
||||
ldx __tokenise_work1
|
||||
|
||||
// Advance offset in compressed token list, and stop at the end
|
||||
inc tokenise_work3
|
||||
lda tokenise_work3
|
||||
inc __tokenise_work3
|
||||
lda __tokenise_work3
|
||||
cmp #packed_keyword_table_len
|
||||
bne next_in_match
|
||||
jmp done_searching_for_token
|
||||
@@ -198,8 +198,8 @@ next_in_match:
|
||||
inx
|
||||
iny
|
||||
|
||||
dec load_or_verify_or_tokenise_work5 // Have we compared all bytes yet?
|
||||
|
||||
dec __tokenise_work5 // Have we compared all bytes yet?
|
||||
|
||||
bne next_in_match
|
||||
|
||||
// Keyword matches!
|
||||
@@ -212,7 +212,7 @@ next_in_match:
|
||||
// two byte prior is $FE
|
||||
|
||||
// Get offset of first byte of this token
|
||||
ldx tokenise_work3
|
||||
ldx __tokenise_work3
|
||||
dex // pointer points one late, so rewind it
|
||||
|
||||
// At start of list?
|
||||
@@ -233,7 +233,7 @@ next_in_match:
|
||||
jmp next_kw_offset
|
||||
|
||||
word_boundary:
|
||||
// Found a token whose offset is in tokenise_work3
|
||||
// Found a token whose offset is in __tokenise_work3
|
||||
// Now trace back to the start of the compressed keyword list
|
||||
// to work out what keyword number we are, so that we can return
|
||||
// the token number.
|
||||
|
||||
@@ -66,8 +66,8 @@ 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
|
||||
@@ -75,20 +75,20 @@ shift_mem_up_routine:
|
||||
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
|
||||
dec __memmove_src+1
|
||||
dec __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smu1
|
||||
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
|
||||
@@ -96,13 +96,13 @@ shift_mem_down_routine:
|
||||
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
|
||||
inc __memmove_src+1
|
||||
inc __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smd1
|
||||
plp
|
||||
jmp memmap_normal
|
||||
@@ -112,41 +112,41 @@ ram_routines_end:
|
||||
#else // CONFIG_MEMORY_MODEL_60K
|
||||
|
||||
shift_mem_up:
|
||||
// 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.
|
||||
php
|
||||
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
|
||||
dec __memmove_src+1
|
||||
dec __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smu1
|
||||
plp
|
||||
rts
|
||||
|
||||
shift_mem_down:
|
||||
// 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.
|
||||
php
|
||||
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
|
||||
inc __memmove_src+1
|
||||
inc __memmove_dst+1
|
||||
dec __memmove_size+1
|
||||
bne smd1
|
||||
plp
|
||||
rts
|
||||
|
||||
@@ -16,7 +16,7 @@ wedge_dos:
|
||||
|
||||
// Check if user asked for a status
|
||||
ldy #$00
|
||||
lda (basic_current_statement_ptr), y
|
||||
lda (TXTPTR), y
|
||||
bne !+
|
||||
jmp wedge_dos_status // XXX try to optimize this, perhaps move 'wedge_dos_status' above?
|
||||
!:
|
||||
@@ -31,7 +31,7 @@ wedge_dos:
|
||||
cmp #$3A
|
||||
bcs wedge_dos_command // char code after 9
|
||||
iny
|
||||
lda (basic_current_statement_ptr), y
|
||||
lda (TXTPTR), y
|
||||
beq wedge_dos_change_drive // end of buffer
|
||||
cmp #$20
|
||||
beq wedge_dos_change_drive
|
||||
@@ -64,11 +64,11 @@ wedge_dos_change_drive:
|
||||
|
||||
// Reuse the line number parser for device number retrieval
|
||||
jsr basic_parse_line_number
|
||||
lda basic_line_number+1
|
||||
lda LINNUM+1
|
||||
beq !+
|
||||
jmp do_ILLEGAL_QUANTITY_error
|
||||
!:
|
||||
lda basic_line_number+0
|
||||
lda LINNUM+0
|
||||
cmp #$08
|
||||
bpl !+
|
||||
bcs !+
|
||||
@@ -226,13 +226,13 @@ wedge_dos_setnam:
|
||||
ldy #$FF
|
||||
!:
|
||||
iny
|
||||
lda (basic_current_statement_ptr), y
|
||||
lda (TXTPTR), y
|
||||
bne !-
|
||||
|
||||
// Set the name to open
|
||||
tya
|
||||
ldx basic_current_statement_ptr+0
|
||||
ldy basic_current_statement_ptr+1
|
||||
ldx TXTPTR+0
|
||||
ldy TXTPTR+1
|
||||
jmp JSETNAM
|
||||
|
||||
#endif // CONFIG_DOS_WEDGE
|
||||
Reference in new issue
Block a user