Add comparison files for tests.

This commit is contained in:
Olaf Seibert 2015-11-08 00:18:09 +01:00
parent 3657acf345
commit 09717c3a5a
12 changed files with 488 additions and 0 deletions

57
tests/test-asciz.lst.ok Normal file
View File

@ -0,0 +1,57 @@
1 ;;;;;
2 ;
3 ; Test delimiters of .ASCII and .ASCIZ
4
5 000015 CR = 13.
6 000012 LF = 10.
7 000001 SOH = 1
8
9 000000 015 012 074 .asciz <cr><lf>/<SOH>/ ; 2 bytes and a string
000003 123 117 110
000006 076 000
10 000010 074 143 162 .asciz /<cr><lf><SOH>/ ; only a string
000013 076 074 154
000016 146 076 074
000021 123 117 110
000024 076 000
11 000026 074 143 162 .asciz |<cr><lf><SOH>| ; the same string
000031 076 074 154
000034 146 076 074
000037 123 117 110
000042 076 000
12 000044 015 012 001 .ascii <cr><lf><SOH> ; 3 bytes
13
14 000047 101 102 103 .asciz ;ABC;/DEF/ ; ABCDEF, not recommended practice
000052 104 105 106
000055 000
15 000056 101 102 103 .asciz /ABC/;DEF; ; ABC, not recommended practice
000061 000
16 000062 101 102 103 .asciz /ABC/=DEF= ; ABCDEF, not recommended practice
000065 104 105 106
000070 000
test-asciz.mac:17: ***ERROR Complex expression cannot be assigned to a symbol
17 .asciz =DEF= ; syntax error: assignment
test-asciz.mac:18: ***ERROR Complex expression cannot be assigned to a symbol
18 .asciz =###= ; syntax error: assignment
test-asciz.mac:19: ***ERROR .WORD on odd boundary
test-asciz.mac:19: ***ERROR Invalid expression
19 000071 000 000001 000000 .asciz :SOH: ; syntax error: colon not allowed
test-asciz.mac:20: ***ERROR Illegal symbol definition .ASCIZ
test-asciz.mac:20: ***ERROR Invalid expression
test-asciz.mac:20: ***ERROR Invalid expression
test-asciz.mac:20: ***ERROR Invalid expression
test-asciz.mac:20: ***ERROR Invalid expression
20 000076 000000 000000 000000 .asciz :###: ; syntax error: colon not allowed
000104 000000
20
Symbol table
. ******R 001 .ASCIZ 000071R 001 CR =000015 LF =000012 SOH =000001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000106 001 (RW,I,LCL,REL,CON,NOSAV)

View File

@ -0,0 +1,30 @@
1 ;;;;
2 ;
3 ; Test backpatching (seen in Kermit sources).
4
5 000000 .psect modinf ,ro,d,lcl,rel,con
6
7 000000 label = .
8 000000 .blkb 50 ; create some data
9
10 000050 050 051 052 .byte 50,51,52 ; and some more
11 .save ; we're at 53 now
12 000053 .psect modinf
13 000006 . = label + 6
14 000006 000006 .word 6 ; stored at 6
15 000053 .restore ; . gets restored to 53
16 000053 053 .byte 53
17
17
Symbol table
. ******R 002 LABEL 000000R 002
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000000 001 (RW,I,LCL,REL,CON,NOSAV)
MODINF 000054 002 (RO,D,LCL,REL,CON,NOSAV)

View File

