Add .ENABL LCM. Its default setting was incorrect.

This commit is contained in:
Olaf Seibert 2017-05-06 17:53:15 +02:00
parent f3af0d060f
commit ea5ef8587f
7 changed files with 93 additions and 0 deletions

View File

@ -719,6 +719,8 @@ static int assemble(
enabl_gbl = 1;
} else if (strcmp(label, "LC") == 0) {
enabl_lc = 1;
} else if (strcmp(label, "LCM") == 0) {
enabl_lcm = 1;
}
free(label);
cp = skipdelim(cp);
@ -738,6 +740,8 @@ static int assemble(
enabl_gbl = 0;
} else if (strcmp(label, "LC") == 0) {
enabl_lc = 0;
} else if (strcmp(label, "LCM") == 0) {
enabl_lcm = 0;
}
free(label);
cp = skipdelim(cp);
@ -828,6 +832,12 @@ static int assemble(
thing2 = getstring(cp, &cp);
else
thing2 = memcheck(strdup(""));
if (!enabl_lcm) {
upcase(thing1);
upcase(thing2);
}
ok = (strcmp(thing1, thing2) == 0);
if (label[0] == 'D') {
ok = !ok;

View File

@ -36,6 +36,9 @@ int enabl_gbl = 1; /* Implicit definition of global symbols */
int enabl_lc = 1; /* If lowercase disabled, convert assembler
source to upper case. */
int enabl_lcm = 0; /* If lowercase disabled, .IF IDN/DIF are
case-sensitive. */
int suppressed = 0; /* Assembly suppressed by failed conditional */

View File

@ -46,6 +46,8 @@ extern int enabl_gbl; /* Implicit definition of global symbols */
extern int enabl_lc; /* If lowercase disabled, convert assembler
source to upper case. */
extern int enabl_lcm; /* If lowercase disabled, .IF IDN/DIF are
case-sensitive. */
extern int suppressed; /* Assembly suppressed by failed conditional */
extern MLB *mlbs[MAX_MLBS]; /* macro libraries specified on the command line */

View File

@ -201,6 +201,7 @@ void prepare_pass(int this_pass, STACK *stack, int nr_files, char **fnames)
sect_sp = -1;
suppressed = 0;
enabl_lc = 1;
enabl_lcm = 0;
}
int main(

View File

@ -11,6 +11,7 @@ TESTS="test-asciz \
test-blkb \
test-bsl-mac-arg \
test-complex-reloc \
test-enabl-lcm \
test-endm \
test-if \
test-impword \

View File

@ -0,0 +1,44 @@
1 ;;;;;
2 ;
3 ; Test case (in)sensitivity of .IF IDN/DIF.
4 ;
5
6 ; Default: case insensitive.
7
8 000000 001 .iif idn <hallo> <hallo> .byte 1
9 000001 001 .iif idn <HALLO> <hallo> .byte 1
10 000002 001 .iif idn <hallo> <HALLO> .byte 1
11 000003 001 .iif idn <HAllo> <halLO> .byte 1
12
13 .iif dif <hallo> <hallo> .byte 0
14 .iif dif <HALLO> <hallo> .byte 0
15 .iif dif <hallo> <HALLO> .byte 0
16 .iif dif <HAllo> <halLO> .byte 0
17
18 .enabl lcm
19 ; Now: case sensitive
20
21 000004 001 .iif idn <hallo> <hallo> .byte 1
22 .iif idn <HALLO> <hallo> .byte 0
23 .iif idn <hallo> <HALLO> .byte 0
24 .iif idn <HAllo> <halLO> .byte 0
25
26 .iif dif <hallo> <hallo> .byte 0
27 000005 001 .iif dif <HALLO> <hallo> .byte 1
28 000006 001 .iif dif <hallo> <HALLO> .byte 1
29 000007 001 .iif dif <HAllo> <halLO> .byte 1
30
31 ; Setting is now non-default.
32 ; Check if it reverts to default in the next pass.
32
Symbol table
. ******R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000010 001 (RW,I,LCL,REL,CON,NOSAV)

32
tests/test-enabl-lcm.mac Normal file
View File

@ -0,0 +1,32 @@
;;;;;
;
; Test case (in)sensitivity of .IF IDN/DIF.
;
; Default: case insensitive.
.iif idn <hallo> <hallo> .byte 1
.iif idn <HALLO> <hallo> .byte 1
.iif idn <hallo> <HALLO> .byte 1
.iif idn <HAllo> <halLO> .byte 1
.iif dif <hallo> <hallo> .byte 0
.iif dif <HALLO> <hallo> .byte 0
.iif dif <hallo> <HALLO> .byte 0
.iif dif <HAllo> <halLO> .byte 0
.enabl lcm
; Now: case sensitive
.iif idn <hallo> <hallo> .byte 1
.iif idn <HALLO> <hallo> .byte 0
.iif idn <hallo> <HALLO> .byte 0
.iif idn <HAllo> <halLO> .byte 0
.iif dif <hallo> <hallo> .byte 0
.iif dif <HALLO> <hallo> .byte 1
.iif dif <hallo> <HALLO> .byte 1
.iif dif <HAllo> <halLO> .byte 1
; Setting is now non-default.
; Check if it reverts to default in the next pass.