1
0
mirror of https://github.com/fachat/xa65.git synced 2024-06-18 11:29:34 +00:00

oplisting

This commit is contained in:
Andre Fachat 2023-11-02 11:17:52 +01:00
parent 77471ee3d9
commit a7b667f284
5 changed files with 51 additions and 11 deletions

View File

@ -448,8 +448,8 @@ int list_tokens(char *buf, signed char *input, int len) {
#endif
}
int operator = 0;
while (inp < len) {
int operator = 0;
switch(input[inp]) {
case T_CAST:
@ -582,11 +582,14 @@ int list_tokens(char *buf, signed char *input, int len) {
if (operator && inp < len) {
signed char op = input[inp];
if (op > 0 && op <= 17) {
if (op > 0 && op <= 20) { // sizeof(arith_ops)
outp += list_string(buf+outp, formatp->escape(arith_ops[op]));
inp += 1;
operator = 0;
}
operator = 0;
// note: falls through for closing brackets which are where an operator would normally be.
// closing bracket is then printed in upper (operand) part in default case before
// another operator is expected after the bracket
}
}
end:

View File

@ -105,13 +105,13 @@ char *kt[] ={
/* arithmetic operators (purely for listing, parsing is done programmatically */
char *arith_ops[] = {
"", "+", "-",
"*", "/",
">>", "<<",
"<", ">", "="
"<=", ">=", "<>",
"&", "^", "|",
"&&", "||", "==", "!=", "!"
"", "+", "-", // 0,1,2
"*", "/", // 3,4
">>", "<<", // 5,6
"<", ">", "=", // 7,8,9
"<=", ">=", "<>", // 10,11,12
"&", "^", "|", // 13,14,15
"&&", "||", "==", "!=", "!" // 16,17,18,19,20
};
/* length of arithmetic operators indexed by operator number */

View File

@ -7,7 +7,11 @@ XA=../../xa
CA65=ca65
LD65=ld65
tests: assertx.out assertx.html linebreakx.out include1x.out listblocksx.html listca65x.html listca65_2x.html
tests: operatorsx.out assertx.out assertx.html linebreakx.out include1x.out listblocksx.html listca65x.html listca65_2x.html
operatorsx.out: operators.a65
${XA} -P- -o operatorsx.o65 $< > $@
../hextool -cmp=operators.out < $@
assertx.out: assert.a65
${XA} -P- -o assertx.o65 $< > $@

View File

@ -0,0 +1,16 @@
la9a5 =$a9a5
lac15 =$ac15
lad24 =$ad24
lb3c0 =$b3c0
laf28 =$af28
x1 =(la9a5^laf28)&$00ff
x2 =(lac15^laf28)&$00ff
x3 =(lad24^laf28)&$00ff
x4 =(lb3c0^laf28)&$00ff
x5 =$ff&(la9a5|laf28)
x6 =$ff&(la9a5|laf28)&$00ff

View File

@ -0,0 +1,17 @@
operators.a65
3 A:1000 la9a5=$a9a5
4 A:1000 lac15=$ac15
5 A:1000 lad24=$ad24
6 A:1000 lb3c0=$b3c0
7 A:1000 laf28=$af28
9 A:1000 x1=(la9a5^laf28)&$ff
10 A:1000 x2=(lac15^laf28)&$ff
11 A:1000 x3=(lad24^laf28)&$ff
12 A:1000 x4=(lb3c0^laf28)&$ff
14 A:1000 x5=$ff&(la9a5|laf28)
15 A:1000 x6=$ff&(la9a5|laf28)&$ff