1
0
mirror of https://github.com/wfjm/w11.git synced 2026-04-20 10:36:11 +00:00

mlib: add pushm etc; rw11/shell: add ODX format

- tools
  - asm-11/mlib: add pushm,popm,callp and helpers
  - tcl/rw11/shell_egd.tcl: add ODX format option for .e command
  - tcode/cpu_(details|mmu).mac: use pushm,popm
This commit is contained in:
wfjm
2023-02-18 11:34:01 +01:00
parent 6b7c25a961
commit 75578c0f10
11 changed files with 156 additions and 46 deletions

View File

@@ -37,6 +37,8 @@ The full set of tests is only run for tagged releases.
- ip_inspect, ip_create_br: removed
- ip_create_tap: rewritten with 'ip' commands
- ip_delete_tap: added
- tools/asm-11/mlib: add pushm,popm,callp and helpers
- tcl/rw11/shell_egd.tcl: add ODX format option for .e command
### Bug Fixes
- tools/bin/asm-11:
- BUGFIX: fix directly nested .if behavior

View File

@@ -0,0 +1,30 @@
; $Id: $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; set up 'jsr pc' call with argument list on stack
;
.macro callp,func,p0,p1,p2,p3,p4,p5,p6,p7
.mcall callpp
$$$cpp = 0
callpp p7
callpp p6
callpp p5
callpp p4
callpp p3
callpp p2
callpp p1
callpp p0
call func
.if ne,$$$cpp ; any arguments ?
.if eq,$$$cpp-1 ; 1 argument ?
tst (sp)+ ; pop one
.iff
.if eq,$$$cpp-2 ; 2 arguments ?
cmp (sp)+,(sp)+ ; pop two
.iff
add #2*$$$cpp,sp ; pop n
.endc
.endc
.endc
.endm

View File

@@ -0,0 +1,12 @@
; $Id: $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; set up argument for a callp
;
.macro callpp,val
.if nb,val
$$$cpp = $$$cpp + 1
mov val,-(sp)
.endc
.endm

View File

@@ -0,0 +1,15 @@
; $Id: popm.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; pop multiple words from the stack (pops last first)
;
.macro popm,v0,v1,v2,v3,v4,v5
.mcall popnb
popnb v5
popnb v4
popnb v3
popnb v2
popnb v1
popnb v0
.endm

View File

@@ -0,0 +1,11 @@
; $Id: popnb.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; pop word from the stack if argument is non-blank (helper for popm)
;
.macro popnb,v0
.if nb,v0
mov (sp)+,v0
.endc
.endm

View File

@@ -0,0 +1,15 @@
; $Id: pushm.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; push multiple words to the stack
;
.macro pushm,v0,v1,v2,v3,v4,v5
.mcall pushnb
pushnb v0
pushnb v1
pushnb v2
pushnb v3
pushnb v4
pushnb v5
.endm

View File

@@ -0,0 +1,11 @@
; $Id: pushnb.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; push word to the stack if argument is non-blank (helper for popm)
;
.macro pushnb,v0
.if nb,v0
mov v0,-(sp)
.endc
.endm

View File

