diff --git a/assemble_aux.c b/assemble_aux.c index 2218033..f678185 100644 --- a/assemble_aux.c +++ b/assemble_aux.c @@ -671,6 +671,10 @@ void store_value( } else { if (SYM_IS_IMPORTED(sym)) { store_global_offset_word(stack->top, tr, size, sym->value + offset, sym->label); + } else if (sym->section->type == SECTION_REGISTER) { + /* Delayed action: evaluate_rec() excludes SECTION_REGISTER when + * turning symbols into EX_LIT. Do it here now. */ + store_word(stack->top, tr, size, sym->value + offset); } else if (sym->section != current_pc->section) { store_psect_offset_word(stack->top, tr, size, sym->value + offset, sym->section->label); } else { diff --git a/tests/test-word-comma.lst.ok b/tests/test-word-comma.lst.ok index eceef7c..047e2fb 100644 --- a/tests/test-word-comma.lst.ok +++ b/tests/test-word-comma.lst.ok @@ -10,15 +10,17 @@ 10 000042 000001 000000 000003 .word 1,,3 ; 3 words 11 000050 000001 000002 000003 .word 1,2,3 ; 3 words 12 - 12 + 13 000056 000000 000001 000002 .word r0,wait,r1+1,wait+2,%4,%4+1 ; 0, 1, 2, 3, 4, 5 + 000064 000003 000004 000005 + 13 Symbol table -. 000056R 001 START 000000R 001 +. 000072R 001 START 000000R 001 Program sections: . ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV) - 000056 001 (RW,I,LCL,REL,CON,NOSAV) + 000072 001 (RW,I,LCL,REL,CON,NOSAV) diff --git a/tests/test-word-comma.mac b/tests/test-word-comma.mac index 16a594e..acdb3ca 100644 --- a/tests/test-word-comma.mac +++ b/tests/test-word-comma.mac @@ -10,3 +10,4 @@ start: .word 123 ; 1 word .word 1,,3 ; 3 words .word 1,2,3 ; 3 words + .word r0,wait,r1+1,wait+2,%4,%4+1 ; 0, 1, 2, 3, 4, 5