diff --git a/tests/test-reg.mac b/tests/test-reg.mac new file mode 100644 index 0000000..57e10a3 --- /dev/null +++ b/tests/test-reg.mac @@ -0,0 +1,52 @@ +;;;;; +; +; Test expressions that evaluate to registers. +; +; !!! THIS TEST IS NOT RUN YET BECAUSE MANY OF THE CASES FAIL !!! +; +; All lines not marked "error" should assemble without complaint +; as absolute values (no relocation etc). +; +; Section 3.4 (page 3-8) is a bit vague about the expressions that are allowed +; after a %, but "the digit specifying the register can be replaced by any valid, +; absolute term that can be evaluated during the first assembly pass." +; It specifically mentions %3+1 to be the same as %4. +; For the rest there is no indication where exactly register labels can be used. + + A = 1 + + l1 = %1 + l2 = %1+1 + l3 = %a + l4 = %a + 1 + l5 = %<1+1> + l6 = <%1>+1 ; must be register! + l7 = <%a>+1 ; must be register! + l8 = %1 + %2 + l8a = <%1> + <%2> ; must be register! + l9 = %<%1 + %2> + + B = rti ; 2 + + l10 = %B + l11 = %wait ; 1 + + l12 = %1. + l13 = %7. + l14 = %10 ; error: too large + l15 = %8. ; error: too large + + mov #%2,%2 ; must not be a relocatable expression! + mov #l1,%2 ; must not be a relocatable expression! + mov #<%1+%2>,%3 ; must not be a relocatable expression! + mov #,%3 ; must not be a relocatable expression! + mov #<%l1+1>,%3 ; must not be a relocatable expression! + + l20 = %l1 + l21 = %l20 + + l22 = l1 ; still a register + l23 = l22 ; still a register + + .end +