Mercurial > hg > index.cgi
annotate src/interp.s @ 140:86f6f3a71e60 default tip
Fix some bugs in tokenization/parsing routine
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 16 Jul 2024 22:30:07 -0600 |
parents | e49bd0493baf |
children |
rev | line source |
---|---|
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1 *pragmapush list |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2 *pragma list |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4 ; Fetch next input character, skip spaces. This is structured the way it is to avoid burning any register except A |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5 ; which is used for the returned value. Z will be set if the input character is NUL or a colon. C will be set if the |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6 ; input character is an ASCII digit. This allows testing Z to identify the end of a command due to either a colon or |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7 ; the end of a line. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8 ; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
9 ; Compared to Color Basic, the instruction sequence only varies in the handling of the LDA. In Color Basic, the sequence |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
10 ; is an LDA extended followed by a JMP extended. This totals to 9 cycles (5 for LDA, 4 for JMP). In LWBasic, an LDA |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
11 ; with extended indirect addressing is used. This also totals 9 cycles. The only other difference is when a space is |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
12 ; detected where the branch can be direct to the nextchar code instead of having to branch around a direct page JUMP |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
13 ; which saves 3 cycles for the case where a space is detected. In other words, this is only slower by virtue of the |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
14 ; fact that it is called with an extended JSR instead of a direct JSR which causes one extra cycle to be used there |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
15 ; and one extra byte for each call to nextchar or curchar. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
16 ; |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
17 ; On 6309, native mode saves an extra cycle in the LDA sequence using the LDA extended followed by JMP extended |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
18 ; sequence. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
19 ; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
20 ; This whole thing could be sped up by keeping the input pointer in a register. However, retaining the ability to |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
21 ; use Y without having to save it first is likely more beneficial. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
22 nextchar inc inputptr+1 ; bump LSB of input pointer |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
23 bne curchar ; brif no carry |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
24 inc inputptr ; bump MSB |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
25 curchar lda [inputptr] ; read the byte |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
26 cmpa #'9+1 ; clear C if above ASCII digits, Z if colon |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
27 bhs curchar0 ; brif above the ASCII digits |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
28 cmpa #0x20 ; is it a space? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
29 beq nextchar ; brif so - skip over it |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
30 suba #'0 ; clever way to set C if >= ASCII 0, Z if zero |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
31 suba #-'0 |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
32 curchar0 rts |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
34 ; This is exactly the same as nextchar except it doesn't skip spaces. Unfortunately, for efficiency purposes, we need |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
35 ; to actually duplicate code here. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
36 nextcharraw inc inputptr+1 ; bump LSB of input pointer |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
37 bne curchar ; brif no carry |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
38 inc inputptr ; bump MSB |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
39 curcharraw lda [inputptr] ; fetch the byte |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
40 cmpa #'9+1 ; clear C if above digits, set Z if colon |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
41 bhs curcharraw0 ; brif above digits |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
42 suba #'0 ; clever way to set C if >= ASCII 0, Z if zero |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
43 suba #-'0 |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
44 curcharraw0 rts |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
76
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
46 ; Set carry if upper/lower case alpha |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
47 setcifalpha cmpa #'z+1 ; is it above lower case Z? |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
48 bhs setcifalpha0 ; brif so, C clear |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
49 suba #'a ; set C if >= lower case A |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
50 suba #-'a |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
51 bcs setcifalpha0 ; brif lower case alpha |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
52 setcifualpha cmpa #'Z+1 ; is it above upper case Z? |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
53 bhs setcifalpha0 ; brif so, C clear |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
54 suba #'A ; set C if >= upper case A |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
55 suba #-'A |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
56 setcifalpha0 rts |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
58 ; Set carry if digit |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
59 setcifdigit cmpa #'9+1 ; is it above digit 9? |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
60 bhs setcifdigit0 ; brif so, C clear |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
61 suba #'0 ; set C if >= digit 0 |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
62 suba #-'0 |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
63 setcifdigit0 rts |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
65 ; Immediate mode handler. This operates as follows: |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
66 ; 1. Write a newline if needed |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
67 ; 2. Output the prompt if needed |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
68 ; 3. Read an input line |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
69 ; 4. If the line is terminated by BREAK/ESC, go back to 3 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
70 ; 5. Find the first non-space character. If it is numeric, go on to 7 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
71 ; 6. Tokenize the input line, interpret it, and go back to 1 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
72 ; 7. Parse the line number. If it is invalid, do a syntax error |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
73 ; 8. Find the line number in the program and remove it if present |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
74 ; 9. If there is no non-space character after the number, go back to 3 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
75 ; 10. Tokenize the line and insert it into the program |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
76 ; 11. Go back to 3 |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
77 immediate jsr writecondnl ; do newline if required |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
78 ldx #prompt ; point to prompt string |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
79 jsr console_outstrn |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
80 immediate0 jsr readline ; read input line |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
81 bcs immediate0 ; brif ended with BREAK |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
82 ldx #linebuff ; point to start of line input buffer |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
83 immediate0a lda ,x+ ; do we have anything at all? |
126
ac183a519439
Update parsing scheme with a keyword lookup by token value and other framework
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
84 beq immediate0 ; brif not - just read another line |
ac183a519439
Update parsing scheme with a keyword lookup by token value and other framework
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
85 cmpa #0x20 ; space? |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
86 beq immediate0a ; brif so |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
87 leax -1,x ; compensate for extra increment above |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
88 bsr setcifdigit ; do we have a line number? |
126
ac183a519439
Update parsing scheme with a keyword lookup by token value and other framework
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
89 bcs immediate1 ; brif so - go handle program editing |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
90 jsr parse ; parse the line into tokens |
131
95f174bf459b
Add error handling for immediate mode loop
William Astle <lost@l-w.ca>
parents:
128
diff
changeset
|
91 bcs immediatee ; brif there was a parse error |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
92 jsr interpretline ; go interpret the tokenized line |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
93 bra immediate ; go handle another line |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
94 immediatee jmp SNERROR ; go do a syntax error |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
95 immediate1 stx inputptr ; save input pointer for parsing purposes |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
96 bsr parse_lineno ; parse the line number that was provided |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
97 bsr prog_delline ; remove the line from the program if it exists |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
98 jsr curchar ; skip any spaces after line number |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
99 tsta ; is it the end of input (don't test for colon) |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
100 beq immediate6 ; brif so - we don't need to insert a line |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
101 ldx inputptr ; point to line text |
128
9d57279c900e
Remove old style keyword lists and jump tables
William Astle <lost@l-w.ca>
parents:
126
diff
changeset
|
102 jsr parse ; tokenize line, get length to D |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
103 ldd binval ; get the line number |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
104 jsr prog_addline ; insert the encoded line at X into program as line Y |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
105 immediate6 ldx vartab ; clear out variables |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
106 stx objecttab |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
107 stx freestart |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
108 bra immediate0 ; go handle more input |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
110 ; Parse a line number and return it in binval; raise syntax error if the line number overflows 16 bits unsigned. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
111 ; Preserves; registers except D. This will accept the entire 16 bit unsigned number range which is why there is |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
112 ; a BCS after every shift or add. Enter with the input pointer pointing to the number to parse. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
113 parse_lineno ldd zero ; clear out accumlator but preserve carry flag |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
114 std binval |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
115 jsr curchar ; set flags on current character; skip spaces |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
116 bcc parse_lineno1 ; brif first character wasn't a digit - default to zero |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
117 parse_lineno0 suba #0x30 ; adjust to binary digit |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
118 pshs a ; save digit so we can add it later |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
119 ldd binval ; get accumulated number |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
120 lslb ; multiply accumulator by 10 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
121 rola ; times 2 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
122 bcs parse_lineno2 ; brif overflow |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
123 lslb |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
124 rola ; times 4 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
125 bcs parse_lineno2 ; brif overflow |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
126 addd binval ; times 5 (add orignal value to times 4) |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
127 bcs parse_lineno2 ; brif overflow |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
128 lslb |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
129 rola ; times 10 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
130 bcs parse_lineno2 ; brif overflow |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
131 addb ,s+ ; add in accumulated digit |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
132 adca #0 |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
133 bcs parse_lineno2 ; brif overflow |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
134 std binval ; save accumulated number |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
135 jsr nextcharraw ; get next input character; DO NOT skip spaces |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
136 bcs parse_lineno0 ; brif it's also a digit |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
137 parse_lineno1 rts |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
138 parse_lineno2 jmp SNERROR ; relay to syntax error |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
140 ; Find line number table entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
141 ; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
142 ; Entry: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
143 ; D: the desired line number |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
144 ; |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
145 ; Exit: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
146 ; U: pointer to line number table entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
147 ; CC.C: clear |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
148 ; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
149 ; Error: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
150 ; CC.C: set |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
151 ; |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
152 ; This works by doing a binary search through the line number table. |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
153 prog_findline ldu prog_linetab ; point to program line table |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
154 ldx prog_linetabp ; get end of table |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
155 leax -linetabent_size,u ; move back to the start of the last entry |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
156 pshs x,u ; save "high" at 0,s and "low" at 2,s |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
157 tfr d,x ; save line number for later comparisons |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
158 prog_findline1 ldd ,s ; get high pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
159 subd 2,s ; get different with low pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
160 bcs prog_findline2 ; brif high is below low - we didn't find it |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
161 lsra ; find half way |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
162 rorb |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
163 andb #0b11111100 ; round down for 4 bytes per entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
164 addd prog_linetab ; offset into line table |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
165 tfr d,u ; move to a pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
166 cmpx linetabent_num,u ; is the desired number less, equal, or greater? |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
167 beq prog_findline2 ; brif match |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
168 blo prog_findline3 ; brif desired line is lower |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
169 leau linetabent_size,u ; skip past this non-matching item |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
170 stu 2,s ; save new low pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
171 bra prog_findline1 ; go do another iteration |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
172 prog_findline2 leas 4,s ;* clean up the temporaries (C clear from compare above or set from |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
173 rts ;* subtraction above |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
174 prog_findline3 leau -linetabent_size,u ; move before this non-matching entry |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
175 stu ,s ; save new top entry pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
176 bra prog_findline1 ; go do another iteration |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
177 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
178 ; Delete a line from the program: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
179 ; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
180 ; Entry: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
181 ; D: the line number to delete |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
182 ; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
183 ; This routine removes a line from the program. This works by deallocating the line data and moving all subsequent |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
184 ; line data forward to close the gap. The line table pointer will also be removed and the subsequent line table |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
185 ; entries will also be brought forward to fill the gap. While closing the gap in the line table, the line data |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
186 ; pointers will be adjusted to account for the relocation of the line data following the deleted line. The line number |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
187 ; table size allocation will not be adjusted. |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
188 prog_delline bsr prog_findline ; get a pointer to the desired line table entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
189 bcs prog_delline3 ; brif the line wasn't in the program - we have nothing to do |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
190 ldd linetabent_size+linetabent_ptr,u ; get pointer to next line data |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
191 subd linetabent_ptr,u ; now D is the length of the line data to collapse out |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
192 pshs d ; save the calculated length - we need it for later |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
193 ldy linetabent_ptr,u ; get pointer to the line data to delete |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
194 leax d,y ; point to data to move |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
195 bra prog_delline1 ; go handle the loop, including the case where we copy nothing |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
196 prog_delline0 lda ,x+ ; copy a byte down |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
197 sta ,y+ |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
198 prog_delline1 cmpx vartab ; at the end of the program? |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
199 blo prog_delline0 ; brif not |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
200 sty vartab ; save new variable table location |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
201 prog_delline2 ldx linetabent_size+linetabent_num,u ; get number of next line |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
202 ldd linetabent_size+linetabent_ptr,u ; get pointer for next line |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
203 subd ,s ; adjust for length removed in the line data |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
204 std ,u++ ; save in the vacated entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
205 stx ,u++ |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
206 cmpu prog_linetabp ; at the end of allocated table entries? |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
207 blo prog_delline2 ; brif not |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
208 leau -linetabent_size,u ; move back to the last actual entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
209 stu prog_linetabp ; update the line table pointer |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
210 bsr prog_shrinklt ; shrink the line table if appropriate |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
211 jmp cmd_newvars ; clear out the variable table |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
212 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
213 ; prog_shrinklt: shrink the line table to its minimum possible size, but keep it a multiple of linetab_stride entries. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
214 ; This will leave the state of the variable table undefined so it needs to be cleared out properly before doing anything |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
215 ; else after using this routine. |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
216 prog_shrinklt ldd prog_linetabp ; get the end of the table entries |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
217 subd prog_linetab ; now we have the length of the table |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
218 pshs d ; save original size |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
219 bitb #(linetabent_size*linetab_stride)-1 ; is there a remainder? |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
220 beq prog_shrinklt0 ; brif not |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
221 andb #~((linetabent_size*linetab_stride)-1) ; actually round down now |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
222 addd #linetabent_size*linetab_stride ; and go up to the next stride |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
223 prog_shrinklt0 subd ,s++ ; now D is the difference in size; will be negative if shrinking |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
224 bne prog_resizelt ; brif there is something to do - go resize the table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
225 prog_delline3 rts |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
226 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
227 ; prog_expandlt: expand the line table by one stride size. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
228 prog_expandlt ldd #linetabent_size*linetab_stride ; get size of an expansion strider |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
229 ; fall through to the resize routine |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
230 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
231 ; Adjust the size of the program line table, either larger or smaller. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
232 ; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
233 ; Enter: |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
234 ; D: the number of bytes to expand the table by; negative to shrink it; must be a multiple of the table entry size |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
235 ; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
236 ; Exit: |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
237 ; D: the number of bytes the table was expanded (negative means shrinkage) |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
238 ; * prog_text: points to the new start of the program text |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
239 ; * vartab: points to the new start of the variable table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
240 ; * all program line pointers are adjusted by D bytes |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
241 ; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
242 ; Error: |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
243 ; * OM error if there isn't enough memory to expand the table by D bytes |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
244 prog_resizelt pshs d ; we're going to need the size number later |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
245 ldu prog_text ; point to start of program text |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
246 leax d,u ; point to the new address to copy to |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
247 addd vartab ; calculate the new start of the variable table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
248 tfr d,y ; save it for later |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
249 jsr mem_checkptr ; throw an error if it doesn't fit |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
250 ldd vartab ; get the end of the program text |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
251 subd prog_text ; now D is the number of bytes to copy |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
252 stx prog_text ; save new program text pointer |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
253 sty vartab ; save new variable table pointer |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
254 jsr mem_copy ; copy the program text up or down |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
255 ldx prog_linetab ; point to first entry in the program line table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
256 prog_resizelt0 ldd linetabent_ptr,x ; get the pointer for this entry |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
257 addd ,s ; add in the offset |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
258 std linetabent_ptr,x ; save updated pointer |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
259 leax 4,x ; move to next entry |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
260 cmpx prog_text ; end of table? |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
261 blo prog_resizelt0 ; brif not |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
262 puls d,pc ; clean up stack and return |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
264 ; Insert a line into the program. |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
265 ; |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
266 ; Note that we do a sequential walk back from the end of the line table looking for the insert location because we can |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
267 ; update all the line data pointers on the way through and that has to be done one by one anyway. |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
268 ; |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
269 ; Entry: |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
270 ; D: length of line to insert |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
271 ; X: pointer to line data to insert *which MUST be within the prog_text...vartab area* |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
272 ; U: the line number we're adding |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
273 prog_addline pshs d,x,u ; save length and pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
274 ldx prog_linetabp ; get line table pointer |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
275 leax linetabent_size,x ; add in space for new entry |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
276 cmpx prog_text ; did we run into the program? |
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
277 blo prog_addline0 ; brif not |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
278 bsr prog_expandlt ; expand the program line table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
279 ldx 2,s ; adjust the pointer for the line to insert |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
280 leax d,x |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
281 stx 2,s |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
282 prog_addline0 ldu prog_linetabp ; point to the end of the line table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
283 leax linetabent_size,x ; point to the new end of the table |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
284 stx prog_linetabp ; save new end of table pointer |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
285 ldd linetabent_ptr,u ; move the dummy end of table pointer up one slot |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
286 addd ,s ; (and adjust for the insert) |
132
917b4893bb3d
Checkpoint before redoing a bunch of code for clarity
William Astle <lost@l-w.ca>
parents:
131
diff
changeset
|
287 std linetabent_ptr,x |
136
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
288 ldx 4,s ; get the new line number |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
289 prog_addline1 cmpu prog_linetab ; are we at the start of the line table? |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
290 beq prog_addline2 ; brif so - we're inserting here |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
291 cmpx -linetabent_size+linetabent_num,u ; how does this line compare with the previous table entry? |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
292 bhs prog_addline2 ; brif our number is larger (or equal) to previous entry number |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
293 ldd -linetabent_size+linetabent_num,u ; copy line number up one slot |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
294 std linetabent_num,u |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
295 ldd -linetabent_size+linetabent_ptr,u ; get pointer of that entry |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
296 addd ,s ; add the size of the newly inserted line to adjust for after insert |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
297 std linetabent_ptr,u ; save it in the new slot |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
298 leau -linetabent_size,u ; move back a slot |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
299 bra prog_addline1 ; go check another slot |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
300 prog_addline2 ldd linetabent_size+linetabent_ptr,u ; get pointer to the line to move out of the way |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
301 subd ,s ; unadjust for the insert size - get original location |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
302 std linetabent_ptr,u ; set the data pointer for the new entry |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
303 stx linetabent_num,u ; set the line number for this entry |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
304 tfr d,x ; set insertion point |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
305 ldu 2,s ; get the source data to insert |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
306 ldd ,s ; get length of source data |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
307 jsr mem_insert ; shift the block into place |
e49bd0493baf
Checkpoint updates to immediate mode program editing and some memory handling
William Astle <lost@l-w.ca>
parents:
132
diff
changeset
|
308 jmp cmd_newvars ; erase variables and return |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
309 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
310 ; Main interpretation loop |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
311 ; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
312 ; Enter at interpret with inputptr pointing to the code stream to interpret. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
313 ; Enter at interpretline with X pointing to the command stream to interpret which will return to the caller one the |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
314 ; command stream has completed. STOP or BREAK will return with carry set while END or falling off the end of the |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
315 ; code will return with carry clear. In the event of an error, the usual error processing will be done and control |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
316 ; will return to immediate mode with the stack reset. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
317 interpret jsr breakcheck ; check for BREAK |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
318 bcs cmd_stop0 ; brif BREAK detected - go stop the program |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
319 ldx inputptr ; get interpration address |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
320 stx curstmt ; save address of the current statement (needed for some stuff) |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
321 lda ,x+ ; are we at the end of the line? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
322 beq interpret0 ; brif so |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
323 cmpa #': ; end of statement? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
324 beq interpret3 ; brif so - do a statement |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
325 SNERROR ldb #err_sn ; raise a syntax error |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
326 jmp ERROR |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
327 interpret0 sta endflag ; flag the program exit state as "END" (will be zero) |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
328 ldd curline ; were we in immediate mode? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
329 bne interpret1 ; brif not |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
330 clra ; clear carry to indicate normal exit |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
331 rts ; return to caller |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
332 interpret1 ldd ,x ; are we at the end of the program? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
333 beq interpret4 ; brif so - bail out |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
334 stx curline ; save pointer to current line |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
335 leax 3,x ; set input pointer one before the start of the line text |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
336 interpret2 stx inputptr |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
337 interpret3 jsr nextchar ; fetch first character of next statement |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
338 beq interpret ; brif end of statement - do the next statement dance |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
339 tsta ; set flags properly for token |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
340 lbpl cmd_let ; brif no command - do assignment (LET command is optional) |
128
9d57279c900e
Remove old style keyword lists and jump tables
William Astle <lost@l-w.ca>
parents:
126
diff
changeset
|
341 ldx #exectab_cmd ; point to jump table |
74
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
342 leax a,x ; get half way to the correct offset |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
343 ldx a,x ; get the address the other half of the way from here |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
344 jsr nextchar ; skip past token and set flags |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
345 jsr ,x ; call the routine |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
346 bra interpret ; go handle the next statement dance |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
347 interpret4 bsr cmd_stop1 ; make sure stack is aligned correctly (will not return) |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
348 interpretline clr curline ; blank out current line pointer (for immediate mode) |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
349 clr curline+1 |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
350 leax -1,x ; move back before start of code stream |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
351 bra interpret2 ; go interpret this statement and then continue with stuff |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
352 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
353 ; Check for character in B and raise a syntax error if not found at current input pointer. If it is found, fetch the |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
354 ; next input character. |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
355 syncheckb cmpb [inputptr] ; do we have a syntax match? |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
356 bne SNERROR ; brif not |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
357 jmp nextchar ; return next input character |
e74d00ac6b79
Split some code into separate files for easier management (2)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
358 *pragmapop list |