【发布时间】:2015-06-15 03:58:00
【问题描述】:
我对组装一无所知,但我被分配了这个任务。
请告诉我以下代码是如何运行的?我的意思是步骤或程序。
TITLE MASM Template (main.asm)
; Description:
;
; Revision date:f
INCLUDE Irvine32.inc
.data
counter dword 1;
instruct1 BYTE"How many line are required?: ",0 ;give instruction to user to give the input
answer BYTE"Answer:",0
newline BYTE 0Dh, 0Ah
sum BYTE 0
.code
main PROC
mov edx,OFFSET instruct1 ;move instruct1 to edx
call WriteString
call readint;
mov ecx,eax; move ecx to eax
L1:
push ecx;
mov ecx,counter
L2:
mov al,'*';add '*' into al
call writechar;
loop l2;
pop ecx;
inc counter;
call crlf;
loop l1;
exit
main ENDP
end main
【问题讨论】:
-
猜猜
call WriteString和call readint做了什么,然后看看字符串和cmets,也许从那里开始工作? -
你能解释一下
call WriteString和call readint是什么吗? tq -
它的作用是 打印一个由
*字符组成的正方形。所以如果用户输入2,就会打印两行**。如果用户输入 4,它将打印 4 行****。如果您要问“它是如何工作的?”,您必须更具体。 -
WriteString和ReadInt是最有可能在包含文件“Irvine32.inc”中提供的函数,该文件包含在文件的顶部。我怀疑WriteString将字符串写入控制台,ReadInt读取用户从控制台输入的数字。
标签: assembly x86 masm irvine32