Author Topic: error  (Read 6652 times)

Offline deeband

  • Jr. Member
  • *
  • Posts: 5
error
« on: November 30, 2012, 06:45:43 PM »
Code: [Select]
.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
« Last Edit: December 01, 2012, 09:13:42 PM by Frank Kotler »

Offline deeband

  • Jr. Member
  • *
  • Posts: 5
Re: error
« Reply #1 on: November 30, 2012, 07:16:09 PM »
i`m trying to print the perfect numbers !!!

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2600
  • Country: us
Re: error
« Reply #2 on: November 30, 2012, 07:29:27 PM »
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


Offline deeband

  • Jr. Member
  • *
  • Posts: 5
Re: error
« Reply #3 on: November 30, 2012, 07:38:57 PM »
i want to assemble it with tasm !!!!

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2600
  • Country: us
Re: error
« Reply #4 on: November 30, 2012, 08:30:56 PM »
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


Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: error
« Reply #5 on: December 01, 2012, 07:10:33 PM »
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

About Bryant Keller
bkeller@about.me

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2600
  • Country: us
Re: error
« Reply #6 on: December 01, 2012, 09:33:05 PM »
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



Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: error
« Reply #7 on: December 01, 2012, 10:16:31 PM »
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.  :-[

About Bryant Keller
bkeller@about.me