From 82349ddcee4e34880c40f9bce887632e43db4dff Mon Sep 17 00:00:00 2001 From: wfjm Date: Sat, 28 Jan 2023 08:35:37 +0100 Subject: [PATCH] asm-11 .list update; tcode updates - tools/bin - asm-11 - add minimal .list,.nlist (cnd,me,meb) directive support - add -(n)list options - tools/asm-11 - tests(-err): some tuneups - mlib: some macros added, some tuneups - tools/tcode/cpu_(details|mmu).mac: use rt?jmp, hta??? macros --- doc/CHANGELOG.md | 4 + tools/asm-11/mlib/hbiteq.mac | 5 +- tools/asm-11/mlib/hbitne.mac | 5 +- tools/asm-11/mlib/hcmbeq.mac | 5 +- tools/asm-11/mlib/hcmpeq.mac | 5 +- tools/asm-11/mlib/htaadd.mac | 11 + tools/asm-11/mlib/htabuf.mac | 13 ++ tools/asm-11/mlib/htacmp.mac | 11 + tools/asm-11/mlib/htaini.mac | 11 + tools/asm-11/mlib/htsbeq.mac | 5 +- tools/asm-11/mlib/htsbne.mac | 5 +- tools/asm-11/mlib/htsteq.mac | 5 +- tools/asm-11/mlib/htstge.mac | 5 +- tools/asm-11/mlib/htstne.mac | 5 +- tools/asm-11/mlib/pop.mac | 4 +- tools/asm-11/mlib/popb.mac | 4 +- tools/asm-11/mlib/push.mac | 4 +- tools/asm-11/mlib/push2.mac | 4 +- tools/asm-11/mlib/pushb.mac | 4 +- tools/asm-11/mlib/rtijmp.mac | 12 + tools/asm-11/mlib/rttjmp.mac | 12 + tools/asm-11/mlib/vecclr.mac | 4 +- tools/asm-11/mlib/vecini.mac | 4 +- tools/asm-11/mlib/vecset.mac | 5 +- .../tests-err/testerr_0220_Aerror_if.mac | 6 +- .../asm-11/tests-err/testerr_0300_Oerror.mac | 4 +- .../tests-err/testerr_0310_Oerror_mdel.mac | 4 +- .../asm-11/tests-err/testerr_0503_end_if.mac | 4 +- .../tests-err/testerr_0513_end_if_open.mac | 4 +- tools/asm-11/tests/test_0350_macro_concat.mac | 3 +- tools/asm-11/tests/test_0360_macro_mexit.mac | 3 +- tools/asm-11/tests/test_0400_if_eq.mac | 5 +- tools/asm-11/tests/test_0410_if_df.mac | 4 +- tools/asm-11/tests/test_0420_if_b.mac | 4 +- tools/asm-11/tests/test_0430_if_idn.mac | 3 +- tools/asm-11/tests/test_0440_iff.mac | 4 +- tools/asm-11/tests/test_0450_if_macro.mac | 3 +- tools/asm-11/tests/test_0510_rept_mexit.mac | 3 +- tools/asm-11/tests/test_0600_mcall.mac | 3 +- tools/bin/asm-11 | 123 ++++++++--- tools/man/man1/asm-11.1 | 27 ++- tools/tcode/cpu_details.mac | 208 ++++++------------ tools/tcode/cpu_mmu.mac | 58 ++--- 43 files changed, 372 insertions(+), 253 deletions(-) create mode 100644 tools/asm-11/mlib/htaadd.mac create mode 100644 tools/asm-11/mlib/htabuf.mac create mode 100644 tools/asm-11/mlib/htacmp.mac create mode 100644 tools/asm-11/mlib/htaini.mac create mode 100644 tools/asm-11/mlib/rtijmp.mac create mode 100644 tools/asm-11/mlib/rttjmp.mac diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 4c713c0e..9b71fe33 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -36,7 +36,9 @@ The full set of tests is only run for tagged releases. - add .if, .if(f|t|tf), .endc, .rept, .endr, .mexit directives - add .error, .print, .mcall, .mdelete directives - add .narg, .nchr, .ntype directives + - add minimal .list,.nlist support for cnd, me and meb - rewrite macro definition and call argument parsing & handling + - add -list and -nlist options - add -L option (to set .mcall pathlist) - add auto-generated ...top label - add flag (MRmrd) column in output format @@ -47,6 +49,8 @@ The full set of tests is only run for tagged releases. - tests(-err): many tests added - tests(-err)/Makefile: distclean target added - mlib: macro library, accessed by .mcall + - tools/tcode + - use .mcall and mlib ### Bug Fixes - tools/bin/asm-11: - BUGFIX: support @(R) modifier with omitted offset diff --git a/tools/asm-11/mlib/hbiteq.mac b/tools/asm-11/mlib/hbiteq.mac index bbcedfa4..d5299359 100644 --- a/tools/asm-11/mlib/hbiteq.mac +++ b/tools/asm-11/mlib/hbiteq.mac @@ -1,8 +1,9 @@ -; $Id: hbiteq.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: hbiteq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; bit on eq +; halt check: bit on eq +; .macro hbiteq,src,dst bit src,dst beq .+4 diff --git a/tools/asm-11/mlib/hbitne.mac b/tools/asm-11/mlib/hbitne.mac index 3cf05774..c63614c6 100644 --- a/tools/asm-11/mlib/hbitne.mac +++ b/tools/asm-11/mlib/hbitne.mac @@ -1,8 +1,9 @@ -; $Id: hbitne.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: hbitne.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; bit on ne +; halt check: bit on ne +; .macro hbitne,src,dst bit src,dst bne .+4 diff --git a/tools/asm-11/mlib/hcmbeq.mac b/tools/asm-11/mlib/hcmbeq.mac index 92fe06a4..faef10b9 100644 --- a/tools/asm-11/mlib/hcmbeq.mac +++ b/tools/asm-11/mlib/hcmbeq.mac @@ -1,8 +1,9 @@ -; $Id: hcmbeq.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: hcmbeq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; cmpb on eq +; halt check: cmpb on eq +; .macro hcmbeq,src,dst cmpb src,dst beq .+4 diff --git a/tools/asm-11/mlib/hcmpeq.mac b/tools/asm-11/mlib/hcmpeq.mac index 0129cb7b..697800ab 100644 --- a/tools/asm-11/mlib/hcmpeq.mac +++ b/tools/asm-11/mlib/hcmpeq.mac @@ -1,8 +1,9 @@ -; $Id: hcmpeq.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: hcmpeq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; cmp on eq +; halt check: cmp on eq +; .macro hcmpeq,src,dst cmp src,dst beq .+4 diff --git a/tools/asm-11/mlib/htaadd.mac b/tools/asm-11/mlib/htaadd.mac new file mode 100644 index 00000000..5c7dbbb6 --- /dev/null +++ b/tools/asm-11/mlib/htaadd.mac @@ -0,0 +1,11 @@ +; $Id: htaadd.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for trace area add entry +; usage: htaadd #v..bpt +; + .macro htaadd,tvec,tadr=(sp) + mov tvec,(r5)+ + mov tadr,(r5)+ + .endm diff --git a/tools/asm-11/mlib/htabuf.mac b/tools/asm-11/mlib/htabuf.mac new file mode 100644 index 00000000..574234e2 --- /dev/null +++ b/tools/asm-11/mlib/htabuf.mac @@ -0,0 +1,13 @@ +; $Id: htabuf.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for trace area buffer allocation +; usage: 200$: htabuf 2. +; + .macro htabuf,nent + .rept nent + .word 0,0 + .endr + .word -1,-1 + .endm diff --git a/tools/asm-11/mlib/htacmp.mac b/tools/asm-11/mlib/htacmp.mac new file mode 100644 index 00000000..700f5592 --- /dev/null +++ b/tools/asm-11/mlib/htacmp.mac @@ -0,0 +1,11 @@ +; $Id: htacmp.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for trace area check entry +; usage: htacmp #v..bpt,#100$ +; + .macro htacmp,tvec,tadr + hcmpeq tvec,(r5)+ + hcmpeq tadr,(r5)+ + .endm diff --git a/tools/asm-11/mlib/htaini.mac b/tools/asm-11/mlib/htaini.mac new file mode 100644 index 00000000..8712fdad --- /dev/null +++ b/tools/asm-11/mlib/htaini.mac @@ -0,0 +1,11 @@ +; $Id: htaini.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for trace area check setup +; usage: htaini 200$,2. +; + .macro htaini,buf,nent + hcmpeq #buf+<4*nent>,r5 + mov #buf,r5 + .endm diff --git a/tools/asm-11/mlib/htsbeq.mac b/tools/asm-11/mlib/htsbeq.mac index 2e30b854..e8566523 100644 --- a/tools/asm-11/mlib/htsbeq.mac +++ b/tools/asm-11/mlib/htsbeq.mac @@ -1,8 +1,9 @@ -; $Id: htsbeq.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: htsbeq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; tstb on eq +; halt check: tstb on eq +; .macro htsbeq,src tstb src beq .+4 diff --git a/tools/asm-11/mlib/htsbne.mac b/tools/asm-11/mlib/htsbne.mac index 49e45ea1..52a9a602 100644 --- a/tools/asm-11/mlib/htsbne.mac +++ b/tools/asm-11/mlib/htsbne.mac @@ -1,8 +1,9 @@ -; $Id: htsbne.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: htsbne.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; tstb on ne +; halt check: tstb on ne +; .macro htsbne,src tstb src bne .+4 diff --git a/tools/asm-11/mlib/htsteq.mac b/tools/asm-11/mlib/htsteq.mac index 31466266..131e026f 100644 --- a/tools/asm-11/mlib/htsteq.mac +++ b/tools/asm-11/mlib/htsteq.mac @@ -1,8 +1,9 @@ -; $Id: htsteq.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: htsteq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; tst on eq +; halt check: tst on eq +; .macro htsteq,src tst src beq .+4 diff --git a/tools/asm-11/mlib/htstge.mac b/tools/asm-11/mlib/htstge.mac index 827d197a..3ad02e88 100644 --- a/tools/asm-11/mlib/htstge.mac +++ b/tools/asm-11/mlib/htstge.mac @@ -1,8 +1,9 @@ -; $Id: htstge.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: htstge.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; tst on ge +; halt check: tst on ge +; .macro htstge,src tst src bge .+4 diff --git a/tools/asm-11/mlib/htstne.mac b/tools/asm-11/mlib/htstne.mac index 6513ccd5..e82b0f67 100644 --- a/tools/asm-11/mlib/htstne.mac +++ b/tools/asm-11/mlib/htstne.mac @@ -1,8 +1,9 @@ -; $Id: htstne.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: htstne.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; -; tst on ne +; halt check: tst on ne +; .macro htstne,src tst src bne .+4 diff --git a/tools/asm-11/mlib/pop.mac b/tools/asm-11/mlib/pop.mac index 46fbafd1..57bb4149 100644 --- a/tools/asm-11/mlib/pop.mac +++ b/tools/asm-11/mlib/pop.mac @@ -1,6 +1,8 @@ -; $Id: pop.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: pop.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller +; +; pop a word of the stack ; .macro pop,dst mov (sp)+,dst diff --git a/tools/asm-11/mlib/popb.mac b/tools/asm-11/mlib/popb.mac index 8505beb1..13bc81ff 100644 --- a/tools/asm-11/mlib/popb.mac +++ b/tools/asm-11/mlib/popb.mac @@ -1,6 +1,8 @@ -; $Id: popb.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: popb.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller +; +; pop a byte of the stack ; .macro popb,dst movb (sp)+,dst diff --git a/tools/asm-11/mlib/push.mac b/tools/asm-11/mlib/push.mac index 4c9d56a5..d51bb9dd 100644 --- a/tools/asm-11/mlib/push.mac +++ b/tools/asm-11/mlib/push.mac @@ -1,6 +1,8 @@ -; $Id: push.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: push.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller +; +; push a word to the stack ; .macro push,src mov src,-(sp) diff --git a/tools/asm-11/mlib/push2.mac b/tools/asm-11/mlib/push2.mac index 1a225fc6..5a10da90 100644 --- a/tools/asm-11/mlib/push2.mac +++ b/tools/asm-11/mlib/push2.mac @@ -1,6 +1,8 @@ -; $Id: push2.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: push2.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller +; +; push two words to the stack ; .macro push2,src1,src2 mov src1,-(sp) diff --git a/tools/asm-11/mlib/pushb.mac b/tools/asm-11/mlib/pushb.mac index 2d40ae75..b453d6ad 100644 --- a/tools/asm-11/mlib/pushb.mac +++ b/tools/asm-11/mlib/pushb.mac @@ -1,6 +1,8 @@ -; $Id: pushb.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: pushb.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller +; +; push a byte to the stack ; .macro pushb,src movb src,-(sp) diff --git a/tools/asm-11/mlib/rtijmp.mac b/tools/asm-11/mlib/rtijmp.mac new file mode 100644 index 00000000..055a12c8 --- /dev/null +++ b/tools/asm-11/mlib/rtijmp.mac @@ -0,0 +1,12 @@ +; $Id: rtijmp.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for JMP via RTI with new PS,PC +; usage: rtijmp #cp.cmu+cp.t,#5100$ +; + .macro rtijmp,newps,newpc + push2 newps,newpc + rti + halt + .endm diff --git a/tools/asm-11/mlib/rttjmp.mac b/tools/asm-11/mlib/rttjmp.mac new file mode 100644 index 00000000..5cf265d6 --- /dev/null +++ b/tools/asm-11/mlib/rttjmp.mac @@ -0,0 +1,12 @@ +; $Id: rttjmp.mac 1359 2023-01-27 20:58:50Z mueller $ +; SPDX-License-Identifier: GPL-3.0-or-later +; Copyright 2023- by Walter F.J. Mueller +; +; macro for JMP via RTT with new PS,PC +; usage: rtijmp #cp.cmu+cp.t,#5100$ +; + .macro rttjmp,newps,newpc + push2 newps,newpc + rtt + halt + .endm diff --git a/tools/asm-11/mlib/vecclr.mac b/tools/asm-11/mlib/vecclr.mac index 7e87a4a6..63e817d7 100644 --- a/tools/asm-11/mlib/vecclr.mac +++ b/tools/asm-11/mlib/vecclr.mac @@ -1,6 +1,8 @@ -; $Id: vecclr.mac 1357 2023-01-26 19:24:10Z mueller $ +; $Id: vecclr.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller +; +; reset vector to catcher ; .macro vecclr,name mov #name+2,@#name diff --git a/tools/asm-11/mlib/vecini.mac b/tools/asm-11/mlib/vecini.mac index 0e228a3e..423d4f6a 100644 --- a/tools/asm-11/mlib/vecini.mac +++ b/tools/asm-11/mlib/vecini.mac @@ -1,6 +1,8 @@ -; $Id: vecini.mac 1357 2023-01-26 19:24:10Z mueller $ +; $Id: vecini.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller +; +; allocate and initialize vector, set up as catcher ; .macro vecini,addr,name . = addr diff --git a/tools/asm-11/mlib/vecset.mac b/tools/asm-11/mlib/vecset.mac index 7432aa2b..3ad842e0 100644 --- a/tools/asm-11/mlib/vecset.mac +++ b/tools/asm-11/mlib/vecset.mac @@ -1,6 +1,8 @@ -; $Id: vecset.mac 1357 2023-01-26 19:24:10Z mueller $ +; $Id: vecset.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller +; +; set vector to handler and PS (default pr0 kernel) ; .macro vecset,name,hdl,pri mov #hdl,@#name @@ -8,4 +10,5 @@ clr @#name+2 .iff mov #pri,@#name+2 + .endc .endm diff --git a/tools/asm-11/tests-err/testerr_0220_Aerror_if.mac b/tools/asm-11/tests-err/testerr_0220_Aerror_if.mac index 78f664b5..ca104ca1 100644 --- a/tools/asm-11/tests-err/testerr_0220_Aerror_if.mac +++ b/tools/asm-11/tests-err/testerr_0220_Aerror_if.mac @@ -1,4 +1,4 @@ -; $Id: testerr_0220_Aerror_if.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: testerr_0220_Aerror_if.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -7,7 +7,9 @@ ; .asect . = 1000 - +; + .list cnd +; ; invalid .if statements .if ;;!! A .endc diff --git a/tools/asm-11/tests-err/testerr_0300_Oerror.mac b/tools/asm-11/tests-err/testerr_0300_Oerror.mac index aa49b86a..56f2ef11 100644 --- a/tools/asm-11/tests-err/testerr_0300_Oerror.mac +++ b/tools/asm-11/tests-err/testerr_0300_Oerror.mac @@ -1,4 +1,4 @@ -; $Id: testerr_0300_Oerror.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: testerr_0300_Oerror.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,6 +6,8 @@ ; .asect . = 1000 +; + .list cnd ; ; misplaced .end* .endr ;;!! O diff --git a/tools/asm-11/tests-err/testerr_0310_Oerror_mdel.mac b/tools/asm-11/tests-err/testerr_0310_Oerror_mdel.mac index 33996814..a09063dd 100644 --- a/tools/asm-11/tests-err/testerr_0310_Oerror_mdel.mac +++ b/tools/asm-11/tests-err/testerr_0310_Oerror_mdel.mac @@ -1,4 +1,4 @@ -; $Id: testerr_0310_Oerror_mdel.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: testerr_0310_Oerror_mdel.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -7,6 +7,8 @@ ; .asect . = 1000 +; + .list cnd ; .if df,...top ; asm-11 only ; diff --git a/tools/asm-11/tests-err/testerr_0503_end_if.mac b/tools/asm-11/tests-err/testerr_0503_end_if.mac index 77360deb..6803cd41 100644 --- a/tools/asm-11/tests-err/testerr_0503_end_if.mac +++ b/tools/asm-11/tests-err/testerr_0503_end_if.mac @@ -1,4 +1,4 @@ -; $Id: testerr_0503_end_if.mac 1356 2023-01-26 15:10:23Z mueller $ +; $Id: testerr_0503_end_if.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -7,6 +7,8 @@ ; .asect . = 1000 +; + .list cnd ; .if eq,0 .end ;;!! O diff --git a/tools/asm-11/tests-err/testerr_0513_end_if_open.mac b/tools/asm-11/tests-err/testerr_0513_end_if_open.mac index 1f6ae42f..43508064 100644 --- a/tools/asm-11/tests-err/testerr_0513_end_if_open.mac +++ b/tools/asm-11/tests-err/testerr_0513_end_if_open.mac @@ -1,9 +1,11 @@ -; $Id: testerr_0513_end_if_open.mac 1356 2023-01-26 15:10:23Z mueller $ +; $Id: testerr_0513_end_if_open.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; ; test .end ; case: missing .endc causes to E error +; + .list cnd ; .asect . = 1000 diff --git a/tools/asm-11/tests/test_0350_macro_concat.mac b/tools/asm-11/tests/test_0350_macro_concat.mac index 778994fd..326e1b83 100644 --- a/tools/asm-11/tests/test_0350_macro_concat.mac +++ b/tools/asm-11/tests/test_0350_macro_concat.mac @@ -1,4 +1,4 @@ -; $Id: test_0350_macro_concat.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: test_0350_macro_concat.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -9,6 +9,7 @@ ; list macro expansion .list me + .list cnd ; ; define and use macro with a concatinated label ; check label creation with .if df diff --git a/tools/asm-11/tests/test_0360_macro_mexit.mac b/tools/asm-11/tests/test_0360_macro_mexit.mac index a91efb14..3e48ade2 100644 --- a/tools/asm-11/tests/test_0360_macro_mexit.mac +++ b/tools/asm-11/tests/test_0360_macro_mexit.mac @@ -1,4 +1,4 @@ -; $Id: test_0360_macro_mexit.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: test_0360_macro_mexit.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -9,6 +9,7 @@ ; list macro expansion .list me + .list cnd ; ; nested macro calls, ensure that .mexit individually .macro mtop,src diff --git a/tools/asm-11/tests/test_0400_if_eq.mac b/tools/asm-11/tests/test_0400_if_eq.mac index 179cd6a3..65dc31f6 100644 --- a/tools/asm-11/tests/test_0400_if_eq.mac +++ b/tools/asm-11/tests/test_0400_if_eq.mac @@ -1,4 +1,4 @@ -; $Id: test_0400_if_eq.mac 1353 2023-01-23 18:13:53Z mueller $ +; $Id: test_0400_if_eq.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,11 +6,12 @@ ; .asect . = 1000 +; + .list cnd ; a = 1 b = 2 c = a + b -; ; .if eq,-1 ; eq -1 --------- .word 001001 ; not assembled diff --git a/tools/asm-11/tests/test_0410_if_df.mac b/tools/asm-11/tests/test_0410_if_df.mac index b918f162..6e0d2777 100644 --- a/tools/asm-11/tests/test_0410_if_df.mac +++ b/tools/asm-11/tests/test_0410_if_df.mac @@ -1,4 +1,4 @@ -; $Id: test_0410_if_df.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: test_0410_if_df.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,6 +6,8 @@ ; .asect . = 1000 +; + .list cnd ; a = 1 b = 2 diff --git a/tools/asm-11/tests/test_0420_if_b.mac b/tools/asm-11/tests/test_0420_if_b.mac index 3d4ceb2b..6725ff52 100644 --- a/tools/asm-11/tests/test_0420_if_b.mac +++ b/tools/asm-11/tests/test_0420_if_b.mac @@ -1,4 +1,4 @@ -; $Id: test_0420_if_b.mac 1353 2023-01-23 18:13:53Z mueller $ +; $Id: test_0420_if_b.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,6 +6,8 @@ ; .asect . = 1000 +; + .list cnd ; a = 1 b = 2 diff --git a/tools/asm-11/tests/test_0430_if_idn.mac b/tools/asm-11/tests/test_0430_if_idn.mac index d576c0e8..ab75f8cd 100644 --- a/tools/asm-11/tests/test_0430_if_idn.mac +++ b/tools/asm-11/tests/test_0430_if_idn.mac @@ -1,4 +1,4 @@ -; $Id: test_0430_if_idn.mac 1355 2023-01-25 21:14:24Z mueller $ +; $Id: test_0430_if_idn.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -8,6 +8,7 @@ . = 1000 ; .list me + .list cnd ; ; Note: if idn/dif seems to be broken in RT-11 MACRO-11 ; diff --git a/tools/asm-11/tests/test_0440_iff.mac b/tools/asm-11/tests/test_0440_iff.mac index 4a503a50..526c40f4 100644 --- a/tools/asm-11/tests/test_0440_iff.mac +++ b/tools/asm-11/tests/test_0440_iff.mac @@ -1,4 +1,4 @@ -; $Id: test_0440_iff.mac 1353 2023-01-23 18:13:53Z mueller $ +; $Id: test_0440_iff.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,6 +6,8 @@ ; .asect . = 1000 +; + .list cnd ; a = 1 b = 2 diff --git a/tools/asm-11/tests/test_0450_if_macro.mac b/tools/asm-11/tests/test_0450_if_macro.mac index c5a99aed..c8c90e9a 100644 --- a/tools/asm-11/tests/test_0450_if_macro.mac +++ b/tools/asm-11/tests/test_0450_if_macro.mac @@ -1,4 +1,4 @@ -; $Id: test_0450_if_macro.mac 1353 2023-01-23 18:13:53Z mueller $ +; $Id: test_0450_if_macro.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -9,6 +9,7 @@ ; list macro expansion .list me + .list cnd ; .macro movclr,dst,src .if b,dst diff --git a/tools/asm-11/tests/test_0510_rept_mexit.mac b/tools/asm-11/tests/test_0510_rept_mexit.mac index 763c4120..943ffaee 100644 --- a/tools/asm-11/tests/test_0510_rept_mexit.mac +++ b/tools/asm-11/tests/test_0510_rept_mexit.mac @@ -1,4 +1,4 @@ -; $Id: test_0510_rept_mexit.mac 1353 2023-01-23 18:13:53Z mueller $ +; $Id: test_0510_rept_mexit.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -9,6 +9,7 @@ ; list macro expansion .list me + .list cnd ; ; single .rept with an .mexit abort a = 1020 ; write limit diff --git a/tools/asm-11/tests/test_0600_mcall.mac b/tools/asm-11/tests/test_0600_mcall.mac index b023c292..cb2ccc27 100644 --- a/tools/asm-11/tests/test_0600_mcall.mac +++ b/tools/asm-11/tests/test_0600_mcall.mac @@ -1,4 +1,4 @@ -; $Id: test_0600_mcall.mac 1354 2023-01-24 16:29:10Z mueller $ +; $Id: test_0600_mcall.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -11,6 +11,7 @@ ; list macro expansion .list me + .list cnd ; .mcall push,pop ; diff --git a/tools/bin/asm-11 b/tools/bin/asm-11 index 1d4a205d..eafa9643 100755 --- a/tools/bin/asm-11 +++ b/tools/bin/asm-11 @@ -1,10 +1,11 @@ #!/usr/bin/perl -w -# $Id: asm-11 1357 2023-01-26 19:24:10Z mueller $ +# $Id: asm-11 1359 2023-01-27 20:58:50Z mueller $ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright 2013-2023 by Walter F.J. Mueller # # Revision History: # Date Rev Version Comment +# 2023-01-27 1359 1.2.4 add minimal .list,.nlist (cnd,me,meb); add -(n)list # 2023-01-26 1357 1.2.3 skip redundant loads in .mcall # 2023-01-25 1355 1.2.2 rewrite macro args handling; add .narg,.nchr,.ntype # 2023-01-24 1354 1.2.1 add .error,.print,.mcall,.mdelete; add -L; add ...top @@ -15,7 +16,7 @@ # 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 -# 2019-05-25 1152 1.1 add .macro,.endm,.list,.nlist +# 2019-05-25 1152 1.1 add .macro,.endm; dummy .list,.nlist # 2019-04-25 1138 1.0.7 print lines with errors to stderr unless -lst seen # 2019-04-19 1133 1.0.6 .end directive autocreates '...end' label # 2018-11-03 1065 1.0.5 add and use bailout @@ -47,6 +48,7 @@ GetOptions(\%opts, "help", "E", "M", "ttoken", "tparse", "temit", "tout", "I=s@", "L=s@", + "list=s@", "nlist=s@", "lst", "olst=s", "lda", "olda=s", "cof", "ocof=s", @@ -58,6 +60,26 @@ unshift @{$opts{I}}, "."; # ./ is first in include path push @{$opts{I}}, "$ENV{RETROBASE}/tools/asm-11" if defined $ENV{RETROBASE}; push @{$opts{L}}, "$ENV{RETROBASE}/tools/asm-11/mlib" if defined $ENV{RETROBASE}; +# .list/.nlist status +my %list = (cnd => 0, # unsatisfied conditional code off + me => 0, # macro&repeat expansions off + meb => 1); # macro&repeat expansions binary on +# --list and --nlist +foreach my $arg (@{$opts{list}}) { + if (exists $list{$arg}) { + $list{$arg} = 1; + } else { + bailout("bad -list option '$arg'"); + } +} +foreach my $arg (@{$opts{nlist}}) { + if (exists $list{$arg}) { + $list{$arg} = 0; + } else { + bailout("bad -nlist option '$arg'"); + } +} + # Permanant symbol table my %pst = ( # directives @@ -356,7 +378,7 @@ foreach my $fname (@ARGV) { } if ($end == 0 && ($mdeflvl + $reptlvl + # no .end but .macro or .rept open scalar(@ifstk) != 0)) { # or .endc open - pass1_line(1, 0, '', ' '); # add dummy line + pass1_line(1, 0, ''); # add dummy line add_err($src[-1], 'E'); # and signal E error } exit 0 if $opts{E} || $opts{M}; # stop after pass1 for -E -M @@ -437,7 +459,7 @@ sub read_file { printf "$line\n"; # write to stdout } $lineno += 1; - pass1_line($fileno, $lineno, $line, ' '); + pass1_line($fileno, $lineno, $line); last if $end; } @@ -467,7 +489,7 @@ sub exec_macro { } $line .= $lrest; $mexit = 0; - pass1_line($fileno, $lineno, $line, 'm'); + pass1_line($fileno, $lineno, $line); last if $mexit; } $mexit = 0; @@ -487,9 +509,9 @@ sub delete_macro { #------------------------------------------------------------------------------- sub pass1_line { - my ($fileno,$lineno,$line,$flag) = @_; + my ($fileno,$lineno,$line) = @_; - my $rl = parse_line($fileno, $lineno, $line, $flag); + my $rl = parse_line($fileno, $lineno, $line); dump_rl($rl) if $opts{tpass1}; push @src, $rl; @@ -536,7 +558,7 @@ sub pass1_line { $lineno += 1; $mseen = 1 if $line =~m/^\s*\.macro/; # .macro seen ? next unless $mseen; - pass1_line($fileno, $lineno, $line, ' '); + pass1_line($fileno, $lineno, $line); printf "$line\n" if $opts{E}; # if -E write to stdout last if $mdeflvl == 0; # final .endm seen ? } @@ -554,7 +576,7 @@ sub pass1_line { for (my $i=0; $i<$cnt; $i++) { # repeat body cnt times foreach my $rline (@{$reptstk[-1]{body}}) { $mexit = 0; - pass1_line($rline->{fileno}, $rline->{lineno}, $rline->{line}, 'r'); + pass1_line($rline->{fileno}, $rline->{lineno}, $rline->{line}); last if $mexit; } last if $mexit; @@ -567,6 +589,7 @@ sub pass1_line { # handle macro expansions -------------------------------- if (defined $$rl{oper} && defined $$rl{mexec}) { + $$rl{lstdot} = 1 unless $list{me} || $list{meb}; exec_macro($$rl{mexec}); } return; @@ -575,7 +598,7 @@ sub pass1_line { #------------------------------------------------------------------------------- sub parse_line { - my ($fileno,$lineno,$line,$flag) = @_; + my ($fileno,$lineno,$line) = @_; my %l = ( fileno => $fileno, # file number lineno => $lineno, # line number @@ -583,7 +606,7 @@ sub parse_line { cl => [split '',$line], # char list tl => [], # token list err => '', # error tags - flag => $flag, # line flag + flag => '', # line flags psect => $cur_psect, # current psect dot => getdot(), # current dot outw => [], # output: words @@ -625,6 +648,10 @@ sub parse_line { printf "-- parse: '$line'\n" if $opts{tparse} || $opts{ttoken}; + # basics flags + add_flag(\%l, 'm') if scalar(@mexecstk); # in macro execution + add_flag(\%l, 'r') if scalar(@reptstk); # in .rept expansion + # quit if invalid character found (non 7 bit ascii in asm-11) foreach my $c (@{$l{cl}}) { if (ord($c) > 127) { @@ -644,9 +671,10 @@ sub parse_line { } if (scalar(@ifstk)) { # is .if conditional block active ? + add_flag(\%l,'c'); # flag conditional block unless ($dnam =~ m/^\.(iff|ift|iftf|endc)$/) { # and not sub-cond or end unless ($ifstk[-1]{cur}) { # if (sub-)cond false - $l{flag} = 'd'; # mark condition drop + add_flag(\%l,'d'); # flag condition drop return \%l; # ignore line } } @@ -656,7 +684,7 @@ sub parse_line { $reptlvl += 1 if $dnam eq '.rept'; # nested .rept found ? $reptlvl -= 1 if $dnam eq '.endr'; # .endr found ? if ($reptlvl > 0) { # final .endr not yet seen - $l{flag} = 'R'; + add_flag(\%l,'R'); # flag .rept definition push @{$reptstk[-1]{body}}, {line => $l{line}, fileno => $l{fileno}, lineno => $l{lineno} @@ -669,7 +697,7 @@ sub parse_line { $mdeflvl += 1 if $dnam eq '.macro'; # nested .macro found ? $mdeflvl -= 1 if $dnam eq '.endm'; # .endm found ? if ($mdeflvl > 0) { - $l{flag} = 'M'; + add_flag(\%l,'M'); # flag .macro definition push @{$mst{$mdefnam}{body}}, {line => $l{line}, fileno => $l{fileno}, lineno => $l{lineno} @@ -891,6 +919,7 @@ sub parse_line { } else { # no conditiion -> A error add_err(\%l, 'A'); } + add_flag(\%l,'c'); # flag conditional block push @ifstk, {tst => $tst, cur => $tst}; $state = 'end'; @@ -917,7 +946,7 @@ sub parse_line { } elsif ($op eq '.macro') { # .macro --------------- $rt = get_token(\%l, $tmask); if ($$rt{tag} eq 'SYM') { - $l{flag} = 'M'; + add_flag(\%l,'M'); # flag .macro definition $mdeflvl = 1; $mdefnam = $$rt{val}; $mst{$mdefnam} = {name => $mdefnam, @@ -980,7 +1009,7 @@ sub parse_line { if (not defined $mdefnam) { # .macro not active ? add_err(\%l, 'O'); # quit with O error } else { - $l{flag} = "M"; + add_flag(\%l,'M'); # flag .macro definition $rt = get_token(\%l, $tmask); if ($$rt{tag} eq 'SYM') { # if non-matching name -> A error add_err(\%l, 'A') if $$rt{val} ne $mdefnam; @@ -1115,14 +1144,14 @@ sub parse_line { $state = 'end'; } elsif ($op eq '.rept') { # .rept ---------------- - $l{flag} = 'R'; + add_flag(\%l,'R'); # flag .rept definition $state = 'dl_beg'; } elsif ($op eq '.endr') { # .endr ---------------- if (scalar(@reptstk) == 0) { # .rept block not active ? add_err(\%l, 'O'); # quit with O error } else { - $l{flag} = "R"; + add_flag(\%l,'R'); # flag .rept definition } $state = 'end'; @@ -1138,8 +1167,12 @@ sub parse_line { while (1) { # loop over options $rt = get_token(\%l, $tmask); last if $$rt{tag} eq 'EOL'; - next if $$rt{tag} eq 'DEL'; # FIXME_code: check delimiter - # FIXME_code: handle .list/.nlist + next if check_token($rt, 'DEL', ','); + if ($$rt{tag} eq 'SYM') { + $list{$$rt{val}} = $op eq '.list' if exists $list{$$rt{val}}; + } else { + add_err(\%l, 'A'); # non-symbol as arg -> O error + } } $state = 'end'; } elsif ($op eq '.end') { # .end ----------------- @@ -1777,13 +1810,21 @@ sub walign { sub add_err { my ($rl,$errlist) = @_; foreach my $err (split '',$errlist) { - next if index($$rl{err}, $err) >= 0; # prevent multiple error tags - $$rl{err} .= $err; # set error tag - $errcnt{$err} += 1; # and count them + next if index($$rl{err}, $err) >= 0; # prevent multiple error tags + $$rl{err} .= $err; # set error tag + $errcnt{$err} += 1; # and count them $errcnt_tot += 1; } return; } +#------------------------------------------------------------------------------- + +sub add_flag { + my ($rl,$flag) = @_; + next if index($$rl{flag}, $flag) >= 0; # prevent multiple flags + $$rl{flag} .= $flag; # set flag + return; +} #------------------------------------------------------------------------------- @@ -2612,9 +2653,30 @@ sub pass2_lst_line { my @ow = @{$$rl{outw}}; my @ob = @{$$rl{outb}}; my $str = ''; + my $flag = ' '; + + # check active .list and skip if not selected + if ($$rl{flag} =~ m/d/) { + return unless $list{cnd}; + } + if ($$rl{flag} =~ m/[mr]/) { + if (scalar(@ow)+scalar(@ob) == 0) { + return unless $list{me}; + } else { + return unless $list{me} || $list{meb}; + } + } + + # print err,fileno,flag,lineno + # flag priority list lowest first + $flag = 'm' if $$rl{flag} =~ m/m/; + $flag = 'r' if $$rl{flag} =~ m/r/; + $flag = 'd' if $$rl{flag} =~ m/d/; + $flag = 'M' if $$rl{flag} =~ m/M/; + $flag = 'R' if $$rl{flag} =~ m/R/; $str .= sprintf("%-2s", prt_err($rl)); $str .= sprintf(" %2d", $$rl{fileno}); - $str .= $$rl{flag}; + $str .= $flag; $str .= sprintf(" %4d", $$rl{lineno}); # print dot if data is generated for this line, or label @@ -3049,9 +3111,12 @@ sub dump_rl { my ($rl) = @_; printf "-- line: '%s'\n", $$rl{line}; - printf " err=%-3s, typ=%-4s, oper=%-6s, lineno=%3d, psect=%-6s, .=%6.6o\n", - prt_err($rl), savestr($$rl{typ}), savestr($$rl{oper}), $$rl{lineno}, - $$rl{psect}, $$rl{dot}; + printf " e=%-3s f=%-3s t=%-6s o=%-8s l=%4d p=%-6s .=%6.6o", + prt_err($rl), (join '', sort split '', $$rl{flag}), + savestr($$rl{typ}), savestr($$rl{oper}), $$rl{lineno}, + $$rl{psect}, $$rl{dot}; + printf " MRmri=%d %d %d %d %d\n", + $mdeflvl, $reptlvl, scalar(@mexecstk), scalar(@reptstk), scalar(@ifstk); my $i = 0; foreach my $rt (@{$$rl{tl}}) { printf " tl[%2d]: tag=%-4s, typ=%-2s, om=%-2s, em=%-2s, val='%s'", @@ -3120,7 +3185,7 @@ sub dump_rl { printf "\n"; } foreach my $key (sort keys %{$rl}) { - next if $key =~ m/^(line|err|typ|oper|lineno|psect|dot|opcode|opfmt|o[12](mod|reg|ebeg|eend)|ebeg|eend|tl|delist|outw|outb|cl|mexec)$/; + next if $key =~ m/^(line|err|typ|oper|lineno|psect|dot|opcode|opfmt|o[12](mod|reg|ebeg|eend)|ebeg|eend|tl|delist|outw|outb|cl|mexec|flag|mcall)$/; printf " %-6s: %s\n", $key, savestr($$rl{$key}); } return; @@ -3236,6 +3301,8 @@ sub print_help { print " --ocof=fnam create compound output (concrete file name)\n"; print " --lsm create lsmem style memory dump (default file name)\n"; print " --olsm=fnam create lsmem style memory dump (concrete file name)\n"; + print " --list=opt enable .list option\n"; + print " --nlist=opt disable .list option\n"; print " --tpass1 trace line context in pass 1\n"; print " --tpass2 trace line context in pass 2\n"; print " --dsym1 dump psect and ust tables after pass 1\n"; diff --git a/tools/man/man1/asm-11.1 b/tools/man/man1/asm-11.1 index 75914a98..e9d3bd0b 100644 --- a/tools/man/man1/asm-11.1 +++ b/tools/man/man1/asm-11.1 @@ -1,11 +1,11 @@ .\" -*- nroff -*- -.\" $Id: asm-11.1 1356 2023-01-26 15:10:23Z mueller $ +.\" $Id: asm-11.1 1359 2023-01-27 20:58:50Z mueller $ .\" SPDX-License-Identifier: GPL-3.0-or-later -.\" Copyright 2013-2022 by Walter F.J. Mueller +.\" Copyright 2013-2023 by Walter F.J. Mueller .\" .\" ------------------------------------------------------------------ . -.TH ASM-11 1 2023-01-25 "Retro Project" "Retro Project Manual" +.TH ASM-11 1 2023-01-27 "Retro Project" "Retro Project Manual" .\" ------------------------------------------------------------------ .SH NAME asm-11 \- simple assembler for MACRO-11 style PDP-11 code @@ -71,8 +71,8 @@ Activated with the \fB\-\-lst\fP or \fB\-\-olst\fP options. .iff assembles block if condition tests false .ift assembles block if condition tests true .iftf assembles block regardless of condition - .list parsed but otherwise ignored; me always enabled - .nlist parsed but otherwise ignored + .list minimal support for cnd,me,meb + .nlist minimal support for cnd,me,meb .macro starts macro defintion (subset) .mcall load macro definitions .mdelete delete macro definitions @@ -113,6 +113,10 @@ a \.if df/ndf sees opcodes as defined (MACRO-11 doesn't) a \.if df/ndf sees register names as undefined (MACRO-11 doesn't) .IP "-" error codes on invail statements differ, especially A and Q +.IP "-" +the \.(n)list acts only on cnd, me and meb, ignores other values +.IP "-" +the \.(n)list default is cnd=0,me=0,meb=1 (MACRO-11 cnd=1,meb=0) .PD .RE .PP @@ -207,6 +211,19 @@ file \fIfnam\fR. If \fIfnam\fP is '-' the compound output is written to \fIstdout\fP. . .\" ---------------------------------------------- +.IP "\fB\-list\fI opt\fR" +is equivalent to a '.list \fIopt\fP' directive at the beginning of the code. +Supported values for \fIopt\fP are 'cnd', 'me' and 'meb'. Startup +default is 'cnd' and 'me' disabled and 'meb' enabled. +\fB\-list\fP can be given multiple times. +. +.\" ---------------------------------------------- +.IP "\fB\-nlist\fI opt\fR" +is equivalent to a '.nlist \fIopt\fP' directive at the beginning of the code. +\fB\-nlist\fP can be given multiple times. +\fB\-nlist\fP options are processed after \fB\-list\fP options. +. +.\" ---------------------------------------------- .IP "\fB\-help\fR" print full help text and exit. . diff --git a/tools/tcode/cpu_details.mac b/tools/tcode/cpu_details.mac index d9d47a0d..53a1e37e 100644 --- a/tools/tcode/cpu_details.mac +++ b/tools/tcode/cpu_details.mac @@ -1,10 +1,10 @@ -; $Id: cpu_details.mac 1358 2023-01-27 10:37:36Z mueller $ +; $Id: cpu_details.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022-2023 by Walter F.J. Mueller ; ; Revision History: ; Date Rev Version Comment -; 2023-01-27 1358 1.1 use .mcall and mlib +; 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 ; @@ -19,6 +19,8 @@ .mcall push,pop,push2 .mcall hcmpeq,htsteq,htstne,htstge,hbiteq,hbitne .mcall vecset,vecclr + .mcall rtijmp,rttjmp + .mcall htabuf,htaadd,htaini,htacmp ; ; Preface: set up MMU for kernel mode (for some tests) ======================= ; @@ -880,32 +882,6 @@ ta0305: cmpb systyp,#sy.sih ; skip in SimH (different stklim logic) ; Test A4: PSW + tbit traps +++++++++++++++++++++++++++++++++++++++++++++++++ ; This sub-section verifies operation of PSW register and tbit traps. ; -; helper macro for JMP via RTI with new PS,PC - .macro rtijmp,newps,newpc - push2 newps,newpc - rti - halt - .endm -; -; helper macro for JMP via RTT with new PS,PC - .macro rttjmp,newps,newpc - push2 newps,newpc - rtt - halt - .endm -; -; helper macro for trace area check setup - .macro htinit,buf,nent - hcmpeq #buf+<4*nent>,r5 - mov #buf,r5 - .endm -; -; helper macro for trace area check entry - .macro htitem,tvec,tadr - hcmpeq tvec,(r5)+ - hcmpeq tadr,(r5)+ - .endm -; ; Test A4.1 -- PSW direct write/read test ++++++++++++++++++++++++++++ ; ta0401: @@ -1191,13 +1167,11 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 100$: trap 100 110$: ; -200$: .word 0,0 - .word 0,0 - .word -1,-1 +200$: htabuf 2. ; -300$: htinit 200$,2. ; expect 2 items - htitem #014,#100$ ; bpt before trap (none after !) - htitem #036,#110$ ; final trap +300$: htaini 200$,2. ; expect 2 items + htacmp #v..bpt,#100$ ; bpt before trap (none after !) + htacmp #v..trp,#110$ ; final trap ; ; part 1: simple instruction sequence ------------------------------- ; Checks that trace traps are taken instructions which allow prefetch @@ -1221,29 +1195,19 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 1180$: trap 100 ; 9th inst 1190$: ; -1200$: .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +1200$: htabuf 10. ; -1300$: htinit 1200$,10. ; expect 10 items - htitem #014,#1100$ ; bpt before inc - htitem #014,#1110$ ; bpt after inc - htitem #014,#1120$ ; bpt after dec - htitem #014,#1130$ ; bpt after cmp - htitem #014,#1160$ ; bpt after bne (PC is bne target) - htitem #014,#1140$ ; bpt after jsr (PC is jsr target) - htitem #014,#1170$ ; bpt after rts (PC is rts target) - htitem #014,#1150$ ; bpt after br (PC is br target) - htitem #014,#1180$ ; bpt after jmp (PC is jmp target) - htitem #036,#1190$ ; final trap +1300$: htaini 1200$,10. ; expect 10 items + htacmp #v..bpt,#1100$ ; bpt before inc + htacmp #v..bpt,#1110$ ; bpt after inc + htacmp #v..bpt,#1120$ ; bpt after dec + htacmp #v..bpt,#1130$ ; bpt after cmp + htacmp #v..bpt,#1160$ ; bpt after bne (PC is bne target) + htacmp #v..bpt,#1140$ ; bpt after jsr (PC is jsr target) + htacmp #v..bpt,#1170$ ; bpt after rts (PC is rts target) + htacmp #v..bpt,#1150$ ; bpt after br (PC is br target) + htacmp #v..bpt,#1180$ ; bpt after jmp (PC is jmp target) + htacmp #v..trp,#1190$ ; final trap ; ; part 2: tracing of trap instructions (EMT tested) ----------------- ; @@ -1257,19 +1221,14 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 2130$: trap 100 2140$: ; -2200$: .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +2200$: htabuf 5. ; -2300$: htinit 2200$,5. ; expect 5 items - htitem #014,#2110$ ; bpt after dec - htitem #032,#2120$ ; emt (with return address) - htitem #014,#2120$ ; bpt after emt (taken after emt) - htitem #014,#2130$ ; bpt after nop - htitem #036,#2140$ ; final trap +2300$: htaini 2200$,5. ; expect 5 items + htacmp #v..bpt,#2110$ ; bpt after dec + htacmp #v..emt,#2120$ ; emt (with return address) + htacmp #v..bpt,#2120$ ; bpt after emt (taken after emt) + htacmp #v..bpt,#2130$ ; bpt after nop + htacmp #v..trp,#2140$ ; final trap ; ; part 3: tbit vs interrupt precedence (via PIRQ) ------------------- ; Checks that interrupt has precedence over tbit traps. @@ -1295,23 +1254,20 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 3110$: trap 100 3120$: ; -3200$: .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +3200$: htabuf 3. ; -3300$: htinit 3200$,3. ; expect 3 items +3300$: htaini 3200$,3. ; expect 3 items cmpb systyp,#sy.sih ; different checks for SimH service order beq 3310$ ; checks for w11 - htitem #240,#3110$ ; pirq (with return address) - htitem #014,#3110$ ; bpt after movb - htitem #036,#3120$ ; final trap + htacmp #v..pir,#3110$ ; pirq (with return address) + htacmp #v..bpt,#3110$ ; bpt after movb + htacmp #v..trp,#3120$ ; final trap br 4000$ ; checks for SimH -3310$: htitem #014,#3110$ ; bpt after movb first - htitem #240,#vhtbpe ; pirq from bpt handler - htitem #036,#3120$ ; final trap +3310$: htacmp #v..bpt,#3110$ ; bpt after movb first + htacmp #v..pir,#vhtbpe ; pirq from bpt handler + htacmp #v..trp,#3120$ ; final trap ; ; part 4: traced WAIT and tbit -------------------------------------- ; Checks that traced WAIT does not produce tbit trap. @@ -1334,17 +1290,13 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 4120$: trap 100 4130$: ; -4200$: .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +4200$: htabuf 4. ; -4300$: htinit 4200$,4. ; expect 4 items - htitem #014,#4110$ ; bpt after movb - htitem #240,#4120$ ; pirq (with return address) - htitem #014,#4120$ ; bpt after wait - htitem #036,#4130$ ; final trap +4300$: htaini 4200$,4. ; expect 4 items + htacmp #v..bpt,#4110$ ; bpt after movb + htacmp #v..pir,#4120$ ; pirq (with return address) + htacmp #v..bpt,#4120$ ; bpt after wait + htacmp #v..trp,#4130$ ; final trap ; ; part 5: WAIT and SPL in user mode --------------------------------- ; Checks that WAIT and SPL in user mode are traced (are nop) @@ -1358,15 +1310,12 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 5120$: trap 100 5130$: ; -5200$: .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +5200$: htabuf 3. ; -5300$: htinit 5200$,3. ; expect 3 items - htitem #014,#5110$ ; bpt after wait - htitem #014,#5120$ ; bpt after spl - htitem #036,#5130$ ; final trap +5300$: htaini 5200$,3. ; expect 3 items + htacmp #v..bpt,#5110$ ; bpt after wait + htacmp #v..bpt,#5120$ ; bpt after spl + htacmp #v..trp,#5130$ ; final trap ; ; part 6: tbit trap after continuation over s_idle ------------------ ; Checks instructions that complete via s_idle are properly traced @@ -1390,19 +1339,14 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 6130$: trap 100 6140$: ; -6200$: .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +6200$: htabuf 5. ; -6300$: htinit 6200$,5. ; expect 5 items - htitem #014,#6110$ ; bpt after reset - htitem #014,#6120$ ; bpt after mov - htitem #014,#0 ; bpt after clr - htitem #014,#6130$ ; bpt after jmp - htitem #036,#6140$ ; final trap +6300$: htaini 6200$,5. ; expect 5 items + htacmp #v..bpt,#6110$ ; bpt after reset + htacmp #v..bpt,#6120$ ; bpt after mov + htacmp #v..bpt,#0 ; bpt after clr + htacmp #v..bpt,#6130$ ; bpt after jmp + htacmp #v..trp,#6140$ ; final trap ; clr @#0 clr @#2 @@ -1419,13 +1363,12 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 7110$: clr @#160000 ; will fail halt ; -7200$: .word 0,0 - .word -1,-1 +7200$: htabuf 1. ; 7300$: mov #stack,sp ; discard frame hcmpeq #cp.ito,cp.err ; check CPUERR - htinit 7200$,1. ; expect 1 item - htitem #014,#7110$ ; bpt after 1st clr + htaini 7200$,1. ; expect 1 item + htacmp #v..bpt,#7110$ ; bpt after 1st clr ; vecclr v..iit ; restore ; @@ -1443,11 +1386,10 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 8100$: nop ; will tbit trap 8110$: rti ; will not tbit trap (new PS tbit=0) ; -8200$: .word 0,0 - .word -1,-1 +8200$: htabuf 1. ; -8300$: htinit 8200$,1. ; expect 1 item - htitem #014,#8110$ ; bpt after nop +8300$: htaini 8200$,1. ; expect 1 item + htacmp #v..bpt,#8110$ ; bpt after nop ; ; part 9: EMT that sets tbit ---------------------------------------- ; Checks that a vector flow loading a PS with tbit=1 does trap. @@ -1466,13 +1408,11 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 9100$: nop ; will tbit trap 9110$: rti ; will not tbit trap (new PS tbit=0) ; -9200$: .word 0,0 - .word 0,0 - .word -1,-1 +9200$: htabuf 2. ; -9300$: htinit 9200$,2. ; expect 2 items - htitem #014,#9100$ ; bpt at entry of EMT handler - htitem #014,#9110$ ; bpt after nop +9300$: htaini 9200$,2. ; expect 2 items + htacmp #v..bpt,#9100$ ; bpt at entry of EMT handler + htacmp #v..bpt,#9110$ ; bpt after nop ; ; part 10: PIRQ that sets tbit --------------------------------------- ; Checks that a vector flow loading a PS with tbit=1 does trap. @@ -1491,13 +1431,11 @@ ta0404: vecset v..bpt,vhtbpt,cp.pr7 ; BPT handler, PR7 (lockout PIRQ) 10100$: clr cp.pir ; will tbit trap 10110$: rti ; will not tbit trap (new PS tbit=0) ; -10200$: .word 0,0 - .word 0,0 - .word -1,-1 +10200$: htabuf 2. ; -10300$: htinit 10200$,2. ; expect 2 items - htitem #014,#10100$ ; bpt at entry of PIRQ handler - htitem #014,#10110$ ; bpt after movb +10300$: htaini 10200$,2. ; expect 2 items + htacmp #v..bpt,#10100$ ; bpt at entry of PIRQ handler + htacmp #v..bpt,#10110$ ; bpt after movb ; ; restore ------------------------------------------------------------ ; @@ -2148,8 +2086,7 @@ vhuhlt: halt ; If vhtbp0 is non-zero, the handler lowers priority to PRI=0 before RTT. ; vhtbpt: htstge (r5) ; r5 at fence ? - mov #014,(r5)+ ; track BPT vector - mov (sp),(r5)+ ; track PC + htaadd #v..bpt ; track BPT vector, track return PC tst vhtbp0 ; should PRI be lowered ? beq vhtbpe clr vhtbp0 ; and clear flag @@ -2162,8 +2099,7 @@ vhtbp0: .word 0 ; Signature is vector address + return PC (PC to test proper context). ; vhtemt: htstge (r5) ; r5 at fence ? - mov #032,(r5)+ ; track EMT vector - mov (sp),(r5)+ ; track PC + htaadd #v..emt ; track EMT vector, track return PC rti ; ; vhtpir - handler for PIRQ interrupt tracing ++++++++++++++++++++++++++++++++ @@ -2173,8 +2109,7 @@ vhtemt: htstge (r5) ; r5 at fence ? ; vhtpir: htstge (r5) ; r5 at fence ? clr cp.pir ; clear all PIRQ interrupts - mov #240,(r5)+ ; track PIRQ vector - mov (sp),(r5)+ ; track PC + htaadd #v..pir ; track PIRQ vector, track return PC rti ; ; vhttrp - handler for TRAP, ends tracing ++++++++++++++++++++++++++++++++++++ @@ -2183,8 +2118,7 @@ vhtpir: htstge (r5) ; r5 at fence ? ; vhtend must be set for each execution ; vhttrp: htstge (r5) ; r5 at fence ? - mov #036,(r5)+ ; track TRAP vector - mov (sp),(r5)+ ; track PC + htaadd #v..trp ; track TRAP vector, track return PC mov vhtend,100$ ; remember vhtend mov #200$,vhtend ; restore blocker mov #stack,sp ; restore stack diff --git a/tools/tcode/cpu_mmu.mac b/tools/tcode/cpu_mmu.mac index 33b103ed..f4553c90 100644 --- a/tools/tcode/cpu_mmu.mac +++ b/tools/tcode/cpu_mmu.mac @@ -1,10 +1,10 @@ -; $Id: cpu_mmu.mac 1358 2023-01-27 10:37:36Z mueller $ +; $Id: cpu_mmu.mac 1359 2023-01-27 20:58:50Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022-2023 by Walter F.J. Mueller ; ; Revision History: ; Date Rev Version Comment -; 2023-01-27 1358 1.1 use .mcall and mlib +; 2023-01-27 1358 1.1 use .mcall and mlib; use hta??? macros ; 2023-01-05 1346 1.0 Initial version ; 2022-07-24 1262 0.1 First draft ; @@ -32,6 +32,7 @@ .mcall push,pop .mcall hcmpeq,hcmbeq,htsteq,htstge,hbiteq,hbitne .mcall vecset,vecclr + .mcall htabuf,htaadd,htaini,htacmp ; ; some useful definitions uipdr0 = uipdr+ 0 @@ -89,18 +90,6 @@ p6p1p2 = p6base+<1*100>+2 ; page 6, +1 click, +2 p7base = <7*20000> ; page 7 ; -; helper macro for trace area check setup (from cpu_details A4) - .macro htinit,buf,nent - hcmpeq #buf+<4*nent>,r5 - mov #buf,r5 - .endm -; -; helper macro for trace area check entry (from cpu_details A4) - .macro htitem,tvec,tadr - hcmpeq tvec,(r5)+ - hcmpeq tadr,(r5)+ - .endm -; ; Section A: pdr,par registers =============================================== ; A1.1 test that pdr/par are 16 bit write/readable ; A1.2 set up MMU default configuration @@ -1887,21 +1876,16 @@ td0201: tstb systyp ; skip if not on w11 clr cp.psw ; PSW to default hcmpeq #<127.*md.plf>!md.aia!md.aiw!md.att,sipdr7 ; check sipdr7 ; - htinit 2000$,5. ; expect 5 items - htitem #250,#200$ ; mmu(ico=1) after movb to cp.pir+1 - htitem #250,#p2base+2 ; mmu(ico=1) after 1st instruction fetch - htitem #240,#200$ ; PIRQ, sees PC after movb to cp.pir+1 - htitem #250,#p2base+ ; mmu(trap) after clr of cp.pir - htitem #032,#p2base+ ; EMT after emt 100 + htaini 2000$,5. ; expect 5 items + htacmp #250,#200$ ; mmu(ico=1) after movb to cp.pir+1 + htacmp #250,#p2base+2 ; mmu(ico=1) after 1st instruction fetch + htacmp #240,#200$ ; PIRQ, sees PC after movb to cp.pir+1 + htacmp #250,#p2base+ ; mmu(trap) after clr of cp.pir + htacmp #032,#p2base+ ; EMT after emt 100 ; jmp 9000$ ; -2000$: .word 0,0 ; trace data area - .word 0,0 - .word 0,0 - .word 0,0 - .word 0,0 - .word -1,-1 +2000$: htabuf 5. ; trace area ; ; MMU handler ---------------------------------------------- ; It expects an abort with ico=1, an abort with ico=0 and a trap. @@ -2452,15 +2436,12 @@ te0201: mov #m0.ent!m0.ena,mmr0 ; enable mmu with traps ;! MMU 18 call p5ce21 ; start probe code in page 5 1000$: br 2000$ ; rts will land here ; -1500$: .word 0,0 ; 1st marker (MMU for movb) - .word 0,0 ; 2nd marker (PIRQ) - .word 0,0 ; 3rd marker (MMU for rts) - .word -1,-1 ; fence +1500$: htabuf 3. ; trace area ; -2000$: htinit 1500$,3. ; expect 3 items - htitem #250,#p5ce21+6 ; mmu for movb - htitem #240,#p5ce21+6 ; PIRQ, sees PC after movb - htitem #250,#1000$ ; mmu for rts, PC is return address +2000$: htaini 1500$,3. ; expect 3 items + htacmp #250,#p5ce21+6 ; mmu for movb + htacmp #240,#p5ce21+6 ; PIRQ, sees PC after movb + htacmp #250,#1000$ ; mmu for rts, PC is return address ; reset ; mmu off ;! MMU off ; @@ -2739,8 +2720,7 @@ vhuhlt: halt ; vhtmmu: htstge (r5) ; r5 at fence ? bic #m0.trp,mmr0 ; allow further MMU traps - mov #250,(r5)+ ; track MMU vector - mov (sp),(r5)+ ; track PC + htaadd #v..mmu ; track MMU vector, track return PC rti ; ; vhtpir - handler for PIRQ interrupt tracing ++++++++++++++++++++++++++++++++ @@ -2750,8 +2730,7 @@ vhtmmu: htstge (r5) ; r5 at fence ? ; vhtpir: htstge (r5) ; r5 at fence ? clr cp.pir ; clear all PIRQ interrupts - mov #240,(r5)+ ; track PIRQ vector - mov (sp),(r5)+ ; track PC + htaadd #v..pir ; track PIRQ vector, track return PC rti ; ; Test codes that will be mapped in user or supervisor mode ================== @@ -2831,8 +2810,7 @@ vc2dat: .word 010111 ; . = 105000 ; I space ------------------------------------ vc3: htstge (r5) ; r5 at fence ? - mov #240,(r5)+ ; trace - mov (sp),(r5)+ + htaadd #v..pir ; track PIRQ vector, track return PC clr @#cp.pir ; cancel PIRQ (use absolute mode!) vc3l1: emt 100 ; delegate RTI to system service vc3l2: halt ; label after emt