NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: deeband on November 30, 2012, 06:45:43 PM
-
.MODEL SMALL
.STACK 100h
.DATA
Var1 dd 2
PromptStr DB 'is erfect',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
it is inexpected end of file encountered error
can u help me please ??
Edit: added "code" tags - fbk
-
i`m trying to print the perfect numbers !!!
-
It's an imperfect world! :)
Are you trying to assemble this with Nasm? Won't work - your code would need several changes. That can be done, but it might be easier to assemble it with an assembler that it's intended for. I would suggest Jwasm (just because I don't like MS too much). If you wish to convert it to something compatible with Nasm, we can probably help with that.
Best,
Frank
-
i want to assemble it with tasm !!!!
-
Okay. Got a manual for Tasm? Maybe should read it. The only thing I see that might cause an "unexpected end of file" is that Tasm expects you to end segments. I'm not sure if that applies to the "simplified segment directives" you're using. Maybe you can find an example that assembles properly to compare against?
Best,
Frank
-
I have two suggestions.
1. When you post code on the forum, please surround it in [CODE][/CODE] tags. It makes reading your source a lot easier.
2. Since your code looks fine and since TASM is basically obsolete. Try opening your file in Notepad and use "Save As..." and make sure that you save the file as an MS-DOS text file. Modern OS's like to use Unicode whenever possible and that can make things difficult for older software which doesn't support it.
HtH
-
Okay, I stuck "code" tags around it.
Just to follow up... Deeband posted this question to Stack Overflow (very active board!). After getting similar advice to here (ends), he announced that it was "solved - it was a problem with my computer." - quite possibly the Unicode problem you mention. In any case, it can (conceptually) be marked "solved". (I don't think his code is gonna work, but it least it assembles)
Best,
Frank
-
Ah okay. Thanks for the update ;D. I've been away for a bit so I didn't realize this was already an old thread. :-[