[英]Easy68k: How to call a macro in assembly?
I'm using easy68k for the first time, and I wrote two macros that I want to call in my program. 我第一次使用easy68k,我编写了两个要在程序中调用的宏。 The macro definitions compiled just fine. 宏定义编译就好了。
However, when I try to call the macro from within the main program (ie after the "org" statement) it doesn't compile. 但是,当我尝试从主程序中调用宏时(即在“ org”语句之后),它不会编译。
I tried all the syntax that I could think of, I checked the help section and a few other sites on the internet, and nothing worked. 我尝试了所有可以想到的语法,检查了帮助部分和Internet上的其他一些站点,但没有任何效果。
Currently, when I compile the code below, it displays two error messages: 当前,当我编译下面的代码时,它显示两个错误消息:
One says: Line 57 (MUL_MAC d1,d3,) ERROR: Invalid argument The other says: Line 60 (bsr MUL_SUB) ERROR: Invalid argument 一个说:57行(MUL_MAC d1,d3,)错误:无效参数另一个说:60行(bsr MUL_SUB)错误:无效参数
Here is my source code (MC68000 assembly): 这是我的源代码(MC68000程序集):
MUL_MAC macro
movem.l d6-d7, -(a7)
move.w \1, d6
clr.l d7
loop\@ add.w \2, d7
dbra d6, loop\@
move.w d7, \2
movem.l (a7)+, d6-d7
endm
MUL_SUB equ * ; Subroutine
move.w d2, d3
clr.l d4
loop_sub add.w d1, d4
dbra d3, loop_sub
move.w d4, d2
rts
PRINT_RES macro
movem.l d5-d7, -(a7)
clr.l a1
move #248, d7 ; Code to display character
cmp \1, \2
beq right\@
move.b INC_L, d5
loop_ch_2\@ move.b INC(a1)+, d0
trap #14
dbra d5, loop_ch_2\@
bra finish\@
right\@ move.b COR_L, d5
loop_ch_2\@ move.b COR(a1)+, d0
trap #14
dbra d5, loop_ch_2\@
finish\@ movem.l (a7)+, d5-d7
endm
ORG $1000
START: ; first instruction of program
clr.w d1
clr.w d2
clr.w d3
clr.w d4
move.w X, d1
move.w Y, d2
move.w d2, d3
move.w d2, d4
mulu d1, d4 ; Store the actual result in d2 to compare later
MUL_MAC d1,d3,
PRINT_RES d3,d4,
bsr MUL_SUB
PRINT_RES d2,d4,
move #228, d7
trap #14
* Put program code here
SIMHALT ; halt simulator
* Put variables and constants here
X ds 1
Y ds 1
INC dc.b 73, 78, 67, 79, 82, 82, 69, 67, 84 ; INCORRECT
COR dc.b 67, 79, 82, 82, 69, 67, 84 ; CORRECT
INC_L dc.b 9 ; Length of INCORRECT
COR_L dc.b 7 ; Length of CORRECT
END START ; last line of source
At least I would remove the trailing commas like this 至少我会这样删除尾随逗号
MUL_MAC d1,d3
PRINT_RES d3,d4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.