Mercurial > hg > index.cgi
annotate src/expr.s @ 84:f959c92bc329
New first pass implementation of number parsing, untested
Rewrite number parsing using recently constructed infrastructure. The result
is untested.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 08 Oct 2023 00:17:20 -0600 |
parents | bb50ac9fdf37 |
children | b0422868a7b1 |
rev | line source |
---|---|
75
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
1 *pragmapush list |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
2 *pragma list |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
4 ; The LET command which is the default if no token begins a statement |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
5 cmd_let jmp SNERROR ; not yet implemented |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
7 ; Expression Evaluation Package |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
8 ; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
9 ; This is the expression evaluator. It handles everything from parsing numbers to dispatching function calls. The main |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
10 ; entry point is eval_expr which will evaluate an arbitrary expression. It returns as soon as it reaches something it |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
11 ; doesn't understand as part of an expression. |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
12 ; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
13 ; The special handling for relational operators is required because Basic allows them in all |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
14 eval_expr clrb ; flag previous operator as minimum precdence (end of expression) |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
15 eval_expraux jsr eval_term ; evaluate the first term of the expression |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
16 eval_expr0 jsr curchar ; fetch current input |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
17 beq eval_expr1 ; brif end of expression - we're done |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
18 cmpa #tok_or ; is it above operators? |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
19 bhi eval_expr1 ; brif so |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
20 suba #tok_plus ; offset to zero for first operator token |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
21 bcc eval_expr2 ; brif it is an operator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
22 eval_expr1 rts |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
23 eval_expr2 pshs b ; save previous operator precedence |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
24 ldx #oper_tab ; point to operator table |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
25 tfr a,b ; shift to B for "ABX" |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
26 abx ; add three times (3 bytes per entry) |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
27 abx ; OBS: TFR + ABX + ABX + ABX is faster than LDB + MUL + ABX |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
28 abx ; now X points to the operator entry in the table |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
29 ldb ,x ; get precedence of current operation |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
30 cmpb ,s ; is it higher than the current operation? |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
31 bhi eval_expr3 ; brif so - process this operator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
32 puls b,pc ; return current value to complete previous operation |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
33 eval_expr3 jsr nextchar ; eat the operator token |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
34 ldx 1,x ; get handler address of this operator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
35 leas -val.size,s ; make room for the result accumulator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
36 pshs x ; save handler address for later |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
37 lda val0+val.type ; get current value type |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
38 ldx val0 ; get value accumlator contents (6 bytes) |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
39 ldy val0+2 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
40 ldu val0+4 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
41 pshs a,x,y,u ; save it on the stack |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
42 jsr eval_expraux ; evaluate the following term and higher precedence expressions |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
43 puls a,x,y,u ; get back saved value |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
44 stx val1 ; save it to the second value accumulator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
45 sty val1+2 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
46 stu val1+4 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
47 sta val1+val.type ; save previous value type |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
48 ldx #val1 ; point to left operand |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
49 ldu #val0 ; point to right operand |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
50 leay 2,s ; point to return value location |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
51 jsr [,s++] ; go handle the operator |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
52 puls a,x,y,u ; get return value |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
53 sta val0 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
54 stx val0+1 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
55 sty val0+3 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
56 stu val0+5 |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
57 puls b ; get back the previous operator precedence |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
58 bra eval_expr0 ; go process another operator or end of expression |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
59 eval_term jsr curchar ; get current input character |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
60 beq eval_term0 ; brif end of input - this is an error |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
61 bcs eval_number ; brif digit - we have a number |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
62 ; bmi eval_func ; brif we have a token - handle function call |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
63 cmpa #'. ; decimal point? |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
64 beq eval_number ; brif so - evaluate number |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
65 cmpa #'- ; negative sign? |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
66 beq eval_number ; brif so - evaluate number |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
67 cmpa #'+ ; positive sign? |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
68 beq eval_number ; brif so - evaluate number |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
69 eval_term0 jmp SNERROR ; we have something unrecognized - raise error |
77
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
71 ; Evaluate a numeric constant. This process works as follows: |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
72 ; |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
73 ; 0. Clear the value to a zero integer |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
74 ; 1. Check for signs and flag appropriately |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
75 ; 2. Read character |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
76 ; 3. If decimal or exponential indicator, go to step 6 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
77 ; 4. If not digit, return integer result |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
78 ; 5. Multiply accumulator by 10 and add digit value; go back to step 2 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
79 ; 6. Convert accumulator to floating point; set accumulated decimal exponent and decimal flag to 0 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
80 ; 7. If decimal point, flag decimal seen (0xff) and go to step 15 (or raise error if second decimal point) |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
81 ; 8. If digit, multiply by 10 and add digit value; go to step 15 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
82 ; 9. If E or e, go handle decimal exponent at step 12 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
83 ; 10. Apply accumulated decimal exponent to the result (through multiplication/division by 10) |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
84 ; 11. Return floating point result |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
85 ; 12. Read character |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
86 ; 13. If not digit, go handle return at step 10 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
87 ; 14. Multiply exponent accumulator by 10 and add digit value; raise error on overflow or go back to step 12 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
88 ; 15. Read a character and go to step 7 |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
89 ; |
ba559f231929
Initial modification for number parser that handles floats and ints
William Astle <lost@l-w.ca>
parents:
76
diff
changeset
|
90 ; If the result ends up being larger than a floating point value can hold, return Overflow |
84
f959c92bc329
New first pass implementation of number parsing, untested
William Astle <lost@l-w.ca>
parents:
80
diff
changeset
|
91 eval_number jmp val_parsenum ; if we don't recognize anything else, just parse a numer |
75
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
92 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
93 ; Operator table |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
94 ; |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
95 ; Each entry starts with the precedence value followed by the handler routine. Each handler will receive its left |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
96 ; operand in val1 and its right operand in val0 and should return its result in val0. |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
97 oper_tab fcb 0x79 ; addition |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
98 fdb oper_plus |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
99 fcb 0x79 ; subtraction |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
100 fdb oper_minus |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
101 fcb 0x7b ; multiplication |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
102 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
103 fcb 0x7b ; division |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
104 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
105 fcb 0x7f ; exponentiation |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
106 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
107 fcb 0x64 ; less than |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
108 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
109 fcb 0x64 ; equal to |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
110 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
111 fcb 0x64 ; greater than |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
112 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
113 fcb 0x64 ; less than or equal to |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
114 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
115 fcb 0x64 ; greater than or equal to |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
116 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
117 fcb 0x64 ; not equal to |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
118 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
119 fcb 0x50 ; boolean AND |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
120 fdb SNERROR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
121 fcb 0x46 ; boolean OR |
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
122 fdb SNERROR |
76
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
123 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
124 ; Operator handling routines |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
125 ; |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
126 ; binary plus: addition and concatenation |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
127 oper_plus ldb val.type,x ; get type of the left operand |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
128 cmpb valtype_string ; is it string? |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
129 bne oper_plus0 ; brif not |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
130 cmpb val.type,u ; is right operand also string? |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
131 lbeq SNERROR ; brif so - do string concatenation |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
132 oper_plus0 jsr val_matchtypes ; go match data types |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
133 jmp val_add ; go add the values |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
134 ; binary minus: subtraction |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
135 oper_minus jsr val_matchtypes ; go match data types |
eb2681108660
Split some code into separate files for easier management (4)
William Astle <lost@l-w.ca>
parents:
75
diff
changeset
|
136 jmp val_sub ; do subtraction |
75
5f8f0b0781e8
Split some code into separate files for easier management (3)
William Astle <lost@l-w.ca>
parents:
diff
changeset
|
137 *pragmapop list |