1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-12 00:43:01 +00:00

major asm-11 update

- tools/bin
  - asm-11
    - add .if, .if(f|t|tf), .endc, .rept, .endr, .mexit directives
    - add .error, .print, .mcall, .mdelete directives
    - add .narg, .nchr, .ntype directives
    - rewrite macro definition and call argument parsing & handling
    - add -L option (to set .mcall pathlist)
    - add auto-generated ...top label
    - add flag (MRmrd) column in output format
  - asm-11_expect
    - add simple substitution mechanism (for macro testing)
    - handle new flag column in output format
- tools/asm-11
  - tests(-err): many tests added
  - tests(-err)/Makefile: distclean target added
  - mlib: macro library, accessed by .mcall
This commit is contained in:
wfjm 2023-01-26 16:13:36 +01:00
parent 4b0a1feb2a
commit 3b033ebfa8
75 changed files with 2320 additions and 299 deletions

View File

@ -30,6 +30,23 @@ The full set of tests is only run for tagged releases.
### Summary
### New features
### Changes
- tools changes
- tools/bin
- asm-11
- add .if, .if(f|t|tf), .endc, .rept, .endr, .mexit directives
- add .error, .print, .mcall, .mdelete directives
- add .narg, .nchr, .ntype directives
- rewrite macro definition and call argument parsing & handling
- add -L option (to set .mcall pathlist)
- add auto-generated ...top label
- add flag (MRmrd) column in output format
- asm-11_expect
- add simple substitution mechanism (for macro testing)
- handle new flag column in output format
- tools/asm-11
- tests(-err): many tests added
- tests(-err)/Makefile: distclean target added
- mlib: macro library, accessed by .mcall
### Bug Fixes
- tools/bin/asm-11:
- BUGFIX: support @(R) modifier with omitted offset

View File

@ -3,6 +3,7 @@ and is organized in
| Directory | Content |
| --------- | ------- |
| [lib](lib) | macro and routine library |
| [lib](lib) | routine library |
| [mlib](mlib) | macro library |
| [tests](tests) | asm-11 test suite |
| [tests-err](tests-err) | asm-11 test suite (error resonse part) |

View File

@ -0,0 +1,10 @@
; $Id: hbiteq.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; bit on eq
.macro hbiteq,src,dst
bit src,dst
beq .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: hbitne.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; bit on ne
.macro hbitne,src,dst
bit src,dst
bne .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: hcmbeq.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; cmpb on eq
.macro hcmbeq,src,dst
cmpb src,dst
beq .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: hcmpeq.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; cmp on eq
.macro hcmpeq,src,dst
cmp src,dst
beq .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: htsbeq.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; tstb on eq
.macro htsbeq,src
tstb src
beq .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: htsbne.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; tstb on ne
.macro htsbne,src
tstb src
bne .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: htsteq.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; tst on eq
.macro htsteq,src
tst src
beq .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: htstge.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; tst on ge
.macro htstge,src
tst src
bge .+4
halt
.endm

View File

@ -0,0 +1,10 @@
; $Id: htstne.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; tst on ne
.macro htstne,src
tst src
bne .+4
halt
.endm

View File

@ -0,0 +1,7 @@
; $Id: pop.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
.macro pop,dst
mov (sp)+,dst
.endm

View File

@ -0,0 +1,7 @@
; $Id: popb.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
.macro popb,dst
movb (sp)+,dst
.endm

View File

@ -0,0 +1,7 @@
; $Id: push.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
.macro push,src
mov src,-(sp)
.endm

View File

@ -0,0 +1,8 @@
; $Id: push2.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
.macro push2,src1,src2
mov src1,-(sp)
mov src2,-(sp)
.endm

View File

@ -0,0 +1,7 @@
; $Id: pushb.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
.macro pushb,src
movb src,-(sp)
.endm

View File

@ -1,9 +1,10 @@
# $Id: Makefile 1176 2019-06-30 07:16:06Z mueller $
# $Id: Makefile 1356 2023-01-26 15:10:23Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2013-2018 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-26 1356 1.1.1 add distclean
# 2018-11-03 1065 1.1 sort file list
# 2013-03-22 496 1.0 Initial version
#---
@ -15,7 +16,7 @@ LSTRT_all = $(MAC_all:.mac=.lstrt)
#
include ${RETROBASE}/tools/make/generic_asm11.mk
#
.PHONY : def alllst allrt allexp clean cleanrt
.PHONY : def alllst allrt allexp clean cleanrt distclean
#
def : alllst
#
@ -33,3 +34,5 @@ clean :
cleanrt :
@ rm -f $(LDART_all) $(LSTRT_all)
@ echo "RT-11 generated files removed"
distclean : clean cleanrt

View File

@ -0,0 +1,40 @@
; $Id: testerr_0030_wexp.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test bad .word,.byte and .blkw,.blkb
;
.asect
. = 1000
; .word and .byte require one argument in asm-11
.word ;;!! Q ; ok in MACRO-11
.byte ;;!! Q ; ok in MACRO-11
.even
;
; word expression invalid in asm-11 (no register expressions)
.word r1 ;;!! U ; ok in MACRO-11
.word pc ;;!! U ; ok in MACRO-11
;
; invalid word expressions
.word @r2 ;;!! Q ; A in MACRO-11
.word (r3) ;;!! Q ; A in MACRO-11
.word (r4)+ ;;!! Q ; A in MACRO-11
.word @(r5)+ ;;!! Q ; A in MACRO-11
.word -(r1) ;;!! Q ; A in MACRO-11
.word @-(r2) ;;!! Q ; A in MACRO-11
.word 1234(r3) ;;!! Q ; A in MACRO-11
.word @1234(r4) ;;!! Q ; A in MACRO-11
.word @pa ;;!! Q ; A in MACRO-11
.word @#a ;;!! Q ; A in MACRO-11
;
; .blkw and .blkb tests
.blkw ; ok, default 1 assumed
.blkb ; ok, default 1 assumed
.even
;
.blkw @r2 ;;!! Q ; MACRO-11 allocates space, asm-11 not
.blkb 1234(r3) ;;!! Q ; MACRO-11 allocates space, asm-11 not
;
.end

View File

