1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
; macro.asm
; Test of MACRO and ENDM directives.
; Following a sample of the documentation of Digital Research MAC.
; For use with CP/M.
reboot equ 0
tpa equ 100h
bdos equ 5
type equ 2
cr equ 0Dh
lf equ 0Ah
_hola
chrout macro
ld c, type
call bdos
endm
typeout macro ?message
local pastsub
jp pastsub
msgout: ld e, (hl)
ld a, e
or a
ret z
inc hl
push hl
chrout
pop hl
jp msgout
pastsub:
; Redefine the typeout macro after the first invocation.
typeout macro ??message
local tymsg
local pastm
ld hl, tymsg
call msgout
jp pastm
tymsg: db ??message, cr, lf, 0
pastm:
endm
typeout ?message
endm
org 100h
typeout "Hello, \"macro\" world"
typeout "\x30\7"
typeout 'That''s all folks!'
jp reboot
end
|