mirror of
https://github.com/wfjm/w11.git
synced 2026-01-13 15:37:43 +00:00
asm-11 BUGFIX: support @(R) modifier with omitted offset
- tools - bin/asm-11: BUGFIX: support @(R) modifier with omitted offset - asm-11/tests/test_0100_op_(g|gg|rg).mac: add @(R) test cases - tcode/cpu_(basics|details|selftest).mac: use @(R)
This commit is contained in:
parent
8fc44a4e4b
commit
bc958525b5
@ -8,7 +8,7 @@
|
||||
The project contains the VHDL code for a **complete DEC PDP-11 system**:
|
||||
a
|
||||
[PDP-11/70](http://www.bitsavers.org/pdf/dec/pdp11/1170/EK-KB11C-TM-001_1170procMan.pdf)
|
||||
CPU with memory management unit, but without floating point unit,
|
||||
CPU with a memory management unit, but without a floating point unit,
|
||||
a complete set of mass storage peripherals
|
||||
([RK11/RK05](http://www.bitsavers.org/pdf/dec/unibus/RK11-C_manual1971.pdf),
|
||||
[RL11/RL02](http://www.bitsavers.org/pdf/dec/disc/rl01_rl02/EK-RL122-TM-001_techAug82.pdf),
|
||||
@ -31,7 +31,8 @@ The design is **FPGA proven**, runs currently on Digilent
|
||||
[Nexys3](rtl/sys_gen/w11a/nexys3),
|
||||
[Nexys2](rtl/sys_gen/w11a/nexys2) and
|
||||
[S3board](rtl/sys_gen/w11a/s3board)
|
||||
boards and boots 5th Edition UNIX and 2.11BSD UNIX.
|
||||
boards and boots 5th Edition UNIX, 2.11BSD UNIX, as well as various DEC
|
||||
operating systems from provided [oskits](tools/oskit/README.md).
|
||||
|
||||
For more information look into:
|
||||
- w11 project [home page](https://wfjm.github.io/home/w11/)
|
||||
|
||||
@ -30,6 +30,8 @@ The full set of tests is only run for tagged releases.
|
||||
### Summary
|
||||
### New features
|
||||
### Changes
|
||||
### Bug Fixes
|
||||
- tools/bin/asm-11: BUGFIX: support @(R) modifier with omitted offset
|
||||
|
||||
<!-- --------------------------------------------------------------------- -->
|
||||
---
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
; $Id: test_0100_op_g.mac 1262 2022-07-25 09:44:55Z mueller $
|
||||
; $Id: test_0100_op_g.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2013-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
; Copyright 2013-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
;
|
||||
; test opcodes with one general operand
|
||||
;
|
||||
@ -21,8 +21,9 @@ p1:
|
||||
inc @-(r2) ;;!! 005252
|
||||
inc 1234(r3) ;;!! 005263 001234
|
||||
inc @1234(r4) ;;!! 005274 001234
|
||||
inc a ;;!! 005267 177742
|
||||
inc @pa ;;!! 005277 177740
|
||||
inc @(r4) ;;!! 005274 000000
|
||||
inc a ;;!! 005267 177736
|
||||
inc @pa ;;!! 005277 177734
|
||||
inc @#a ;;!! 005237 001000
|
||||
|
||||
; pc relative addressing
|
||||
@ -42,8 +43,8 @@ p2:
|
||||
neg @-(r2) ;;!! 005452
|
||||
adc 1234(r3) ;;!! 005563 001234
|
||||
sbc @1234(r4) ;;!! 005674 001234
|
||||
tst a ;;!! 005767 177666
|
||||
ror @pa ;;!! 006077 177664
|
||||
tst a ;;!! 005767 177662
|
||||
ror @pa ;;!! 006077 177660
|
||||
rol @#a ;;!! 006137 001000
|
||||
asr @r2 ;;!! 006212
|
||||
asl (r3) ;;!! 006313
|
||||
@ -53,8 +54,8 @@ p2:
|
||||
; csm @-(r2) ;;!!
|
||||
; tstset 1234(r3) ;;!!
|
||||
; wrtlck @1234(r4) ;;!!
|
||||
clrb a ;;!! 105067 177640
|
||||
comb @pa ;;!! 105177 177636
|
||||
clrb a ;;!! 105067 177634
|
||||
comb @pa ;;!! 105177 177632
|
||||
incb @#a ;;!! 105237 001000
|
||||
decb @r2 ;;!! 105312
|
||||
negb (r3) ;;!! 105413
|
||||
@ -63,9 +64,9 @@ p2:
|
||||
tstb -(r1) ;;!! 105741
|
||||
rorb @-(r2) ;;!! 106052
|
||||
rolb 1234(r3) ;;!! 106163 001234
|
||||
asrb @1234(r4) ;;!! 106274 001234
|
||||
aslb a ;;!! 106367 177600
|
||||
mtps @pa ;;!! 106477 177576
|
||||
asrb @1234(r4) ;;!! 106274 001234
|
||||
aslb a ;;!! 106367 177574
|
||||
mtps @pa ;;!! 106477 177572
|
||||
mfpd @#a ;;!! 106537 001000
|
||||
mtpd @r2 ;;!! 106612
|
||||
mfps (r3) ;;!! 106713
|
||||
@ -74,5 +75,9 @@ p2:
|
||||
|
||||
inc 100(pc) ;;!! 005267 000100
|
||||
inc @100(pc) ;;!! 005277 000100
|
||||
dec @(pc) ;;!! 005377 000000
|
||||
|
||||
; phase error catcher
|
||||
d: .word 0
|
||||
|
||||
.end
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
; $Id: test_0110_op_gg.mac 1262 2022-07-25 09:44:55Z mueller $
|
||||
; $Id: test_0110_op_gg.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2013-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
; Copyright 2013-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
|
||||
; test opcodes with two general operands
|
||||
;
|
||||
@ -25,8 +25,9 @@ p1:
|
||||
add @-(r2),r0 ;;!! 065200
|
||||
add 1234(r3),r0 ;;!! 066300 001234
|
||||
add @1234(r4),r0 ;;!! 067400 001234
|
||||
add a,r0 ;;!! 066700 177736
|
||||
add @pa,r0 ;;!! 067700 177736
|
||||
add @(r4),r0 ;;!! 067400 000000
|
||||
add a,r0 ;;!! 066700 177732
|
||||
add @pa,r0 ;;!! 067700 177732
|
||||
add @#a,r0 ;;!! 063700 001000
|
||||
add #const,r0 ;;!! 062700 000400
|
||||
|
||||
@ -41,18 +42,19 @@ p2:
|
||||
add r0,@-(r2) ;;!! 060052
|
||||
add r0,1234(r3) ;;!! 060063 001234
|
||||
add r0,@1234(r4) ;;!! 060074 001234
|
||||
add r0,a ;;!! 060067 177670
|
||||
add r0,@pa ;;!! 060077 177670
|
||||
add r0,@(r4) ;;!! 060074 000000
|
||||
add r0,a ;;!! 060067 177660
|
||||
add r0,@pa ;;!! 060077 177660
|
||||
add r0,@#a ;;!! 060037 001000
|
||||
|
||||
; pc relative addressing
|
||||
|
||||
c: .word 0 ;;!! 001120: 000000
|
||||
d: .word 0 ;;!! 001122: 000000
|
||||
add c,d ;;!! 001124: 066767 177770 177770
|
||||
add f,e ;;!! 001132: 066767 000004 000000
|
||||
e: .word 0 ;;!! 001140: 000000
|
||||
f: .word 0 ;;!! 001142: 000000
|
||||
c: .word 0 ;;!! 001130: 000000
|
||||
d: .word 0 ;;!! 001132: 000000
|
||||
add c,d ;;!! 001134: 066767 177770 177770
|
||||
add f,e ;;!! 001142: 066767 000004 000000
|
||||
e: .word 0 ;;!! 001150: 000000
|
||||
f: .word 0 ;;!! 001152: 000000
|
||||
|
||||
; some mixed cases
|
||||
p3:
|
||||
@ -60,9 +62,9 @@ p3:
|
||||
add (r3),(r4)+ ;;!! 061324
|
||||
add @(r5)+,-(r1) ;;!! 063541
|
||||
add @-(r2),1234(r3) ;;!! 065263 001234
|
||||
add @1234(r4),a ;;!! 067467 001234 177614
|
||||
add @pa,@#a ;;!! 067737 177614 001000
|
||||
add #1000,b ;;!! 062767 001000 177602
|
||||
add @1234(r4),a ;;!! 067467 001234 177604
|
||||
add @pa,@#a ;;!! 067737 177604 001000
|
||||
add #1000,b ;;!! 062767 001000 177572
|
||||
|
||||
; all 'gg' type opcodes, random modes
|
||||
p4:
|
||||
@ -70,12 +72,13 @@ p4:
|
||||
cmp (r4)+,@(r5)+ ;;!! 022435
|
||||
bit -(r1),@-(r2) ;;!! 034152
|
||||
bic 1234(r3),@1234(r4) ;;!! 046374 001234 001234
|
||||
bis a,@pa ;;!! 056777 177560 177562
|
||||
bis a,@pa ;;!! 056777 177550 177552
|
||||
sub @(r4),@(r5) ;;!! 167475 000000 000000
|
||||
movb @#a,(r3) ;;!! 113713 001000
|
||||
cmpb @(r5)+,@-(r2) ;;!! 123552
|
||||
bitb @1234(r4),@pa ;;!! 137477 001234 177546
|
||||
bitb @1234(r4),@pa ;;!! 137477 001234 177530
|
||||
bicb -(r1),1234(r3) ;;!! 144163 001234
|
||||
bisb a,@#b ;;!! 156737 177532 001002
|
||||
bisb a,@#b ;;!! 156737 177514 001002
|
||||
|
||||
; explicit pc offset addressing
|
||||
p5: add 100(pc),r0 ;;!! 066700 000100
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
; $Id: test_0120_op_rg.mac 1184 2019-07-10 20:39:44Z mueller $
|
||||
; $Id: test_0120_op_rg.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2014- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
; Copyright 2014-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
;
|
||||
; test opcodes with 1 1/2 operands
|
||||
;
|
||||
@ -13,10 +13,24 @@ pa: .word a
|
||||
sub: rts pc ;;!! 001004: 000207
|
||||
jsr pc,sub ;;!! 001006: 004767 177772
|
||||
|
||||
xor r1,a ;;!! 074167 177762
|
||||
; all modes with one opcode
|
||||
xor r1,r2 ;;!! 074102
|
||||
xor r1,@r2 ;;!! 074112
|
||||
xor r1,(r3) ;;!! 074113
|
||||
xor r1,(r4)+ ;;!! 074124
|
||||
xor r1,@(r5)+ ;;!! 074135
|
||||
xor r1,-(r4) ;;!! 074144
|
||||
xor r1,@-(r4) ;;!! 074154
|
||||
xor r1,1234(r3) ;;!! 074163 001234
|
||||
xor r1,@1234(r3) ;;!! 074173 001234
|
||||
xor r1,@(r3) ;;!! 074173 000000
|
||||
xor r1,a ;;!! 074167 177730
|
||||
xor r1,@pa ;;!! 074177 177726
|
||||
xor r1,@#a ;;!! 074137 001000
|
||||
|
||||
mul a,r2 ;;!! 070267 177756
|
||||
div @pa,r2 ;;!! 071277 177754
|
||||
; all 'rg' type opcodes, random modes
|
||||
mul a,r2 ;;!! 070267 177714
|
||||
div @pa,r2 ;;!! 071277 177712
|
||||
ash #12,r3 ;;!! 072327 000012
|
||||
ashc @#a,r4 ;;!! 073437 001000
|
||||
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
#!/usr/bin/perl -w
|
||||
# $Id: asm-11 1264 2022-07-30 07:42:17Z mueller $
|
||||
# $Id: asm-11 1351 2023-01-13 08:38:27Z mueller $
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Copyright 2013-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
# Copyright 2013-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
#
|
||||
# Revision History:
|
||||
# Date Rev Version Comment
|
||||
# 2023-01-12 1351 1.1.4 BUGFIX: support @(R) modifier with omitted offset
|
||||
# 2022-07-28 1264 1.1.3 add -E and -M options
|
||||
# 2022-07-23 1262 1.1.2 BUGFIX: '100(pc)' was compiled as '100'
|
||||
# 2019-07-13 1189 1.1.1 drop superfluous exists for $opts
|
||||
@ -881,9 +882,10 @@ sub parse_line {
|
||||
}
|
||||
|
||||
} else { # all operands seen
|
||||
# size is opcode and number index words, handle @(R) case without ebeg
|
||||
my $nword = 1;
|
||||
$nword += 1 if defined $l{o1ebeg};
|
||||
$nword += 1 if defined $l{o2ebeg};
|
||||
$nword += 1 if defined $l{o1ebeg} || (defined $l{o1mod} && $l{o1mod}==7);
|
||||
$nword += 1 if defined $l{o2ebeg} || (defined $l{o2mod} && $l{o2mod}==7);
|
||||
incdot(2*$nword);
|
||||
$state = 'end';
|
||||
}
|
||||
@ -927,13 +929,15 @@ sub parse_line {
|
||||
if (check_token($rt, 'DEL', ')')) {
|
||||
$rt = get_token(\%l, $tmask);
|
||||
if (check_token($rt, 'OP', '+')) {
|
||||
$op_cmod = $op_cmod_def ? 3 : 2;
|
||||
$op_cmod = $op_cmod_def ? 3 : 2; # (R)+ or @(R)+ seen
|
||||
$state = 'g_end';
|
||||
} else {
|
||||
if ($op_cmod_def) {
|
||||
$state = 'q';
|
||||
pushback_token(\%l); # @(R) seen
|
||||
$op_cmod = 7;
|
||||
$state = 'g_end';
|
||||
} else {
|
||||
pushback_token(\%l);
|
||||
pushback_token(\%l); # (R) seen
|
||||
$op_cmod = 1;
|
||||
$state = 'g_end';
|
||||
}
|
||||
@ -2249,8 +2253,10 @@ sub out_opcode_o {
|
||||
|
||||
sub out_opdata {
|
||||
my ($rl,$mod,$reg,$rel,$ebeg,$eend) = @_;
|
||||
# FIXME_code: shouldn't we die here ?
|
||||
return unless defined $ebeg;
|
||||
if (not defined $ebeg) {
|
||||
out_wop($rl, 0) if $mod == 7; # emit 0 index for @(R) case
|
||||
return;
|
||||
}
|
||||
|
||||
my $val = eval_exp($rl,$ebeg,$eend);
|
||||
unless (defined $val) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
; $Id: cpu_basics.mac 1347 2023-01-07 12:48:58Z mueller $
|
||||
; $Id: cpu_basics.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2015-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
;
|
||||
@ -3325,7 +3325,7 @@ tf0401: clr cp.psw
|
||||
;
|
||||
inc r0
|
||||
push r0
|
||||
mtpi @0(r2) ; mode 7
|
||||
mtpi @(r2) ; mode 7
|
||||
hcmpeq r0,(r3) ; check dst
|
||||
;
|
||||
hcmpeq #stack,sp ; check SP normal
|
||||
@ -3490,7 +3490,7 @@ tf0404: clr cp.psw
|
||||
;
|
||||
inc r0
|
||||
mov r0,(r3)
|
||||
mfpi @0(r2) ; mode 7
|
||||
mfpi @(r2) ; mode 7
|
||||
hcmpeq r0,(sp)+ ; check
|
||||
;
|
||||
hcmpeq #stack,sp ; check SP normal
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
; $Id: cpu_details.mac 1349 2023-01-11 14:52:42Z mueller $
|
||||
; $Id: cpu_details.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2022-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
;
|
||||
@ -685,12 +685,12 @@ ta0303: tstb systyp ; skip if not on w11
|
||||
mov r2,sp ; SP in yellow zone
|
||||
; dstw mode 3,5,7
|
||||
mov (sp)+,@-(sp) ; dstw mode 5: SP now 1176
|
||||
mov @0(sp),@(sp)+ ; dstw mode 3: SP now 1200
|
||||
mov -(sp),@0(sp) ; dstw mode 7: SP now 1176
|
||||
mov @(sp),@(sp)+ ; dstw mode 3: SP now 1200
|
||||
mov -(sp),@(sp) ; dstw mode 7: SP now 1176
|
||||
; dstr mode 3,5,7 when rmw
|
||||
bis (sp)+,@-(sp) ; dstw mode 5: SP now 1176
|
||||
bis @0(sp),@(sp)+ ; dstw mode 3: SP now 1200
|
||||
bis -(sp),@0(sp) ; dstw mode 7: SP now 1176
|
||||
bis @(sp),@(sp)+ ; dstw mode 3: SP now 1200
|
||||
bis -(sp),@(sp) ; dstw mode 7: SP now 1176
|
||||
; dstr mode 1,2,4,6 in read-only
|
||||
tst (sp) ; dstr mode 1: SP now 1176
|
||||
cmp (sp),-(sp) ; dstr mode 4: SP now 1174
|
||||
@ -699,7 +699,7 @@ ta0303: tstb systyp ; skip if not on w11
|
||||
; dstr mode 3,5,7 in read-only
|
||||
cmp (sp),@(sp)+ ; dstr mode 3: SP now 1200
|
||||
cmp (sp),@-(sp) ; dstr mode 5: SP now 1176
|
||||
cmp (sp),@0(sp) ; dstr mode 7: SP now 1176
|
||||
cmp (sp),@(sp) ; dstr mode 7: SP now 1176
|
||||
; check that EA is compared against STKLIM
|
||||
clr sp
|
||||
mov @#2000,2000(sp) ; SP=0, EA=2000 -> no trap
|
||||
@ -1801,7 +1801,7 @@ tb0301: mov #123,r0 ; src for MOV
|
||||
mov r0,@-(r2) ; mode 5
|
||||
hcmpeq #cp000c,(r3) ; N=0,Z=0,V=0 and keep C
|
||||
scc
|
||||
mov r0,@0(r2) ; mode 7
|
||||
mov r0,@(r2) ; mode 7
|
||||
hcmpeq #cp000c,(r3) ; N=0,Z=0,V=0 and keep C
|
||||
;
|
||||
; part 2: check cc for CLR for all modes
|
||||
@ -1828,7 +1828,7 @@ tb0301: mov #123,r0 ; src for MOV
|
||||
clr @-(r2) ; mode 5
|
||||
hcmpeq #cp0z00,(r3) ; N=0,Z=1,V=0,C=0
|
||||
scc
|
||||
clr @0(r2) ; mode 7
|
||||
clr @(r2) ; mode 7
|
||||
hcmpeq #cp0z00,(r3) ; N=0,Z=1,V=0,C=0
|
||||
;
|
||||
; part 3: check cc for SXT for all modes
|
||||
@ -1855,7 +1855,7 @@ tb0301: mov #123,r0 ; src for MOV
|
||||
sxt @-(r2) ; mode 5
|
||||
hcmpeq #cpn00c,(r3) ; Z=0,V=0 and keep N,C
|
||||
scc
|
||||
sxt @0(r2) ; mode 7
|
||||
sxt @(r2) ; mode 7
|
||||
hcmpeq #cpn00c,(r3) ; Z=0,V=0 and keep N,C
|
||||
;
|
||||
; part 4: check cc for MOV after abort for all memory modes
|
||||
@ -1879,7 +1879,7 @@ tb0301: mov #123,r0 ; src for MOV
|
||||
mov r0,0(r1) ; mode 6
|
||||
mov r0,@(r2)+ ; mode 3
|
||||
mov r0,@-(r2) ; mode 5
|
||||
mov r0,@0(r2) ; mode 7
|
||||
mov r0,@(r2) ; mode 7
|
||||
br 4200$
|
||||
;
|
||||
4100$: inc r5 ; bump counter
|
||||
@ -1972,7 +1972,7 @@ tb0304: clr r0 ; src for INC
|
||||
inc @-(r2) ; mode 5
|
||||
hcmpeq #cp000c,(r3) ; N=0,Z=0,V=0 and keep C
|
||||
scc
|
||||
inc @0(r2) ; mode 7
|
||||
inc @(r2) ; mode 7
|
||||
hcmpeq #cp000c,(r3) ; N=0,Z=0,V=0 and keep C
|
||||
;
|
||||
hcmpeq #7.,(r1) ; check that 7 inc's done
|
||||
@ -1993,7 +1993,7 @@ tb0304: clr r0 ; src for INC
|
||||
inc 0(r1) ; mode 6
|
||||
inc @(r2)+ ; mode 3
|
||||
inc @-(r2) ; mode 5
|
||||
inc @0(r2) ; mode 7
|
||||
inc @(r2) ; mode 7
|
||||
br 2200$
|
||||
;
|
||||
2100$: inc r5 ; bump counter
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
; $Id: cpu_selftest.mac 1345 2023-01-04 18:05:42Z mueller $
|
||||
; $Id: cpu_selftest.mac 1351 2023-01-13 08:38:27Z mueller $
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; Copyright 2022-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
;
|
||||
@ -87,7 +87,7 @@ ta0101: clr r0 ; r0=000000 c=0
|
||||
8$: mov r5,r2 ; r2=302$+6
|
||||
mov -6(r5),r5 ; r5=177777
|
||||
movb r5,@(r2)+ ; 400$[0] = 377; r2=302$+10
|
||||
bisb r5,@0(r2) ; 400$[1] = 377
|
||||
bisb r5,@(r2) ; 400$[1] = 377
|
||||
cmp r3,@-(r2) ; r2=302$+6
|
||||
beq 9$
|
||||
halt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user