@ -0,0 +1,35 @@
; $Id: testerr_0040_inst.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test bad instruction cases
;
.asect
. = 1000
; bad opcodes
xxx ;;!! U ; implicit .word with unknown symbol
xxx r0 ;;!! Q ; AU in MACRO-11
xxx r0,r2 ;;!! Q ; AU in MACRO-11
;
; missing operands
clr ;;!! Q ; A in MACRO-11
mov r0 ;;!! Q ; A in MACRO-11
mov r0, ;;!! Q ; A in MACRO-11
emt ;;!! Q ; ok in MACRO-11 (0 default)
jsr ;;!! Q ; A in MACRO-11
jsr pc ;;!! Q ; A in MACRO-11
jsr pc, ;;!! Q ; A in MACRO-11
rts ;;!! Q ; A in MACRO-11
br ;;!! Q ; A in MACRO-11
sob ;;!! Q ; A in MACRO-11
sob r0 ;;!! Q ; A in MACRO-11
sob r0, ;;!! Q ; A in MACRO-11
;
; extra operands
clr r0,r1 ;;!! Q
clr r0 r1 ;;!! Q
mov r0,r1,r2 ;;!! Q
mov r0,r1 r2 ;;!! Q
;
.end

View File

@ -1,11 +1,11 @@
; $Id: testerr_0100_Berror.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0100_Berror.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 B error code (bounding error)
;
.asect
.blkw 400
. = 1000
; word align code

View File

@ -1,11 +1,11 @@
; $Id: testerr_0110_Nerror.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0110_Nerror.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 N error code (Number error)
;
.asect
.blkw 400
. = 1000
; octal, implicit

View File

@ -1,12 +1,12 @@
; $Id: testerr_0120_Terror_const.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0120_Terror_const.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 T error code (Truncation)
; truncation of too large constants
;
.asect
.blkw 400
. = 1000
; octal, implicit

View File

@ -1,12 +1,12 @@
; $Id: testerr_0130_Terror_inst.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0130_Terror_inst.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 T error code (Truncation)
; truncation in instruction fields
;
.asect
.blkw 400
. = 1000
spl 7
spl 17 ;;!! T

View File

@ -1,4 +1,4 @@
; $Id: testerr_0140_Terror_expr.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0140_Terror_expr.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
@ -6,7 +6,7 @@
; truncation in expressions
;
.asect
.blkw 400
. = 1000
; not yet implemented...

View File

@ -1,12 +1,12 @@
; $Id: testerr_0150_Terror_fpp.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0150_Terror_fpp.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 T error code (trunction)
; fpp cases: fpp ac reg>3
;
.asect
.blkw 400
. = 1000
a: .word 0,0
.word 0,0

View File

@ -1,12 +1,12 @@
; $Id: testerr_0200_Aerror_branch.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: testerr_0200_Aerror_branch.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 A error code (Assembly error)
; case: range of branch or sob exceeded
;
.asect
.blkw 400
. = 1000
; range of branch (-128...+127)

View File

@ -0,0 +1,37 @@
; $Id: testerr_0220_Aerror_if.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test A error code (Assembly error)
; case: test bad .if
;
.asect
. = 1000
; invalid .if statements
.if ;;!! A
.endc
.if bad ;;!! A
.endc
.if eq ;;!! A
.endc
.if ne, ;;!! A
.endc
.if ge,bad ;;!! U
.endc
.if gt,#100 ;;!! Q ; AQ in MACRO-11
.endc ;;!! O ; valid in MACRO-11
.if df ;;!! A
.endc
.if df, ;;!! A
.endc
.if idn ;;!! A
.endc
.if idn, ;;!! A
.endc
.if idn,a ;;!! A
.endc
.if idn,a, ;;!! A ; valid in MACRO-11
.endc
.end

View File

@ -0,0 +1,27 @@
; $Id: testerr_0300_Oerror.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test O error code (opcode error)
;
.asect
. = 1000
;
; misplaced .end*
.endr ;;!! O
.endm ;;!! O
.endc ;;!! O
;
; misplaced .mexit
.mexit ;;!! O
;
; misplaced .narg,.ntype
.narg $$$ ;;!! O ; OQ in MACRO-11
.ntype $$$,arg ;;!! OQ
;
; misplaced .if(t|f|tf)
.ift ;;!! O
.iff ;;!! O
.iftf ;;!! O
;
.end

View File

@ -0,0 +1,29 @@
; $Id: testerr_0310_Oerror_mdel.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test O error code (opcode error)
; case: mdelete (skipped in RT11 MACRO-11 because .mdelete not available)
;
.asect
. = 1000
;
.if df,...top ; asm-11 only
;
; .mdelete: single non-existing macro
.mdelete mbad ;;!! O
;
; .mdelete: delete list with one non-existing macro
.macro mok1
.endm
.macro mok2
.endm
.macro mok3
.endm
.mdelete mok1 ; is OK
.mdelete mok2,bad,mok3 ;;!! O
.mdelete mok2 ;;!! O
.mdelete mok3 ;;!! O
;
.endc
.end

View File

@ -0,0 +1,22 @@
; $Id: testerr_0400_Perror_error.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test P error code (phase error)
; case: .error, test also .print
;
.asect
. = 1000
;
.error ;;!! P
.error 123 ;;!! P 000123
.error bad ;;!! PU
.error 234,bad ;;!! PQ 000234
;
.print ;;!!
.print 456 ;;!! 000456
.print bad ;;!! U
;
1000$: ;;!! 001000:
;
.end

View File

@ -0,0 +1,14 @@
; $Id: testerr_0500_end_extra.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: code after .end
;
.asect
. = 1000
;
.end
never
seen
code

View File

@ -0,0 +1,22 @@
; $Id: testerr_0501_end_macro.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: .end in macro expansion rejected with O error
;
.asect
. = 1000
;
.list me
;
.macro mend
.end ;;!! O
.word 1001 ;;!! 001001
.endm
;
mend
.word 1002 ;;!! 001002
1000$: ;;!! 001004:
;
.end

View File

@ -0,0 +1,21 @@
; $Id: testerr_0502_end_rept.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: .end in .rept expansion rejected with O error
;
.asect
. = 1000
;
.list me
;
.rept 2
.end ;;!! O
.word 1001 ;;!! 001001
.endr
;
.word 1002 ;;!! 001002
1000$: ;;!! 001006:
;
.end

View File

@ -0,0 +1,19 @@
; $Id: testerr_0503_end_if.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: .end in .if expansion rejected with O error
;
.asect
. = 1000
;
.if eq,0
.end ;;!! O
.word 1001 ;;!! 001001
.endc
;
.word 1002 ;;!! 001002
1000$: ;;!! 001004:
;
.end

View File

@ -0,0 +1,20 @@
; $Id: testerr_0511_end_macro_open.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: missing .endm causes to E error
;
.asect
. = 1000
;
.list me
;
.macro mopen
.word 1001 ;;!! 001001
; missing .endm
;
mopen
;
.end
;;!! E

View File

@ -0,0 +1,18 @@
; $Id: testerr_0512_end_rept_open.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: missing .endr causes to E error
;
.asect
. = 1000
;
.list me
;
.rept 2
.word 1001 ;;!! 001001
; missing .endr
;
.end
;;!! E

View File

