1
0
mirror of https://github.com/wfjm/w11.git synced 2026-05-02 22:33:58 +00:00
Files
wfjm.w11/tools/asm-11/tests/test_0300_macro.mac
2022-07-26 08:34:43 +02:00

77 lines
1.6 KiB
Plaintext

; $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>
;
; test .macro basics
;
.asect
.blkw 400
; list macro expansion
.list me
; define and use simple macros
.macro scall,dst
jsr pc,dst
.endm
.macro sret
rts pc
.endm
.macro push,src
mov src,-(sp)
.endm
.macro pop,dst
mov (sp)+,dst
.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.
; nested macro calls
.macro bcopy,src,dst
push r0
push r1
scopy #src,#dst
pop r1
pop r0
.endm
. = 3000
t03: bcopy t02a1,t02tmp
1$: ;;!! 003024:
.end