Allow expression (with constant value) in .RADIX

Also add a test file for it.
This commit is contained in:
Paul Koning
2022-06-28 09:32:34 -04:00
parent fe83ebf9ed
commit 7354aadbfc
4 changed files with 91 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ TESTS="test-asciz \
test-prec \
test-psect \
test-rad50 \
test-radix \
test-reg \
test-reloc \
test-rept \

38
tests/test-radix.lst.ok Normal file
View File

@@ -0,0 +1,38 @@
1 ;;;;;
2 ;
3 ; Test .radix directive
4 ;
5 000010 .RADIX 8
6 000000 000010 .WORD 10
7 000012 .RADIX 10
8 000002 000012 .WORD 10
9 .RADIX ;Default is 8
10 000004 000010 .WORD 10
11 000002 .RADIX 2
12 000006 000002 .WORD 10
13 000020 .RADIX 16
14 000010 000020 .WORD 10
15 ; Odd but valid
16 000010 .RADIX ^O10 ;Octal 10, i.e., 8
17 000012 000010 .WORD 10
18 000012 .RADIX 5+5
19 000014 000012 .WORD 10
20 ; Errors
test-radix.mac:21: ***ERROR Argument to .RADIX must be 2, 8, 10, or 16
21 000007 .RADIX 7
22 000016 000012 .WORD 10 ;Radix is unchanged after error
test-radix.mac:23: ***ERROR Argument to .RADIX must be constant
23 .RADIX .
24 000020 000012 .WORD 10
24
Symbol table
. 000022R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000022 001 (RW,I,LCL,REL,CON,NOSAV)

24
tests/test-radix.mac Normal file
View File

@@ -0,0 +1,24 @@
;;;;;
;
; Test .radix directive
;
.RADIX 8
.WORD 10
.RADIX 10
.WORD 10
.RADIX ;Default is 8
.WORD 10
.RADIX 2
.WORD 10
.RADIX 16
.WORD 10
; Odd but valid
.RADIX ^O10 ;Octal 10, i.e., 8
.WORD 10
.RADIX 5+5
.WORD 10
; Errors
.RADIX 7
.WORD 10 ;Radix is unchanged after error
.RADIX .
.WORD 10