@ -0,0 +1,16 @@
; $Id: testerr_0513_end_if_open.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .end
; case: missing .endc causes to E error
;
.asect
. = 1000
;
.if eq,0
.word 1001
; missing .endc
;
.end ;;!! O
;;!! E

View File

@ -0,0 +1,69 @@
; $Id: testerr_0600_macro.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test error response for .macro and macro calls
;
.asect
. = 1000
;
.list me
;
; .macro without macro name -> O error and no macro defined
.macro ;;!! O
.endm ;;!! O
;
; .macro with non-matching name in .endm
.macro badend
.word 0
.endm endbad ;;!! A
;
; .macro with redundant key names
.macro argnam a,b,a ;;!! A
.word a
.word b
.endm
;
; .macro with bad key name
.macro badarg 100
.endm
;
; .macro with bad auto-label name
.macro badlbl ?100
.endm
;
; .macro with \ modfier in key definition
.macro badmod \a
.endm
;
; extra or bad arguments in macro call
.macro extarg a
.word a
.endm
;
a = 123
;
extarg 100 ; ok
extarg 100,200 ;;!! Q
extarg a=100 ; ok
extarg a= ; ok
extarg c=100 ;;!! AU
extarg \a ; ok
extarg \b ;;!! U
extarg \100 ;;!! Q ; ok in MACRO-11
extarg ?a ;;!! Q ; ok in MACRO-11
;
; .narg,.ntype,.nchr without symbol and/or value
.macro badnxx a,b
.word a
.ascii /b/
.narg ;;!! A
.nchr ;;!! A
.nchr $$$ ;;!! A ; ok in MACRO-11
.ntype ;;!! A
.ntype $$$ ;;!! A
.endm
;
badnxx 100,^/foo/
;
.end

View File

@ -1,9 +1,10 @@
# $Id: Makefile 1176 2019-06-30 07:16:06Z mueller $
# $Id: Makefile 1356 2023-01-26 15:10:23Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2013-2018 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-26 1356 1.1.1 add distclean
# 2018-11-03 1065 1.1 sort file list
# 2013-03-22 496 1.0 Initial version
#---
@ -17,7 +18,7 @@ LSTRT_all = $(MAC_all:.mac=.lstrt)
#
include ${RETROBASE}/tools/make/generic_asm11.mk
#
.PHONY : def alllda allcof alllst allrt allexp clean cleanrt
.PHONY : def alllda allcof alllst allrt allexp clean cleanrt distclean
#
def : alllda
#
@ -43,3 +44,5 @@ clean :
cleanrt :
@ rm -f $(LDART_all) $(LSTRT_all)
@ echo "RT-11 generated files removed"
distclean : clean cleanrt

View File

@ -1,11 +1,11 @@
; $Id: test_0030_alloc.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0030_alloc.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 .word/.byte with expressions ect
;
.asect
.blkw 400
. = 1000
w0: .word 101 ;;!! 001000: 000101
w1: .word 102 ;;!! 001002: 000102

View File

@ -1,6 +1,6 @@
; $Id: test_0040_asci.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0040_asci.mac 1353 2023-01-23 18:13:53Z 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 .ascii/.asciz
;
@ -8,7 +8,7 @@
LF = 012
;
.asect
.blkw 400
. = 1000
.ascii /foobar/ ;;!! 001000:
.asciz /fooba/ ;;!! 001006:

View File

@ -1,13 +1,13 @@
; $Id: test_0050_iword.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0050_iword.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 implicit .word
; when a statement does not start with pst symbol (opcode or directive)
; assume an implicit .word
;
.asect
.blkw 400
. = 1000
100 ;;!! 000100
200 ;;!! 000200

View File

@ -1,11 +1,11 @@
; $Id: test_0100_op_g.mac 1351 2023-01-13 08:38:27Z mueller $
; $Id: test_0100_op_g.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test opcodes with one general operand
;
.asect
.blkw 400
. = 1000
;
a: .word 0 ;;!! 001000: 000000
pa: .word a ;;!! 001002: 001000

View File

@ -1,11 +1,11 @@
; $Id: test_0110_op_gg.mac 1351 2023-01-13 08:38:27Z mueller $
; $Id: test_0110_op_gg.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; test opcodes with two general operands
;
.asect
.blkw 400
. = 1000
a: .word 0 ;;!! 001000: 000000
b: .word 0 ;;!! 001002: 000000

View File

@ -1,11 +1,11 @@
; $Id: test_0120_op_rg.mac 1351 2023-01-13 08:38:27Z mueller $
; $Id: test_0120_op_rg.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2014-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test opcodes with 1 1/2 operands
;
.asect
.blkw 400
. = 1000
a: .word 0
pa: .word a

View File

@ -1,11 +1,11 @@
; $Id: test_0130_op_n.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0130_op_n.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 no or numeric operands
;
.asect
.blkw 400
. = 1000
; no operands
p1:

View File

@ -1,11 +1,11 @@
; $Id: test_0140_op_o.mac 1262 2022-07-25 09:44:55Z mueller $
; $Id: test_0140_op_o.mac 1353 2023-01-23 18:13:53Z 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 offset operands
;
.asect
.blkw 400
. = 1000
; branch

View File

@ -1,11 +1,11 @@
; $Id: test_0170_misc.mac 1262 2022-07-25 09:44:55Z mueller $
; $Id: test_0170_misc.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2022- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; Copyright 2022-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test special pst entries call and return
;
.asect
.blkw 400
. = 1000
; call/return

View File

@ -1,11 +1,11 @@
; $Id: test_0180_pst.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0180_pst.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 interaction pst <-> lst
;
.asect
.blkw 400
. = 1000
; defined constants based on opcodes

View File

@ -1,6 +1,6 @@
; $Id: test_0190_dot.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0190_dot.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2015- 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>
;
; test dot '.' handling
; '.' refers in MACRO-11 (RT11 V4.0) to
@ -8,7 +8,7 @@
; - current address in case of .word lists
;
.asect
.blkw 400
. = 1000
; use . in branches

View File

@ -1,11 +1,11 @@
; $Id: test_0200_fpp_1op.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0200_fpp_1op.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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 fpp opcodes with 0 or 1 operands
;
.asect
.blkw 400
. = 1000
a: .word 0,0
.word 0,0

View File

@ -1,11 +1,11 @@
; $Id: test_0210_fpp_2op.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: test_0210_fpp_2op.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; Copyright 2019-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test fpp opcodes with 2 operands
;
.asect
.blkw 400
. = 1000
a: .word 0,0
.word 0,0

View File

