我不确定自己在做什么错。
我尝试在宏中添加前缀@@以及在宏中声明本地@@ label,但这没有用。
我也检查了这个网站link
以及之前的问题中提到的内容...无效。
.286
.model small
.stack 100h
writeString macro string, length, x, y, color
mov ah, 13h
mov al, 0
mov bh, 0
mov bl, color
lea bp, string
mov cx, length
mov dl, x
mov dh, y
int 10h
endm
draw_box_outline macro x_fin,y_fin,x_ini,y_ini
local col_draw,row_draw,row_rev,col_rev
mov cx,x_ini
mov dx,y_ini
mov ah,0ch
mov al,1111b
int 10h
col_draw:
inc cx
int 10h
cmp cx,x_fin
jb col_draw
row_draw:
inc dx
int 10h
cmp dx,y_fin
jb row_draw
row_rev:
dec cx
int 10h
cmp cx,x_ini
ja row_rev
col_rev:
dec dx
int 10h
cmp dx,y_ini
ja col_rev
endm
.data
msg db "Select Number of Player/s$"
msg1 db "1$"
;box parameters
b1_col_ini equ 50
b1_row_ini equ 110
b1_col_fin equ 90
b1_row_fin equ 150
b2_col_ini equ 130
b2_row_ini equ 110
b2_col_fin equ 170
b2_row_fin equ 150
b3_col_ini equ 210
b3_row_ini equ 110
b3_col_fin equ 250
b3_row_fin equ 150
.code
org 100h
main proc far
mov ax,@data
mov ds,ax
mov es,ax
mov ah,0h
mov al,13h
mov bh,0
int 10h
writeString msg,25,7,10,1111b
draw_box_outline b1_col_fin,b1_row_fin,b1_col_ini,b1_row_ini
draw_box_outline b2_col_fin,b2_row_fin,b2_col_ini,b2_row_ini
draw_box_outline b3_col_fin,b3_row_fin,b3_col_ini,b3_row_ini
writeString msg,25,7,10,1111b
;implement cursor press and detection
;implement cursor hide
mov ax,4c00h
int 21h
main endp
end main
在DOSBox中,我不断收到错误“预期的指针类型”和“不同类型的符号”,但在emu8086中没有任何问题。
最佳答案
LOCAL
指令必须在宏的最开始。宏声明和LOCAL行之间的空白行已经太多了。它看起来应该像这样:
draw_box_outline macro x_fin,y_fin,x_ini,y_ini
local col_draw,row_draw,row_rev,col_rev
另外,在这里看看:TASM; LOCAL and LOCALS directives。
关于assembly - 如何在宏中修复“Expecting pointer type”和“symbol already different kind”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53947537/