@ -0,0 +1,49 @@
1 .list me
2 .macro test x
3 .blkb x ; test some directive that wants an expression
4 .endm
5
6 000010 size = 10
7 000002 foo = 2
8
9 ; likes:
10
11 000000 test size ; not replaced by "10"
1 000000 .blkb size ; test some directive that wants an expression
12 000010 test \size ; replaced by "10"
1 000010 .blkb 10 ; test some directive that wants an expression
13 000020 test \<size> ; ditto
1 000020 .blkb 10 ; test some directive that wants an expression
14 000030 test \<size + foo> ; replaced by "12"
1 000030 .blkb 12 ; test some directive that wants an expression
15 000042 test ^/size + foo/ ; arg is "size + foo", not "12"
1 000042 .blkb size + foo ; test some directive that wants an expression
16
17 ; dislikes:
18
19 000054 test <\size> ; parameter is \size, which might be ok for
test-bsl-mac-arg.mac:19->TEST:1: ***ERROR Argument to .BLKB/.BLKW must be constant
1 .blkb \size ; test some directive that wants an expression
20 ; macros where the argument is used differently.
21 000054 test size + foo ; gets split at the space
1 000054 .blkb size ; test some directive that wants an expression
22 000064 test /size + foo/ ; gets split at the space
test-bsl-mac-arg.mac:22->TEST:1: ***ERROR Argument to .BLKB/.BLKW must be constant
1 .blkb /size ; test some directive that wants an expression
test-bsl-mac-arg.mac:23: ***ERROR Constant value required
23 000064 test \/size + foo/ ; invalid expression with division operator
1 000064 .blkb 0 ; test some directive that wants an expression
24 000064 test \^/size + foo/ ; original dislikes this, but we accept it.
1 000064 .blkb 12 ; test some directive that wants an expression
24
Symbol table
. ******R 001 FOO =000002 SIZE =000010
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000076 001 (RW,I,LCL,REL,CON,NOSAV)

View File

@ -0,0 +1,26 @@
GSD:
GLOBAL IE.ITS=0 REF ABS flags=100
GLOBAL IE.MON=0 REF ABS flags=100
MODNAME .MAIN.=0 flags=0
PSECT =30 CON RW REL LCL I flags=40
PSECT . ABS.=0 OVR RW ABS GBL I flags=104
XFER . ABS.=1 flags=10
ENDGSD
RLD
Location counter definition +0
TEXT ADDR=0 LEN=30
000000: 012767 000000 000000 000000 ........
000010: 000000 000000 000000 000000 ........
000020: 000000 000000 000000 000000 ........
RLD
Complex 2=IE.ITS neg store
Global 6=IE.ITS
Complex 10=IE.ITS neg store
Complex 12=IE.ITS ^C store
Complex 14=IE.ITS IE.MON + store
Complex 16=IE.ITS IE.MON - store
Complex 20=IE.ITS IE.MON * store
Complex 22=IE.ITS IE.MON / store
Complex 24=IE.ITS IE.MON & store
Complex 26=IE.ITS IE.MON ! store
ENDMOD

67
tests/test-endm.lst.ok Normal file
View File

@ -0,0 +1,67 @@
1 ;;;;;
2 ;
3 ; Test nested macros and name on .ENDM
4 ;
5
6 .macro M1
7 .word 1
8 .endm M1 ; ok
9
10 000000 M1
1 000000 000001 .word 1
11
12 .macro M2
13 .word 2
14 .macro M3
15 .word 3
16 .endm M3 ; ok
17 .endm M2 ; ok
18
19 000002 M2
1 000002 000002 .word 2
2 .macro M3
3 .word 3
4 .endm M3 ; ok
20 000004 M3
1 000004 000003 .word 3
21
22 .macro M4
23 .word 4
24 .macro M4
25 .endm M4 ; ok
26 .endm M4 ; ok
27
28 000006 M4
1 000006 000004 .word 4
2 .macro M4
3 .endm M4 ; ok
29 000010 M4 ; should be empty now
30
31 .macro M5
32 .word 5
33 .macro M5
34 .endm notM5 ; wrong; detected when M5 is expanded
35 .endm M5 ; ok
36
37 000010 M5
1 000010 000005 .word 5
2 .macro M5
test-endm.mac:37->M5:3: ***ERROR .ENDM 'NOTM5' does not match .MACRO 'M5'
3 .endm notM5 ; wrong; detected when M5 is expanded
38 000012 M5
39
40 .macro M6
test-endm.mac:41: ***ERROR .ENDM 'NOTM6' does not match .MACRO 'M6'
41 .endm notM6 ; wrong
41
Symbol table
. ******R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000012 001 (RW,I,LCL,REL,CON,NOSAV)