@@ -1,9 +1,10 @@
# $Id: shell.tcl 1362 2023-01-31 18:16:17Z mueller $
# $Id: shell.tcl 1374 2023-02-18 10:30:46Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2015-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# Revision History:
# Date Rev Version Comment
# 2023-02-17 1374 2.2.7 update '.ha' text output
# 2023-01-31 1362 2.2.6 add rw11::shell_attnmuted to mute CPU attn messages
# 2018-10-21 1058 2.2.5 add after#\d+ scrubber (a real HACK, sorry)
# 2017-04-23 885 2.2.4 adopt .cm* to new interface
@@ -642,10 +643,15 @@ namespace eval rw11 {
append rval "\n MS - for memory access via mmu mode=M and space=S"
append rval "\n - M (mode) as c,p,k,s,u for cm,pm,kern,sup,user"
append rval "\n - S (space) as i,d for instruction,data"
append rval "\n i - print as instruction with dasm"
append rval "\n a - print as ascii"
append rval "\n b - print as binary"
append rval "\n o - print as octal (default)"
append rval "\n d - print as decimal"
append rval "\n x - print as hex"
append rval "\n O - print as octal bytes"
append rval "\n D - print as decimal bytes"
append rval "\n X - print as hex bytes"
append rval "\n a - print as ascii (octal + character)"
append rval "\n i - print as instruction with dasm"
append rval "\n"
append rval "\nexamples:"
append rval "\n .e rpa.cs1 - register rhrp.cs1"

View File

@@ -1,9 +1,10 @@
# $Id: shell_egd.tcl 1274 2022-08-08 09:21:53Z mueller $
# $Id: shell_egd.tcl 1374 2023-02-18 10:30:46Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2015-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# Copyright 2015-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# Revision History:
# Date Rev Version Comment
# 2023-02-17 1374 1.1.4 add 'ODX' format options (byte wise odx)
# 2022-08-08 1274 1.1.3 ssr->mmr rename
# 2019-04-21 1134 1.1.2 shell_aspec_parse: allow 8,9 in numeric address
# 2017-06-09 910 1.1.1 BUGFIX: shell_pspec_map: fix mapping for addr>20000
@@ -71,12 +72,12 @@ namespace eval rw11 {
set opt_cnt 1
foreach opt $opts {
switch -regexp -matchvar mvar -- $opt {
{^[lr]$} { set opt_lr $opt }
{^[cpksu][id]$} { set opt_am $opt }
{^[peu]$} { set opt_am $opt }
{^[iabodxfF]$} { set opt_fmt $opt }
{^(\d)+$} { set opt_cnt $opt }
default { error "-E: bad option: $opt"}
{^[lr]$} { set opt_lr $opt }
{^[cpksu][id]$} { set opt_am $opt }
{^[peu]$} { set opt_am $opt }
{^[iabodxODXfF]$} { set opt_fmt $opt }
{^(\d)+$} { set opt_cnt $opt }
default { error "-E: bad option: $opt"}
}
}
@@ -302,6 +303,33 @@ namespace eval rw11 {
}
}
O {
for {set i 0} {$i < 8 && $ind < $cnt} {incr i; incr ind} {
set val [lindex $rval $ind]
set val0 [expr { $val & 0xff}]
set val1 [expr {($val>>8) & 0xff}]
append line [format " %03o %03o" $val0 $val1]
}
}
D {
for {set i 0} {$i < 8 && $ind < $cnt} {incr i; incr ind} {
set val [lindex $rval $ind]
set val0 [expr { $val & 0xff}]
set val1 [expr {($val>>8) & 0xff}]
append line [format " %3d %3d" $val0 $val1]
}
}
X {
for {set i 0} {$i < 8 && $ind < $cnt} {incr i; incr ind} {
set val [lindex $rval $ind]
set val0 [expr { $val & 0xff}]
set val1 [expr {($val>>8) & 0xff}]
append line [format " %02x %02x" $val0 $val1]
}
}
a {
set blist {}
for {set i 0} {$i < 4 && $ind < $cnt} {incr i; incr ind} {

View File

@@ -1,9 +1,10 @@
; $Id: cpu_details.mac 1359 2023-01-27 20:58:50Z mueller $
; $Id: cpu_details.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; Revision History:
; Date Rev Version Comment
; 2023-02-17 1374 1.1.1 use pushm,popm
; 2023-01-27 1359 1.1 use .mcall and mlib; use rt?jmp, hta??? macros
; 2023-01-11 1349 1.0 Initial version
; 2022-07-18 1259 0.1 First draft
@@ -16,7 +17,7 @@
.include |lib/tcode_std_base.mac|
.include |lib/defs_mmu.mac|
;
.mcall push,pop,push2
.mcall push,pop,push2,pushm,popm
.mcall hcmpeq,htsteq,htstne,htstge,hbiteq,hbitne
.mcall vecset,vecclr
.mcall rtijmp,rttjmp
@@ -237,9 +238,8 @@ ta0201: mov #177777,(r0) ; clear CPUERR (any write should)
mov #2,r3 ; number of modes
;
1000$: clr r1 ; clear tracer
mov #3000$,vhustp ; continuation address
push (r2)+ ; frame: psw
push #2000$ ; frame: address
mov #3000$,vhustp ; continuation address
push2 (r2)+,#2000$ ; frame: psw,address
rti ; start user mode code
halt
;
@@ -1497,10 +1497,7 @@ ta0501: mov #cp.mbr,r0
tb0101: mov #2,r5
100$: mov #1000$,r0
mov #1110$,r1
push 1000$+2 ; save data that will change
push 1000$+6
push 1100$+0
push 1100$+4
pushm 1000$+2,1000$+6,1100$+0,1100$+4 ; save data that will change
;
mov (r0)+,(r0)+ ; mov 111 over 222
add (r0)+,(r0)+ ; add 333 to 444
@@ -1512,10 +1509,7 @@ tb0101: mov #2,r5
hcmpeq 1100$+4,#000444
hcmpeq 1100$+0,#000333
;
pop 1100$+4 ; restore data
pop 1100$+0
pop 1000$+6
pop 1000$+2
popm 1000$+2,1000$+6,1100$+0,1100$+4 ; restore data
sob r5,100$
jmp 9999$
;
@@ -1535,9 +1529,7 @@ tb0101: mov #2,r5
; Test B1.2 -- (pc)+ as destination ++++++++++++++++++++++++++++++++++
;
tb0102: mov #2,r5
100$: push 1000$+4 ; save data that will change
push 1100$+4
push 1200$+2
100$: pushm 1000$+4,1100$+4,1200$+2 ; save data that will change
;
clr r0
1000$: mov #1,#0 ; (pc)+,(pc)+: write #1 over #0
@@ -1549,9 +1541,7 @@ tb0102: mov #2,r5
hcmpeq 1100$+4,#3
hcmpeq r0,#1
;
pop 1200$+2 ; restore data
pop 1100$+4
pop 1000$+4
popm 1000$+4,1100$+4,1200$+2 ; restore data
sob r5,100$
;
9999$: iot ; end of test B1.2

View File

@@ -1,9 +1,10 @@
; $Id: cpu_mmu.mac 1360 2023-01-29 11:51:48Z mueller $
; $Id: cpu_mmu.mac 1374 2023-02-18 10:30:46Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; Revision History:
; Date Rev Version Comment
; 2023-02-17 1374 1.1.2 use push2,pushm,popm
; 2023-01-28 1360 1.1.1 remove <../100> expressions for 6 bit right shift
; 2023-01-27 1358 1.1 use .mcall and mlib; use hta??? macros
; 2023-01-05 1346 1.0 Initial version
@@ -30,7 +31,7 @@
.include |lib/tcode_std_base.mac|
.include |lib/defs_mmu.mac|
;
.mcall push,pop
.mcall push,pop,push2,pushm,popm
.mcall hcmpeq,hcmbeq,htsteq,htstge,hbiteq,hbitne
.mcall vecset,vecclr
.mcall htabuf,htaadd,htaini,htacmp
@@ -1760,12 +1761,7 @@ td0101:
; save all registers
clr -(sp) ; save dummy PC
mfpd sp ; save pm SP
push r5 ; and r5..r0
push r4
push r3
push r2
push r1
push r0
pushm r5,r4,r3,r2,r1,r0 ; and r5..r0
; roll back register changes
mov mmr1,r0 ; get mmr1
mov #2,r1 ; handle both halfes
@@ -1783,12 +1779,7 @@ td0101:
; increase stack by one click --> decrease(!) plf
mov #<126.*md.plf>!md.arw!md.dwn,udpdr1
; restore all registers
pop r0 ; restore r0..r5
pop r1
pop r2
pop r3
pop r4
pop r5
popm r5,r4,r3,r2,r1,r0 ; restore r0..r5
mtpd sp ; restore pm SP
tst (sp)+ ; pop dummy PC
; roll back PC to re-run aborted instruction
@@ -1959,8 +1950,7 @@ td0201: tstb systyp ; skip if not on w11
; use MMR2 to start target handler (PIRQ)
;
mov mmr2,r2 ; get vector address
push 2(r2) ; handler PS
push (r2) ; handler PC
push2 2(r2),(r2) ; handler PS,PC
bic #m0.anr!m0.ale!m0.ard,mmr0 ; clear abort flags
rtt ; and start handler
;