0
 .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 错误!

4

1 回答 1

0

您需要endsend begin. 不知道是不是大问题,但.386不应该在代码段中,而是在.MODEL.

于 2012-12-01T00:09:01.007 回答