Add some register label tests that don't work yet.

This commit is contained in:
Olaf Seibert 2021-04-21 18:44:19 +02:00
parent 9ade850447
commit cb331d2a55

52
tests/test-reg.mac Normal file
View File

@ -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 #<l1+1>,%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