From ea5ef8587fd90301c8fc43ff9dd50558a606a536 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sat, 6 May 2017 17:53:15 +0200 Subject: [PATCH] Add .ENABL LCM. Its default setting was incorrect. --- assemble.c | 10 +++++++++ assemble_globals.c | 3 +++ assemble_globals.h | 2 ++ macro11.c | 1 + tests/RunTests | 1 + tests/test-enabl-lcm.lst.ok | 44 +++++++++++++++++++++++++++++++++++++ tests/test-enabl-lcm.mac | 32 +++++++++++++++++++++++++++ 7 files changed, 93 insertions(+) create mode 100644 tests/test-enabl-lcm.lst.ok create mode 100644 tests/test-enabl-lcm.mac diff --git a/assemble.c b/assemble.c index 74d784a..94da852 100644 --- a/assemble.c +++ b/assemble.c @@ -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; diff --git a/assemble_globals.c b/assemble_globals.c index c4ad063..8eedc00 100644 --- a/assemble_globals.c +++ b/assemble_globals.c @@ -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 */ diff --git a/assemble_globals.h b/assemble_globals.h index 5054d38..758c8ea 100644 --- a/assemble_globals.h +++ b/assemble_globals.h @@ -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 */ diff --git a/macro11.c b/macro11.c index d6e99a0..37b6d1c 100644 --- a/macro11.c +++ b/macro11.c @@ -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( diff --git a/tests/RunTests b/tests/RunTests index c06e8e7..c151ffa 100755 --- a/tests/RunTests +++ b/tests/RunTests @@ -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 \ diff --git a/tests/test-enabl-lcm.lst.ok b/tests/test-enabl-lcm.lst.ok new file mode 100644 index 0000000..8c64dd5 --- /dev/null +++ b/tests/test-enabl-lcm.lst.ok @@ -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 .byte 1 + 9 000001 001 .iif idn .byte 1 + 10 000002 001 .iif idn .byte 1 + 11 000003 001 .iif idn .byte 1 + 12 + 13 .iif dif .byte 0 + 14 .iif dif .byte 0 + 15 .iif dif .byte 0 + 16 .iif dif .byte 0 + 17 + 18 .enabl lcm + 19 ; Now: case sensitive + 20 + 21 000004 001 .iif idn .byte 1 + 22 .iif idn .byte 0 + 23 .iif idn .byte 0 + 24 .iif idn .byte 0 + 25 + 26 .iif dif .byte 0 + 27 000005 001 .iif dif .byte 1 + 28 000006 001 .iif dif .byte 1 + 29 000007 001 .iif dif .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) diff --git a/tests/test-enabl-lcm.mac b/tests/test-enabl-lcm.mac new file mode 100644 index 0000000..fcbd188 --- /dev/null +++ b/tests/test-enabl-lcm.mac @@ -0,0 +1,32 @@ +;;;;; +; +; Test case (in)sensitivity of .IF IDN/DIF. +; + + ; Default: case insensitive. + + .iif idn .byte 1 + .iif idn .byte 1 + .iif idn .byte 1 + .iif idn .byte 1 + + .iif dif .byte 0 + .iif dif .byte 0 + .iif dif .byte 0 + .iif dif .byte 0 + + .enabl lcm + ; Now: case sensitive + + .iif idn .byte 1 + .iif idn .byte 0 + .iif idn .byte 0 + .iif idn .byte 0 + + .iif dif .byte 0 + .iif dif .byte 1 + .iif dif .byte 1 + .iif dif .byte 1 + + ; Setting is now non-default. + ; Check if it reverts to default in the next pass.