使用Tasas1.4并尝试在过程中创建和操作局部变量:
findMins PROC
local z:word:1 ;outer loop counter
local j:word:1 ;inner loop counter
mov cx, rows ;outer loop total iterations
mov z, 0
RowsLoop:
push cx ; save outer iterations left
mov cx,cols ; inner iterations
mov j, 2
ColsLoop:
//some code
loop ColsLoop
//some code
loop RowsLoop
ret
ENDPmov j, 2这个指令同时改变j和z局部变量。我应该如何创建只看到函数内部并且它们是不同的变量,例如,我不想用mov j, 2操作来更改第二个变量。
发布于 2014-11-29 16:27:37
您的函数标题未完成。要强制Turbo汇编程序创建尾语和预言符,您必须添加一种语言(例如C或PASCAL):findMins PROC C
要使变量(和其他符号)本地化,必须前缀@@ (例如@@z),并在程序的开头添加LOCALS
LOCALS
.MODEL small
.STACK 1000h
.DATA
rows dw 3
cols dw 7
.CODE
main PROC
MOV ax, @data
MOV ds, ax
call findMins
mov ax, 4C00h
int 21h
main ENDP
findMins PROC C
local @@z:word:1 ;outer loop counter
local @@j:word:1 ;inner loop counter
mov cx, rows ;outer loop total iterations
mov @@z, 0
RowsLoop:
push cx ; save outer iterations left
mov cx,cols ; inner iterations
mov @@j, 2
ColsLoop:
;some code
loop ColsLoop
;some code
loop RowsLoop
ret
ENDP
END mainhttps://stackoverflow.com/questions/27201947
复制相似问题