@ -1,76 +1,87 @@
; $Id: test_0300_macro.mac 1262 2022-07-25 09:44:55Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; Copyright 2019-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro basics
;
.asect
.blkw 400
. = 1000
; list macro expansion
.list me
; define and use simple macros
; define simple macros
.macro push,src
mov src,-(sp) ;;!! $l1
.endm
.macro word,val
.word val ;;!! $l1
.endm
;
; use a simple macro with all addressing modes
;
v1: .word 0
.word 0
v2: .word v1
.word v1+2
off = 2
;
push r5 ;;!= l1 = 010546
push (r4) ;;!= l1 = 011446
push (r3)+ ;;!= l1 = 012346
push @(r2)+ ;;!= l1 = 013246
push -(r1) ;;!= l1 = 014146
push @-(r0) ;;!= l1 = 015046
push 10(r0) ;;!= l1 = 016046 000010
push 10+2(r1) ;;!= l1 = 016146 000012
push 10+<1+2*2>(r2) ;;!= l1 = 016246 000016
push @20(r3) ;;!= l1 = 017346 000020
push @20+^b100(r4) ;;!= l1 = 017446 000024
push v1 ;;!= l1 = 016746 177724
push @v2 ;;!= l1 = 017746 177724
;
; simple word generation
;
a = 1
b = 2
word 100 ;;!= l1 = 000100
word a+b+1 ;;!= l1 = 000004
word <^b1010+b-2*a> ;;!= l1 = 000012
;
; define and a macro with 3 arguments (use . and $ in key names)
;
.macro test x .x $x
.word x ;;!! 001001
.word .x ;;!! 001002
.word $x ;;!! 001003
.endm
test 1001 1002 1003
;
; some simple macro usage
;
.macro scall,dst
jsr pc,dst
jsr pc,dst ;;!! $l1
.endm
.macro sret
rts pc
rts pc ;;!! $l1
.endm
.macro push,src
mov src,-(sp)
mov src,-(sp) ;;!! $l1
.endm
.macro pop,dst
mov (sp)+,dst
mov (sp)+,dst ;;!! $l1
.endm
t01: scall t01sub
halt
1$: ;;!! 001006:
t01sub: push r0
push r1
pop r1
pop r0
sret
1$: ;;!! 001020:
; macro with defaults and auto-label
.macro scopy,src,dst=#t02tmp,?lbl
mov src,r0
mov dst,r1
lbl: movb (r0)+,(r1)+ ;;!! 112021
bne lbl ;;!! 001376
.endm scopy
. = 02000
t02: scopy #t02a1+<2*2>,#t02buf
1$: ;;!! 002014:
scopy #t02a2
2$: ;;!! 002030:
mov #t02a1,r5
scopy r5
3$: ;;!! 002046:
;
t02a1: .asciz /1234567890/
t02a2: .asciz /abcdefghij/
t02buf: .blkb 32.
t02tmp: .blkb 32.
. = 2000
t01: scall t01sub ;;!= l1 = 002000: 004767 000002
halt
1$: ;;!! 002006:
; nested macro calls
t01sub: push r0 ;;!= l1 = 002006: 010046
push r1 ;;!= l1 = 002010: 010146
pop r1 ;;!= l1 = 002012: 012601
pop r0 ;;!= l1 = 002014: 012600
sret ;;!= l1 = 002016: 000207
1$: ;;!! 002020:
.macro bcopy,src,dst
push r0
push r1
scopy #src,#dst
pop r1
pop r0
.endm
. = 3000
t03: bcopy t02a1,t02tmp
1$: ;;!! 003024:
.end

View File

@ -0,0 +1,59 @@
; $Id: test_0310_macro_ntype.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2019-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro basics and .ntype
;
.asect
. = 1000
; list macro expansion
.list me
; define simple macro with .ntype
.macro pop,dst
mov (sp)+,dst ;;!! $l1
.ntype $$,dst ;;!! $l2
.word $$ ;;!! $l2
.endm
;
; use a simple macro with all addressing modes and test .ntype
;
v1: .word 0
.word 0
v2: .word v1
.word v1+2
off = 2
;
;;!= l2 = 000005
pop r5 ;;!= l1 = 012605
;;!= l2 = 000014
pop (r4) ;;!= l1 = 012614
;;!= l2 = 000023
pop (r3)+ ;;!= l1 = 012623
;;!= l2 = 000032
pop @(r2)+ ;;!= l1 = 012632
;;!= l2 = 000041
pop -(r1) ;;!= l1 = 012641
;;!= l2 = 000050
pop @-(r0) ;;!= l1 = 012650
;;!= l2 = 000060
pop 10(r0) ;;!= l1 = 012660 000010
;;!= l2 = 000061
pop 10+2(r1) ;;!= l1 = 012661 000012
;;!= l2 = 000062
pop 10+<1+2*2>(r2) ;;!= l1 = 012662 000016
;;!= l2 = 000073
pop @20(r3) ;;!= l1 = 012673 000020
;;!= l2 = 000074
pop @20+^b100(r4) ;;!= l1 = 012674 000024
;;!= l2 = 000067
pop v1 ;;!= l1 = 012667 177676
;;!= l2 = 000067
pop v1+2 ;;!= l1 = 012667 177672
;;!= l2 = 000077
pop @v2 ;;!= l1 = 012677 177666
;;!= l2 = 000077
pop @v2+off ;;!= l1 = 012677 177662
;
.end

View File

@ -0,0 +1,61 @@
; $Id: test_0320_macro_narg.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro keyword arguments and .narg and \ operator
;
.asect
. = 1000
; list macro expansion
.list me
; define macro with defaults and .narg
.macro quad,a1,a2,a3=76,a4=77
.word a1 ;;!! $l1
.word a2 ;;!! $l2
.word a3 ;;!! $l3
.word a4 ;;!! $l4
.narg $$$ ;;!! $l5
.word $$$ ;;!! $l5
.endm
;
; use macro with defaults and keyword arguments, test .narg
; Note: .narg does not count keyword arguments
;
;;!= l1 = 000001
;;!= l2 = 000002
;;!= l3 = 000003
;;!= l4 = 000004
quad 1,2,3,4 ;;!= l5 = 000004
;
;;!= l1 = 000011
;;!= l2 = 000012
;;!= l3 = 000076
;;!= l4 = 000077
quad 11,12 ;;!= l5 = 000002
;
;;!= l1 = 000023
;;!= l2 = 000021
;;!= l3 = 000076
;;!= l4 = 000077
quad a2=21,a1=22,23 ;;!= l5 = 000001
;
;;!= l1 = 000034
;;!= l2 = 000033
;;!= l3 = 000032
;;!= l4 = 000031
quad a4=31,a3=32,a2=33,a1=34 ;;!= l5 = 000000
;
; use macro with \ operator (pass by value)
;
a = 12
b = 3456
;
;;!= l1 = 000012
;;!= l2 = 003456
;;!= l3 = 000013
;;!= l4 = 003457
quad \a,\b,a+1,b+1 ;;!= l5 = 000004
;
.end

