这是大学作业,所以必须使用emu8086。没有emu8086.inc
假设我有
msg db "Hello"
msgend:
msglen1 equ $ - msg
msglen2 db $ - msg
然后:
mov ax, msgend - offset msg ; ax gets the correct length
mov ax, msglen1 ; correct length
mov ax, msglen2 ; correct length
; same names as offsets to make it clear,
; how which parameters would be passed.
; But not the same in real code.
TESTMACRO macro msg msgend msglen1 msglen2
mov ax, msg ; correct offset
mov ax, msgend ; correct offset
mov ax, msgend - offset msg ; zero length
mov ax, msglen1 ; again zero length
mov ax, msglen2 ; correct length, but it used up a word
endm
所以。我不能以任何方式在宏中传递字符串的长度,除非传递一个单词中分配的长度。但我很感兴趣,如果我可以用 equ 常数来做到这一点。