26
tests/test-impword.lst.ok Normal file
View File

@ -0,0 +1,26 @@
1 ;;;;;
2 ;
3 ; Test the implied .word construction
4 ;
5
6 000000 000003 start: 3
7 000002 000000' start
8 ; The following could be a macro which by accident is not defined
9 ; which takes arguments that don't parse as expressions.
test-impword.mac:10: ***ERROR Invalid expression in .WORD
10 000004 000000G macro 8-BIT,1,2,3
11 ; The following can by accident be parsed as an expression.
12 000006 000000G 150007 000001 macro 7-BIT,1,2,3
000014 000002 000003
12
Symbol table
. ******R 001 MACRO =****** GX START 000000R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000020 001 (RW,I,LCL,REL,CON,NOSAV)

62
tests/test-include.lst.ok Normal file
View File

@ -0,0 +1,62 @@
1 ;;;;;
2 ;
3 ; Test some delimiters for the .INCLUDE directive
4 ;
5
6 .include "incl.mac"
1 ;;;;;
2 ;
3 ; file to be included
4
5 000000 000001 .word 1 ; to show it is included
5
7 .include /incl.mac/
1 ;;;;;
2 ;
3 ; file to be included
4
5 000002 000001 .word 1 ; to show it is included
5
8 .include \incl.mac\
1 ;;;;;
2 ;
3 ; file to be included
4
5 000004 000001 .word 1 ; to show it is included
5
9 .include ?incl.mac?
1 ;;;;;
2 ;
3 ; file to be included
4
5 000006 000001 .word 1 ; to show it is included
5
10 .include >incl.mac>
1 ;;;;;
2 ;
3 ; file to be included
4
5 000010 000001 .word 1 ; to show it is included
5
11
12 ; these are errors: (in MACRO V05.05, some terminate the assembler)
13
test-include.mac:14: ***ERROR Bad .INCLUDE file name
14 .include <incl.mac>
test-include.mac:15: ***ERROR Bad .INCLUDE file name
15 .include <incl.mac<
16 .include =incl.mac= ; looks like assignment
test-include.mac:17: ***ERROR Invalid expression
17 000012 000000G 000000 .include :incl.mac: ; looks like a label
17
Symbol table
. ******R 001 .INCLU 000012R 001 INCL.M=****** GX
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000016 001 (RW,I,LCL,REL,CON,NOSAV)

49
tests/test-jmp.lst.ok Normal file
View File

@ -0,0 +1,49 @@
1 ;;;;;
2 ;
3 ; Tests the addressing modes for JMP.
4 ; JMP Rx is not allowed, all other modes are.
5 ;
6
7 000000 000167 000104 start: jmp label ; rel(pc) jumps to label
8 000004 000177 000100 jmp @label ; @rel(pc) does something else!
9 000010 000127 000110' jmp #label ; (pc)+ does something else!
10 000014 000137 000110' jmp @#label ; @(pc)+ jumps to label
11
test-jmp.mac:12: ***ERROR JMP Rn is illegal
12 000020 000101 jmp r1 ; must fail
13 000022 000112 jmp (r2)
14 000024 000121 jmp (r1)+
15 000026 000131 jmp @(r1)+
16 000030 000141 jmp -(r1)
17 000032 000151 jmp @-(r1)
18 000034 000161 001234 jmp 1234(r1)
19 000040 000171 001234 jmp @1234(r1)
20
21 000044 004067 000040 secnd: jsr r0,label ; rel(pc) jumps to label
22 000050 004077 000034 jsr r0,@label ; @rel(pc) does something else!
23 000054 004027 000110' jsr r0,#label ; (pc)+ does something else!
24 000060 004037 000110' jsr r0,@#label ; @(pc)+ jumps to label
25
test-jmp.mac:26: ***ERROR JSR Rn,Rm is illegal
26 000064 004201 jsr r2,r1 ; must fail
27 000066 004312 jsr r3,(r2)
28 000070 004421 jsr r4,(r1)+
29 000072 004531 jsr r5,@(r1)+
30 000074 004241 jsr r2,-(r1)
31 000076 004351 jsr r3,@-(r1)
32 000100 004461 001234 jsr r4,1234(r1)
33 000104 004571 001234 jsr r5,@1234(r1)
34
35 000110 000207 label: rts pc
35
Symbol table
. ******R 001 LABEL 000110R 001 SECND 000044R 001 START 000000R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000112 001 (RW,I,LCL,REL,CON,NOSAV)