View File

@ -0,0 +1,52 @@
; $Id: test_0330_macro_nchr.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro string passing and .nchr
;
.asect
. = 1000
; list macro expansion
.list me
; define macro using .ascii strings and .nchr
.macro tascii val
.ascii /val/ ;;!! $l1
.nchr $$$$,^\val\
.byte $$$$ ;;!! $l2
.endm
;
;;!= l2 = 001003: 003
tascii xyz ;;!= l1 = 170 171 172
;;!= l2 = 001013: 007
tascii <abc def> ;;!= l1 = 141 142 143 040 144
;;!= l2 = 001023: 007
tascii ^/123 456/ ;;!= l1 = 061 062 063 040 064
;;!= l2 = 001030: 004
tascii val=halt ;;!= l1 = 150 141 154 164
;
a = 76
b = 5432
;;!= l2 = 001033: 002
tascii \a ;;!= l1 = 067 066
;;!= l2 = 001040: 004
tascii \b ;;!= l1 = 065 064 063 062
;
; define macro which uses full instruction as agrument
;
.macro toper op1
op1 ;;!! $l1
.endm
;
; and use it with <> and ^// syntax
;
. = 2000
toper nop ;;!= l1 = 002000: 000240
toper <clr @#v1> ;;!= l1 = 002002: 005037 002012
toper ^/mov r0,r1/ ;;!= l1 = 002006: 010001
toper op1=halt ;;!= l1 = 002010: 000000
;
v1: .word 0
;
.end

View File

@ -0,0 +1,56 @@
; $Id: test_0340_macro_autolbl.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2019-2023 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro with auto-label creation; test nested macro calls
;
.asect
. = 1000
; list macro expansion
.list me
;
; define macro using ?lbl and defaults
;
.macro scopy,src,dst=#t02tmp,?lbl
mov src,r0
mov dst,r1
lbl: movb (r0)+,(r1)+
bne lbl ;;!! $l1
.endm scopy
;
t02: scopy #t02a1+<2*2>,#t02buf ;;!= l1 = 001012: 001376
1$: ;;!! 001014:
scopy #t02a2 ;;!= l1 = 001026: 001376
2$: ;;!! 001030:
mov #t02a1,r5
scopy r5 ;;!= l1 = 001044: 001376
3$: ;;!! 001046:
;
t02a1: .asciz /1234567890/
t02a2: .asciz /abcdefghij/
t02buf: .blkb 32.
t02tmp: .blkb 32.
;
; define push/pop macro
.macro push,src
mov src,-(sp)
.endm
.macro pop,dst
mov (sp)+,dst
.endm
;
; and a macro with nested macro calls
.macro bcopy,src,dst
push r0
push r1
scopy #src,#dst
pop r1
pop r0
.endm
;
. = 2000
t03: bcopy t02a1,t02tmp ;;!= l1 = 002016: 001376
1$: ;;!! 002024:
.end

View File

@ -0,0 +1,30 @@
; $Id: test_0350_macro_concat.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro concatination, the ' operator
;
.asect
. = 1000
; list macro expansion
.list me
;
; define and use macro with a concatinated label
; check label creation with .if df
;
.macro tconc1 a,b,dst
a'b: clr dst
.endm
tconc1 xx,yy,(r0)
.if ndf,xxyy
.error ; label xxyy not defined
.endc
;
; define and use macro with a concatinated string
.macro tconc2 a,b
.ascii /a'b/ ;;!! $l1
.endm
tconc2 dc,ba ;;!= l1 = 144 143 142 141
.end

View File

@ -0,0 +1,58 @@
; $Id: test_0360_macro_mexit.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .macro and .mexit
;
.asect
. = 1000
; list macro expansion
.list me
;
; nested macro calls, ensure that .mexit individually
.macro mtop,src
mbot #1,a
mbot src,b
.mexit
bad code ; never assembled
.endm
;
.macro mbot,src,dst
mov src,dst
.mexit
bad code ; never assembled
.endm
;
mtop #2
1000$: ;;!! 001014:
mtop #3
1100$: ;;!! 001030:
;
; nested macro calls, ensure that dangling .if are closed properly
.macro mtop1
mbot1 0
.if ne,0
.iff
mbot1 1
.ift
.word 001001 ; never assembled
.iff
.word 001002 ; written once
.endc
.endm
;
.macro mbot1,val
.word 002001 ; written twice
.if ne,val
.mexit
.endc
.word 002002 ; written once
.endm
;
mtop1
2000$: ;;!! 001040:
;
a: .word 0
b: .word 0
.end

View File

@ -0,0 +1,42 @@
; $Id: test_0370_macro_nest.mac 1356 2023-01-26 15:10:23Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test macro redifinitions and nested .macro definitions
;
.asect
. = 1000
; list macro expansion
.list me
;
; define a macro
.macro mtest a
mov a,-(sp) ;;!! $l1
.endm
;
mtest r0 ;;!= l1 = 010046
;
; redefine this macro
.macro mtest a
mov -(sp),a ;;!! $l1
.endm
;
mtest r0 ;;!= l1 = 014600
;
; define a macro that defines macros
.macro mdef
.macro push src
mov src,-(sp) ;;!! $l1
.endm push
.macro pop dst
mov -(sp),dst ;;!! $l1
.endm pop
.endm mdef
;
mdef ; will create push,pop macro
;
push r1 ;;!= l1 = 010146
pop r1 ;;!= l1 = 014601
;
.end

View File

@ -0,0 +1,81 @@
; $Id: test_0400_if_eq.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if eq|ne|gt|le|lt|ge basics
;
.asect
. = 1000
;
a = 1
b = 2
c = a + b
;
;
.if eq,-1 ; eq -1 ---------
.word 001001 ; not assembled
.endc
.if eq,0 ; eq 0
.word 001002 ;;!! 001002
.endc
.if eq,a ; eq +1
.word 001003 ; not assembled
.endc
1000$: ;;!! 001002:
;
.if ne,-a ; ne -1 ----------
.word 002001 ;;!! 002001
.endc
.if ne,a-a ; ne 0
.word 002001 ; not assembled
.endc
.if ne,a ; ne 1
.word 002003 ;;!! 002003
.endc
1100$: ;;!! 001006:
;
.if gt,a-b ; gt -1 ----------
.word 003001 ; not assembled
.endc
.if gt,b-b ; gt 0
.word 003001 ; not assembled
.endc
.if gt,b-a ; gt 1
.word 003003 ;;!! 003003
.endc
1200$: ;;!! 001010:
;
.if le,b-c ; le -1 ----------
.word 004001 ;;!! 004001
.endc
.if le,c-c ; le 0
.word 004002 ;;!! 004002
.endc
.if le,c-b ; le 1
.word 004003 ; not assembled
.endc
1300$: ;;!! 001014:
;
.if lt,b-3 ; lt -1 ----------
.word 005001 ;;!! 005001
.endc
.if lt,c-a-b ; lt 0
.word 005002 ; not assembled
.endc
.if lt,c-2 ; lt 1
.word 005003 ; not assembled
.endc
1400$: ;;!! 001016:
;
.if ge,c-a-b-1 ; ge -1 ----------
.word 006001 ; not assembled
.endc
.if ge,b-a-1 ; ge 0
.word 006002 ;;!! 006002
.endc
.if ge,b-1 ; ge 1
.word 006003 ;;!! 006003
.endc
1500$: ;;!! 001022:
;
.end

