flat assembler
Message board for the users of flat assembler.

Index > Main > unexpected end of file error

Author
Thread Post new topic Reply to topic
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
I am just wondering what is causing unexpected end of file error

The code I am using is

Code:
int30h:                                         ;my first api Smile
        push    ds
        push    10h
        pop     ds
        cmp     ah, 1
        jz      .checkkey
        cmp     ah, 2
        jz      .getkey
        pop     ds
        iret
     .checkkey:
        cmp     [keycount], 0
        pop     ds
        jz      .nokey
        and     byte [esp+8],not (1 shl 6)      ; clear ZF
        iret
     .nokey:
        or      byte [esp+8],1 shl 6            ; set ZF
        iret
     .getkey:
        push    ebx
        cli                                     ;just in case
        xor     edx, edx                        ;[in] edi = buffer
     .getkeyloop:
        xor     eax, eax
        test    [keystatus], KSHIFT
        jz      .noshift
        mov     ecx, ASCIITableU
        jmp     @F
     .noshift:
        mov     ecx, ASCIITableL
     @@:
        movzx   eax, byte[keybuffer+edx]
        test    al, al
        js      @F
     .keyup:
        neg     al
        mov     ebx, 1                           ;keyup
     @@:
        mov     al, byte[eax+ecx]
        cmp     al, 20h
        jc      .specialkeys
        cmp     ebx, 1
        jz      @F
        stosb
      .cont:
        mov     ecx, [keycount]
        inc     ecx
        inc     edx
        cmp     edx, ecx
        jnz     .getkeyloop
        pop     ebx
        pop     ds
        iret
     .specialkeys:
        cmp     al, 1
        jz      .shift
        jmp     .cont
     .shift:
        xor     al, bl
        movzx   eax, al
        or      [keystatus], eax
        jmp     .cont           
    


Which looks correct to me.... Perhaps more information should be given on why fasm is refusing to compile my code...
Post 11 Sep 2004, 09:03
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
I guess it is "jz @F" after .keyup:
Code:
 @@:
        mov     al, byte[eax+ecx]
        cmp     al, 20h
        jc      .specialkeys
        cmp     ebx, 1
        jz      @F
        stosb    
You don't have any @@ after that one... Wink
Post 11 Sep 2004, 09:14
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
There is "@F" jump to the next anonymous label in the line after "cmp ebx,1", but there is no next anonymous label defined there.
Post 11 Sep 2004, 09:15
View user's profile Send private message Visit poster's website Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey
Quote:

I am just wondering what is causing unexpected end of file error


I hate this error and it's not very helpful at all. I hope we can get something better in future versions of fasm. Smile

_________________
silkodyssey
Post 11 Sep 2004, 12:59
View user's profile Send private message MSN Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Thanks. I just forgot to change the label name..
Post 11 Sep 2004, 14:03
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Compiler doesn't know where WE want ie our proc/endp pair to be. It searches it until the end of file and if it hasn't found it yet, it wonders "Why on earth did this file end? ^o) "
This is our obligation to make a ready pair so we can code inside it not code until we feel to put an endp Wink
Post 12 Sep 2004, 11:40
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
I have made a special update of 1.55 packages today, there are some new error messages to replace the hated "unexpected end of file".
Post 12 Sep 2004, 12:49
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Thank you very much Mr. Privalov! Glad to see an end to the 'end of file error'.
MadMatt
Post 13 Sep 2004, 17:26
View user's profile Send private message Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey
Glad to see the end of it as well Smile

_________________
silkodyssey
Post 13 Sep 2004, 19:21
View user's profile Send private message MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Very good Privalov! Smile
Post 13 Sep 2004, 19:23
View user's profile Send private message Visit poster's website Reply with quote
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro
OK here is a dumb little routine to find the length of a C style string.
I had been using it for a while in fasm 1.51 and then decided to upgrade to 1.55. Surprisingly I get the dreaded

Error: unexpected end of file

message.

The code follows

Code:

 include '%fasminc%\win32ax.inc'



section '.data' data readable writeable
_nstr db '12345',0
_stmsg db 'The length of the string is '
_len db '0',0
_title db 'A window',0

.code

start:

stdcall StrLength, _nstr
add al,'0'
mov [_len],al
 invoke MessageBox,  HWND_DESKTOP, _stmsg, _title,MB_OK
        invoke  ExitProcess,0

; ( -- strlen)
proc StrLength, StringBuff
; get length of string StringBuff
; StringBuff ; pointer to string
;
; StringBuff must be null terminated
; incrementing eax. The value in eax is the string length
;
; returns: eax = length of string StringBuff
enter
mov edi, [StringBuff]
; dpush 0 ; character count
 mov eax,0 ; character count
; Aprintf 'finding strlen of %s ', dword [ptrString]
StrLength.top: ; top of loop
cmp [edi], byte 0 ; check for string null termination
je StrLength.done ; if null, jump out of loop and return
inc edi ; pointer to next byte
inc eax ; increment counterc
jmp StrLength.top ; back to top of loop
; jump here to return
StrLength.done:
return

.end start            

    


The problem lies somewhere in the StrLength procedure.

-Matt

_________________
-- -------------------------------------------------------
"I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus
---------------------------------------------------------
Post 22 Sep 2004, 02:54
View user's profile Send private message Visit poster's website Reply with quote
MattBro



Joined: 08 Nov 2003
Posts: 37
MattBro
Well I'll be! I just answered my own question. Apparently the proc macro now requires termination with an endp macro! I must have missed that somewhere in the last few updates.

-Matt
Post 22 Sep 2004, 03:22
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.