mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-13 15:27:18 +00:00
Add some tests for .BLKB .BLKW .ODD .EVEN
.BLKB and .BLKW should have an argument, but if missing it is 1. .ODD and .EVEN are not allowed to have an argument.
This commit is contained in:
parent
eb60cfe315
commit
d61cad6bb4
19
assemble.c
19
assemble.c
@ -926,6 +926,10 @@ static int assemble(
|
||||
return 1;
|
||||
|
||||
case P_EVEN:
|
||||
cp = skipwhite(cp);
|
||||
if (!EOL(*cp)) {
|
||||
report(stack->top, ".EVEN must not have an argument\n");
|
||||
}
|
||||
if (DOT & 1) {
|
||||
list_word(stack->top, DOT, 0, 1, "");
|
||||
DOT++;
|
||||
@ -934,6 +938,9 @@ static int assemble(
|
||||
return 1;
|
||||
|
||||
case P_ODD:
|
||||
if (!EOL(*cp)) {
|
||||
report(stack->top, ".EVEN must not have an argument\n");
|
||||
}
|
||||
if (!(DOT & 1)) {
|
||||
list_word(stack->top, DOT, 0, 1, "");
|
||||
DOT++;
|
||||
@ -1121,9 +1128,19 @@ static int assemble(
|
||||
case P_BLKW:
|
||||
case P_BLKB:
|
||||
{
|
||||
EX_TREE *value = parse_expr(cp, 0);
|
||||
EX_TREE *value;
|
||||
int ok = 1;
|
||||
|
||||
cp = skipwhite(cp);
|
||||
if (EOL(*cp)) {
|
||||
/* If no argument, assume 1. Documented but
|
||||
* discouraged. Par 6.5.3, page 6-32. */
|
||||
/* warning(stack->top, "Argument to .BLKB/.BLKW should be present; 1 assumed\n"); */
|
||||
value = new_ex_lit(1);
|
||||
} else {
|
||||
value = parse_expr(cp, 0);
|
||||
}
|
||||
|
||||
if (value->type != EX_LIT) {
|
||||
report(stack->top, "Argument to .BLKB/.BLKW " "must be constant\n");
|
||||
ok = 0;
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
TESTS="test-asciz \
|
||||
test-backpatch \
|
||||
test-blkb \
|
||||
test-bsl-mac-arg \
|
||||
test-complex-reloc \
|
||||
test-endm \
|
||||
|
||||
41
tests/test-blkb.lst.ok
Normal file
41
tests/test-blkb.lst.ok
Normal file
@ -0,0 +1,41 @@
|
||||
1 ;;;;;
|
||||
2 ;
|
||||
3 ; Test .BLKB and .BLKW
|
||||
4 ;
|
||||
5 000000 label: .blkb ; not recommended, but default argument is 1
|
||||
6 000001 .blkb 1
|
||||
7 000002 .blkb 2
|
||||
8 000004 .blkb 100.
|
||||
test-blkb.mac:9: ***ERROR Argument to .BLKB/.BLKW must be constant
|
||||
9 .blkb label ; error: not an constant expression
|
||||
10
|
||||
11 000150 000 .odd
|
||||
12
|
||||
13 000151 .blkw 1 ; should maybe be an error: odd address
|
||||
14
|
||||
15 000153 000 .even
|
||||
16
|
||||
17 000154 label2: .blkb ; not recommended, but default argument is 1
|
||||
18 000155 .blkb 1
|
||||
19 000156 .blkb 2
|
||||
20 000160 .blkb 100.
|
||||
test-blkb.mac:21: ***ERROR Argument to .BLKB/.BLKW must be constant
|
||||
21 .blkb label2 ; error: not an constant expression
|
||||
22
|
||||
23
|
||||
test-blkb.mac:24: ***ERROR .EVEN must not have an argument
|
||||
24 .even 1 ; error: no argument allowed
|
||||
test-blkb.mac:25: ***ERROR .EVEN must not have an argument
|
||||
25 000324 000 .odd 1 ; error: no argument allowed
|
||||
25
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
. ******R 001 LABEL 000000R 001 LABEL2 000154R 001
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000325 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
25
tests/test-blkb.mac
Normal file
25
tests/test-blkb.mac
Normal file
@ -0,0 +1,25 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test .BLKB and .BLKW
|
||||
;
|
||||
label: .blkb ; not recommended, but default argument is 1
|
||||
.blkb 1
|
||||
.blkb 2
|
||||
.blkb 100.
|
||||
.blkb label ; error: not an constant expression
|
||||
|
||||
.odd
|
||||
|
||||
.blkw 1 ; should maybe be an error: odd address
|
||||
|
||||
.even
|
||||
|
||||
label2: .blkb ; not recommended, but default argument is 1
|
||||
.blkb 1
|
||||
.blkb 2
|
||||
.blkb 100.
|
||||
.blkb label2 ; error: not an constant expression
|
||||
|
||||
|
||||
.even 1 ; error: no argument allowed
|
||||
.odd 1 ; error: no argument allowed
|
||||
Loading…
x
Reference in New Issue
Block a user