View File

@ -0,0 +1,136 @@
; $Id: test_0410_if_df.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if df|ndf basics
;
.asect
. = 1000
;
a = 1
b = 2
c = a+b
;
; single symbol tests
.if df,a ; df Y -----------
.word 001001 ;;!! 001001
.endc
.if df,ano ; df N -----------
.word 001002 ; not assembled
.endc
1000$: ;;!! 001002:
;
.if ndf,a ; ndf Y ----------
.word 002001 ; not assembled
.endc
.if ndf,ano ; ndf N -----------
.word 002002 ;;!! 002002
.endc
1100$: ;;!! 001004:
;
; sym & sym tests
.if df,a&b ; df Y&Y ---------
.word 003001 ;;!! 003001
.endc
.if df,a&bno ; df Y&N ---------
.word 003002 ; not assembled
.endc
.if df,ano & b ; df N&Y --------
.word 003003 ; not assembled
.endc
.if df,ano & bno ; df N&N --------
.word 003004 ; not assembled
.endc
2000$: ;;!! 001006:
;
.if ndf,a&b ; ndf Y&Y --------
.word 004001 ; not assembled
.endc
.if ndf,a&bno ; ndf Y&N --------
.word 004002 ;;!! 004002
.endc
.if ndf,ano & b ; ndf N&Y -------
.word 004003 ;;!! 004003
.endc
.if ndf,ano & bno ; ndf N&N -------
.word 004004 ;;!! 004004
.endc
2100$: ;;!! 001014:
;
; sym ! sym tests
.if df,a!b ; df Y&Y ---------
.word 005001 ;;!! 005001
.endc
.if df,a!bno ; df Y&N ---------
.word 005002 ;;!! 005002
.endc
.if df,ano ! b ; df N&Y --------
.word 005003 ;;!! 005003
.endc
.if df,ano ! bno ; df N&N --------
.word 005004 ; not assembled
.endc
2200$: ;;!! 001022:
;
.if ndf,a!b ; ndf Y!Y --------
.word 006001 ;;!! 006001
.endc
.if ndf,a!bno ; ndf Y!N --------
.word 006002 ; not assembled
.endc
.if ndf,ano ! b ; ndf N!Y -------
.word 006003 ; not assembled
.endc
.if ndf,ano ! bno ; ndf N!N -------
.word 006004 ; not assembled
.endc
2300$: ;;!! 001024:
;
; 3 sym tests
.if df,a&b&c ; df Y&Y&Y ---------
.word 007001 ;;!! 007001
.endc
.if df,a&b&cno ; df Y&Y&N ---------
.word 007002 ; not assembled
.endc
.if df,a&b!cno ; df Y&Y!N ---------
.word 007003 ;;!! 007003
.endc
.if df,ano&bno!c ; df N&N!Y ---------
.word 007004 ;;!! 007004
.endc
2400$: ;;!! 001032:
;
; check response for register, instruction, macro, and directive names
;
. = 2000
.macro mtest
.print 007 ; mtest macro
.endm
mtest
;
; register names (ndf in asm-11, df in MACRO-11)
.if df,pc
.word 010001
.endc
3000$: ;;!! 002000:
;
; instruction opcodes (df in asm-11, ndf in MACRO-11)
.if df,cmpb
.word 010002
.endc
3100$: ;;!! 002002:
;
; macro names (ndf in asm-11 and MACRO-11)
.if df,mtest
.word 010003
.endc
3200$: ;;!! 002002:
;
; directive names (ndf in asm-11 and MACRO-11)
.if df,.macro
.word 010004
.endc
3300$: ;;!! 002002:
;
.end

View File

@ -0,0 +1,36 @@
; $Id: test_0420_if_b.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if b|nb basics
;
.asect
. = 1000
;
a = 1
b = 2
;
; direct tests
.if b, ; b - -----------
.word 001001 ;;!! 001001
.endc
.if b,a ; b t -----------
.word 001002 ; not assembled
.endc
.if b,@20(r0) ; b t -----------
.word 001003 ; not assembled
.endc
1000$: ;;!! 001002:
;
.if nb, ; nb - ----------
.word 002001 ; not assembled
.endc
.if nb,a ; nb t ----------
.word 002002 ;;!! 002002
.endc
.if nb,@20(r0) ; nb t ----------
.word 002003 ;;!! 002003
.endc
1100$: ;;!! 001006:
;
.end

View File

@ -0,0 +1,75 @@
; $Id: test_0430_if_idn.mac 1355 2023-01-25 21:14:24Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if idn|dif basics
;
.asect
. = 1000
;
.list me
;
; Note: if idn/dif seems to be broken in RT-11 MACRO-11
;
.if idn,r0,r0 ; idn
.word 001001 ;;!! 001001
.endc
.if idn,@nn(r1),<@nn(r1)> ; idn
.word 001002 ;;!! 001002
.endc
.if idn,a,^/a/ ; idn
.word 001003 ;;!! 001003
.endc
.if idn,a+b,a+b ; idn
.word 001004 ;;!! 001004
.endc
.if idn,a+b,a+c ; idn
.word 001005 ; not assembled
.endc
1000$: ;;!! 001010:
;
.if dif,r0,r1 ; dif
.word 002001 ;;!! 002001
.endc
.if dif,0,<1> ; dif
.word 002002 ;;!! 002002
.endc
.if dif,<a>,^/b/ ; dif
.word 002003 ;;!! 002003
.endc
.if dif,a+b,a+c ; dif
.word 002004 ;;!! 002004
.endc
.if dif,a+b,a+b ; dif
.word 002005 ; not assembled
.endc
1100$: ;;!! 001020:
;
; test from macro
.macro tstidn a,b
.if idn,a,b
.word 003001
.endc
.endm
.macro tstdif a,b
.if dif,a,b
.word 003002
.endc
.endm
;
. = 2000
tstidn r0,r0
tstidn @nn(r1),<@nn(r1)>
tstidn a,^/a/
tstidn a+b,a+b
tstidn a+b,a+c
2000$: ;;!! 002010:
;
tstdif r0,r1
tstdif 0,<1>
tstdif <a>,^/b/
tstdif a+b,a+c
tstdif a+b,a+b
2100$: ;;!! 002020:
;
.end

