diff --git a/assemble_globals.c b/assemble_globals.c index 8eedc00..3311c2d 100644 --- a/assemble_globals.c +++ b/assemble_globals.c @@ -24,9 +24,10 @@ int last_locsym = 32768; /* The last local symbol number generate int enabl_debug = 0; /* Whether assembler debugging is enabled */ -int enabl_ama = 0; /* When set, chooses absolute (037) versus +int opt_enabl_ama = 0; /* May be changed by command line */ +int enabl_ama; /* When set, chooses absolute (037) versus PC-relative */ -/* (067) addressing mode */ + /* (067) addressing mode */ int enabl_lsb = 0; /* When set, stops non-local symbol definitions from delimiting local symbol sections. */ diff --git a/assemble_globals.h b/assemble_globals.h index 758c8ea..df43e4b 100644 --- a/assemble_globals.h +++ b/assemble_globals.h @@ -35,9 +35,11 @@ extern int last_locsym; /* The last local symbol number generated */ extern int enabl_debug; /* Whether assembler debugging is enabled */ +extern int opt_enabl_ama; /* May be changed by command line */ + extern int enabl_ama; /* When set, chooses absolute (037) versus PC-relative */ -/* (067) addressing mode */ + /* (067) addressing mode */ extern int enabl_lsb; /* When set, stops non-local symbol definitions from delimiting local symbol sections. */ diff --git a/macro11.c b/macro11.c index a030a1d..687177b 100644 --- a/macro11.c +++ b/macro11.c @@ -61,9 +61,9 @@ static void enable_tf( int tf) { if (strcmp(opt, "AMA") == 0) - enabl_ama = tf; + opt_enabl_ama = tf; else if (strcmp(opt, "GBL") == 0) - enabl_gbl = tf; + enabl_gbl = tf; /* Unused in pass 2 */ else if (strcmp(opt, "ME") == 0) list_me = tf; else if (strcmp(opt, "BEX") == 0) @@ -199,6 +199,7 @@ void prepare_pass(int this_pass, STACK *stack, int nr_files, char **fnames) suppressed = 0; enabl_lc = 1; enabl_lcm = 0; + enabl_ama = opt_enabl_ama; } int main( diff --git a/tests/RunTests b/tests/RunTests index 8f8dddc..e2edfa2 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-ama \ test-enabl-lcm \ test-endm \ test-if \ diff --git a/tests/test-enabl-ama.lst.ok b/tests/test-enabl-ama.lst.ok new file mode 100644 index 0000000..a16d5e9 --- /dev/null +++ b/tests/test-enabl-ama.lst.ok @@ -0,0 +1,24 @@ + 1 ;;;; + 2 ; + 3 ; Test that .ENABL AMA doesn't survive to the next pass. + 4 ; The default at the start of each pass is set by the command line + 5 ; option -d AMA or -e AMA. It is disabled by default. + 6 + 7 000000 .psect foo,i,rw + 8 000000 000000 y: .word 0 + 9 000002 005067 177772 clr y ; should be pc-relative, no relocation + 10 + 11 .enabl ama ; after this, Y would be @#Y + 11 + + +Symbol table + +. ******R 002 Y 000000R 002 + + +Program sections: + +. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV) + 000000 001 (RW,I,LCL,REL,CON,NOSAV) +FOO 000006 002 (RW,I,LCL,REL,CON,NOSAV) diff --git a/tests/test-enabl-ama.mac b/tests/test-enabl-ama.mac new file mode 100644 index 0000000..1b833a8 --- /dev/null +++ b/tests/test-enabl-ama.mac @@ -0,0 +1,11 @@ +;;;; +; +; Test that .ENABL AMA doesn't survive to the next pass. +; The default at the start of each pass is set by the command line +; option -d AMA or -e AMA. It is disabled by default. + + .psect foo,i,rw +y: .word 0 + clr y ; should be pc-relative, no relocation + + .enabl ama ; after this, Y would be @#Y