.MODEL SMALL
.STACK 100h
.DATA
Var1 dd 2
PromptStr DB 'is perfect',13,10,'$'
ans dd 2
count dd 2
.CODE
.386
Begin:
MOV AX,@DATA ; DS can be written to only through a register
MOV DS,AX ; Set DS to point to data segment
dobody1:
JMP TestNext1
dobody2:
CMP ans,32513
JA finish
MOV EAX,ans
MOV EBX,2
MUL EBX
MOV ans,EAX
DEC count
TestNext1:
CMP var1,2
JE check2
MOV EAX,count
CMP Var1,EAX
JNE dobody2
check2 :
MOV EAX,ans
MOV EBX,2
MUL EBX
INC EAX
MOV EBX,ans
MUL EBX
MOV AH,9
INT 21h
MOV ans,2
MOV count,2
DEC Var1
JMP dobody1
finish :
MOV AH,4Ch ; Set terminate option for int 21h
INT 21h ; Return to DOS (terminate program)
END Begin
我正在尝试使用汇编程序tasm打印完美数字,并且遇到错误的文件意外enf !!!
答案 0 :(得分:0)
您需要在ends
之前添加end begin
。不确定这是不是很重要,但.386
不应该在代码段中,而应该在.MODEL
之前。