View File

@ -0,0 +1,36 @@
; $Id: test_0440_iff.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if basics
;
.asect
. = 1000
;
a = 1
b = 2
c = a + b
;
.if eq,0 ; eq 0 ----------
.word 001001 ;;!! 001001
.iff
.word 011001 ; not assembled
.iftf
.word 021001 ;;!! 021001
.ift
.word 031001 ;;!! 031001
.endc
1000$: ;;!! 001006:
;
.if eq,a ; eq 1 ----------
.word 002001 ; not assembled
.iff
.word 012001 ;;!! 012001
.iftf
.word 022001 ;;!! 022001
.ift
.word 032001 ; not assembled
.endc
1100$: ;;!! 001012:
;
.end

View File

@ -0,0 +1,36 @@
; $Id: test_0450_if_macro.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .if with macros
;
.asect
. = 1000
; list macro expansion
.list me
;
.macro movclr,dst,src
.if b,dst
.mexit
.endc
.if b,src
clr dst
.iff
mov src,dst
.endc
.endm movclr
;
movclr
1000$: ;;!! 001000:
;
movclr a
1100$: ;;!! 001004:
;
movclr b,#1
1200$: ;;!! 001012:
;
a: .word 0
b: .word 0
;
.end

View File

@ -0,0 +1,54 @@
; $Id: test_0500_rept.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .rept basics
;
.asect
. = 1000
; list macro expansion
.list me
;
a = 1
b = 2
;
; single level .rept
;
.rept a-b ; .rept -1
.word 001001 ; not assembled
.endr
1000$: ;;!! 001000:
;
.rept a-a ; .rept 0
.word 002001 ; not assembled
.endr
1100$: ;;!! 001000:
;
.rept a ; .rept 1
.word 003001 ;;!! 003001
.word 003002 ;;!! 003002
.endr
1200$: ;;!! 001004:
;
.rept a+a ; .rept 2
.word 004001 ;;!! 004001
.word 004002 ;;!! 004002
.word 004003 ;;!! 004003
.word 004004 ;;!! 004004
.endr
1300$: ;;!! 001024:
;
; double level .rept
;
c = 1
.rept a+b
.ascii /abcd/
.rept c
.byte 010,c
.endr
c = c + 1
.endr
2000$: ;;!! 001054:
;
.end

View File

@ -0,0 +1,50 @@
; $Id: test_0510_rept_mexit.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .rept and .mexit
;
.asect
. = 1000
; list macro expansion
.list me
;
; single .rept with an .mexit abort
a = 1020 ; write limit
.rept 1024.
.word 001001 ; before limit check
.if ge,.-a ; stop if beyond limit
.mexit
.endc
.word 001002 ; after limit check
; next
.endr
1000$: ;;!! 001022:
;
; .rept called from a macro, ensure that macro .mexit is independent
. = 2000
a = 2020 ; write limit
.macro mtest
.rept 1024.
.word 002001 ; before limit check
.if ge,.-a ; stop if beyond limit
.mexit
.endc
.word 002002 ; after limit check
; next
.endr
.word 002010
.word 002011
.word 002012
.word 002013
.mexit
.word 002020
.word 002021
.word 002022
.word 002023
.endm
;
mtest
2000$: ;;!! 002032:
.end

View File

@ -0,0 +1,25 @@
; $Id: test_0600_mcall.mac 1354 2023-01-24 16:29:10Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2023- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; test .mcall basics
;
.asect
. = 1000
;
.if df,...top ; asm-11 only
; list macro expansion
.list me
;
.mcall push,pop
;
push #100
push #200
pop r0
;
.mdelete push
pop r1
;
.endc
.end

View File

@ -1,6 +1,6 @@
; $Id: zbug_0001.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: zbug_0001.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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>
;
; ISSUE: .ascii without label failed with Q
;
@ -14,7 +14,7 @@
; SIDES: prevents also creation of labels with the name of a directive.
;
.asect
.blkw 400
. = 1000
.word 0

View File

@ -1,13 +1,13 @@
; $Id: zbug_0002.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: zbug_0002.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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>
; ISSUE: phase error after fmt='-' type opcodes
;
; REASON: incdot(2) wasn't called in this case in pass 1.
;
.asect
.blkw 400
. = 1000
l1: nop
nop

View File