48
tests/test-locals.lst.ok Normal file
View File

@ -0,0 +1,48 @@
1 ;;;;;
2 ;
3 ; Test long local labels
4 ;
5
6 000000 001400 lab1: beq 1$
7 000002 001376 1$: bne lab1
8
9 ; -- new scope
10
11 000004 001400 lab2a: beq 12345$
12 000006 001376 12345$: bne lab2a
13
14 ; -- new scope
15
16 000010 001400 lab2b: beq 12345$
17 000012 001376 12345$: bne lab2b
18
19 ; -- new scope
20
21 000014 001400 lab3: beq 1$
22 000016 001000 1$: bne 2$
23 000020 001400 2$: beq 3$
24 000022 001400 3$: beq 4$
25 000024 001773 4$: beq lab3
26
27 ; -- new scope
28
29 000026 001400 lab4: beq 1$
30 000030 001000 1$: bne 2$
31 000032 001400 2$: beq 3$
32 000034 001400 3$: beq 4$
33 000036 001773 4$: beq lab4
33
Symbol table
. ******R 001 12345$1 000006R L 001 3$3 000022R L 001 LAB1 000000R 001 LAB4 000026R 001
1$0 000002R L 001 12345$2 000012R L 001 3$4 000034R L 001 LAB2A 000004R 001
1$3 000016R L 001 2$3 000020R L 001 4$3 000024R L 001 LAB2B 000010R 001
1$4 000030R L 001 2$4 000032R L 001 4$4 000036R L 001 LAB3 000014R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000040 001 (RW,I,LCL,REL,CON,NOSAV)

View File

@ -0,0 +1,36 @@
1 .macro tstarg a1,a2,a3,a4
2 .narg label
3 .endm
4
5 000000 start: tstarg ; 0 args
1 000000 .narg label
6 000000 tstarg 123 ; 1 arg
1 000001 .narg label
7 000000 tstarg 1, ; 2 args
1 000002 .narg label
8 000000 tstarg ,2 ; 2 args
1 000002 .narg label
9 000000 tstarg , ; 2 args
1 000002 .narg label
10 000000 tstarg ,, ; 3 args
1 000003 .narg label
11 000000 tstarg 1,, ; 3 args
1 000003 .narg label
12 000000 tstarg ,,3 ; 3 args
1 000003 .narg label
13 000000 tstarg 1,,3 ; 3 args
1 000003 .narg label
14 000000 tstarg 1,2,3 ; 3 args
1 000003 .narg label
14
Symbol table
. ******R 001 LABEL =000003 START 000000R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000000 001 (RW,I,LCL,REL,CON,NOSAV)

14
tests/test-undef.lst.ok Normal file
View File

@ -0,0 +1,14 @@
test-undef.mac:1: ***ERROR MACRO .TTYOU not found
1 .MCALL .TTYOUT
1
Symbol table
. ******R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000000 001 (RW,I,LCL,REL,CON,NOSAV)

View File

@ -0,0 +1,24 @@
1
2 000000 000123 start: .word 123 ; 1 word
3 000002 000000 .word ; 1 word
4 000004 000001 000000 .word 1, ; 2 words
5 000010 000000 000002 .word ,2 ; 2 words
6 000014 000000 000000 .word , ; 2 words
7 000020 000000 000000 000000 .word ,, ; 3 words
8 000026 000001 000000 000000 .word 1,, ; 3 words
9 000034 000000 000000 000003 .word ,,3 ; 3 words
10 000042 000001 000000 000003 .word 1,,3 ; 3 words
11 000050 000001 000002 000003 .word 1,2,3 ; 3 words
12
12
Symbol table
. ******R 001 START 000000R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000056 001 (RW,I,LCL,REL,CON,NOSAV)