@ -1,6 +1,6 @@
; $Id: zbug_0003.mac 1184 2019-07-10 20:39:44Z mueller $
; $Id: zbug_0003.mac 1353 2023-01-23 18:13:53Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2013- 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>
;
; for asm-11 prior rev 502
;
@ -9,7 +9,7 @@
; REASON: confused in parser with '-(r0)' and '@-(r0)' modes
;
.asect
.blkw 400
. = 1000
mov -2(r0),r5
mov @-2(r0),r5

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
#!/usr/bin/perl -w
# $Id: asm-11_expect 1189 2019-07-13 16:41:07Z mueller $
# $Id: asm-11_expect 1355 2023-01-25 21:14:24Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2013-2019 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-25 1355 1.2 add simple substitution mechanism
# 2023-01-24 1354 1.1.3 handle new flag column in output format
# 2019-07-13 1189 1.1.2 drop superfluous exists for $opts
# 2019-05-25 1152 1.1.1 skip data checks if dot not defined
# 2018-11-03 1065 1.1 add and use bailout; update exit code usage
@ -46,14 +48,19 @@ exit 0;
#-------------------------------------------------------------------------------
#
#; Input file list:
# 1 6 ; comment
# 1 17 000000 zero:
# 1 23 002000 000101 w0: .word 101
# 1 17 001011 377 .byte ^c0
# 1 70 001206 046374 001234 001234 bic 1234(r3),@1234(r4)
# 1 24 001036 067527 066162 020544 .word "Wo,"rl,"d!,0
# 000000
#EEfnolinno dot... word1. word2. word2.
# 1 6 ; comment
# 1 17 000000 zero:
# 1 23 002000 000101 w0: .word 101
# 1 17 001011 377 .byte ^c0
# 1 70 001206 046374 001234 001234 bic 1234(r3),@1234(r4)
# 1 24 001036 067527 066162 020544 .word "Wo,"rl,"d!,0
# 000000
# 1 21 001012 110 145 154 154 .byte 'H,'e,'l,'l
# 1M 15 .macro scall,dst
# 1m 16 001000 004767 000002 jsr pc,t01sub
#
#EEfnoFlinno dot... word1. word2. word2. : line with word data
#EEfnoFlinno dot... by1 by2 by3 by4 by5 : line with byte data
#
# 1 2 3
#0123456789012345678901234567890123456789
@ -71,6 +78,7 @@ sub do_file {
}
my @errmsg; # error message list
my %sub; # substitution hash
my $echeck = 0;
my $c_string;
my $c_pend;
@ -95,15 +103,19 @@ sub do_file {
}
my $fileno;
my $flag;
my $lineno;
if (substr($rest,0,8) =~ m/^\s+(\d+)\s+(\d+)$/) {
if (substr($rest,0,9) =~ m/^\s+(\d+)(.)\s+(\d+)$/) {
$fileno = int($1);
$lineno = int($2);
$rest = substr($rest,8);
$flag = $2;
$lineno = int($3);
$rest = substr($rest,9);
} else {
# print "+++1 $line\n";
next;
}
next if $flag =~ m/^[MRd]$/; # ignore macro/rept and conditionals
my $dot;
if (substr($rest,0,7) eq ' ') {
@ -136,12 +148,18 @@ sub do_file {
$rest = substr($rest,1);
}
# look for substition definitions
if ($rest =~ m/;;!=\s*([a-zA-Z][a-zA-Z0-9]*)\s*=\s*(.*)$/) {
$sub{$1} = $2;
}
# look for expect condition (unless one is pending)
if ($c_pend) {
$c_pend = undef;
} else {
if ($rest =~ m/;;!!(.*)$/) {
$c_string = $1;
$c_string =~ s/;.*$//; # drop trailing comment
if ($rest =~ m/^\s*;;!!/) {
$c_pend = 1;
next;
@ -164,6 +182,22 @@ sub do_file {
my $c_dot;
my @c_dat;
# handle substitutions
if ($c_string =~ m/\$([a-zA-Z][a-zA-Z0-9]*)/) {
if (exists $sub{$1}) {
$c_string = $`;
$c_string .= $sub{$1};
$c_string .= $';
} else {
push @errmsg,
{msg => sprintf("substitution failure for tag '%s'", $1),
line => ';;!! ' . $c_string};
$c_string = undef;
next;
}
}
# and parse result
my $c_rest = $c_string;
if ($c_rest =~ m/^\s*([A-Z]+)/) {
$c_err = $1;
@ -207,6 +241,12 @@ sub do_file {
$err, $c_err),
line => $line};
}
} else {
if ($err ne '') {
push @errmsg,
{msg => sprintf("error mismatch: found='%s', expect=''", $err),
line => $line};
}
}
if (defined $c_dot) {

View File

@ -1,11 +1,11 @@
.\" -*- nroff -*-
.\" $Id: asm-11.1 1286 2022-08-25 06:53:38Z mueller $
.\" $Id: asm-11.1 1356 2023-01-26 15:10:23Z mueller $
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\" Copyright 2013-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
.\"
.\" ------------------------------------------------------------------
.
.TH ASM-11 1 2019-05-25 "Retro Project" "Retro Project Manual"
.TH ASM-11 1 2023-01-25 "Retro Project" "Retro Project Manual"
.\" ------------------------------------------------------------------
.SH NAME
asm-11 \- simple assembler for MACRO-11 style PDP-11 code
@ -51,7 +51,7 @@ Activated with the \fB\-\-lsm\fP or \fB\-\-olsm\fP options.
the MACRO-11 assembler.
Activated with the \fB\-\-lst\fP or \fB\-\-olst\fP options.
\fBasm-11\fP provides only the most basic assembler directives
\fBasm-11\fP provides many basic assembler directives
.EX
.ascii stores ascii string
@ -61,37 +61,70 @@ Activated with the \fB\-\-lst\fP or \fB\-\-olst\fP options.
.blkw allocate words of storage
.byte store bytes of data
.end end of source
.endc end of .if conditional block
.endm end of macro
.endr end of .rept repeat block
.error raise error
.even ensure word aligment
.include include another source file
.if assembles block if condition is met
.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
.macro subset of macro functionality
.macro starts macro defintion (subset)
.mcall load macro definitions
.mdelete delete macro definitions
.mexit terminate macro or .rept expansion
.narg number of macro arguments
.nchr calculate string length
.ntype evaluate addressing mode
.odd align to odd byte address
.print insert output into listing
.rept starts repeat block definition
.word store words of data
.EE
and thus restricted macro support and neither conditional assembly,
nor psect support.
and thus restricted macro support and no psect support.
.
.SS Level of macro support
Enough for simple macros and useful for writing test benches.
Auto-labels are supported (?name syntax). Main limitations:
.SS Differences between asm-11 and MACRO-11
.RS 2
.PD 0
.IP "-" 2
no \\var support (pass by value)
only single \.asect supported, no \.psect support
.IP "-"
only positional parameters
registers must be named r0,..,r5,sp,pc
.IP "-"
no concatination support
the %n notation and register expressions are not supported
.IP "-"
no .mexit, .mdelete, .mcall support
the \.emt and \.trap instruction must have the trap number specified
.IP "-"
a .macro definition must end with \.endm (\.endr not accepted)
.IP "-"
a .rept block must end with \.endr (\.endm not accepted)
.IP "-"
macros: the \\ operator accepts only symbols, no expressions
.IP "-"
a \.if dif/idn doesn't work with blank arguments
.IP "-"
a \.if df/ndf sees opcodes as defined (MACRO-11 doesn't)
.IP "-"
a \.if df/ndf sees register names as undefined (MACRO-11 doesn't)
.IP "-"
error codes on invail statements differ, especially A and Q
.PD
.RE
.PP
.
.SS Design goal for directive support
The following directives will be added in future releases
.EX
.flt2 store 32 bit float
.flt4 store 64 bit float
.EE
.\" ------------------------------------------------------------------
.SH OPTIONS
.
@ -103,12 +136,19 @@ The default search path is '.' plus \fI$RETROBASE/tools/asm-11\fP if
\fB\-I\fP can be given multiple times und must have a single path name.
.
.\" ----------------------------------------------
.IP "\fB\-L\fI path\fR"
adds \fIpath\fP to the .library search path used by the \.mcall directive.
The default search path is \fI$RETROBASE/tools/asm-11\fP if \fBRETROBASE\fP is
defined.
\fB\-L\fP can be given multiple times und must have a single path name.
.
.\" ----------------------------------------------
.IP "\fB\-E\fR"
write .include processed code to \fIstdout\fP and stop after 1st pass.
No other outputs are created, options like \fB\-\-lst\fR are ignored.
Useful for the generation of self-contained macro files that are free
of .include directives and thus free of external references. Was inspired
by the -E option of gcc(1).
of .include and .mcall directives and thus free of external references.
Was inspired by the -E option of gcc(1).
.
.\" ----------------------------------------------
.IP "\fB\-M\fR"