flat assembler
Message board for the users of flat assembler.

Index > Main > <internal> Invalid handle error on text.read.macro get

Author
Thread Post new topic Reply to topic
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 23 May 2007, 18:44
the following macro is causing the above error:

macro getChar
{
push stream.stdin
call text.read.char
jc fasmError
}

text.read.dec2d will work fine

thanks for any help,
bob k.
Post 23 May 2007, 18:44
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 May 2007, 21:44
it's bug in stream.readchar (that is used by text.read.char). thank you.

i'm uploading fixed version (0.5.1) right now
Post 23 May 2007, 21:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 23 May 2007, 22:05
thank you vid.
Post 23 May 2007, 22:05
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 May 2007, 22:57
it's up: http://fasmlib.x86asm.net/fasmlib-0.5.1.zip

sorry for delay in FASMLIB development, i'm really busy with other things, and before i continue FASMLIB i must finish tool that i will use for FASMLIB documentation.
Post 23 May 2007, 22:57
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 12:34
vid,

i'm sorry to bother you with this but i'm getting the same error. i've deleted the old 0.5.0 files and installed the 0.5.1 files.

i'm running:
windows xp pro
amd athlon 64 processor 2.41ghz
Post 24 May 2007, 12:34
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 May 2007, 13:09
you're not bothering me, if it's a bug then you are doing me a fover.

but are you sure you are not messing anything? For me it worked after i fixed it. Maybe you are still using old version?

To make sure, go to fasmlib sources, file "src/stream.inc", there find procedure "proc stream.readchar", and check this line:
Code:
libcall stream.read, [stream], eax, 1    


If you see following, then you are still using 0.5.0:
Code:
libcall stream.read, eax, 1    


If you are sure you are using 0.5.1, post your code.
Post 24 May 2007, 13:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 13:17
i deleted and re-installed 0.5.1, and i'm getting the same error. here's stream.readchar

proc stream.readchar stream
local buf rb 1
lea eax, [buf]
libcall stream.read, [stream], eax, 1
jc .r
jo .r
mov al, byte [buf]
clc
.r: ret
endp
Post 24 May 2007, 13:17
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 May 2007, 13:55
please either post your source, compiled application with int3 right before call that fails. I will look into it
Post 24 May 2007, 13:55
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 14:04
source attached. i'm new to assembly programming, so you'll see a number of tests.


Description:
Download
Filename: k2-m.asm
Filesize: 1.97 KB
Downloaded: 637 Time(s)

Post 24 May 2007, 14:04
View user's profile Send private message Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 14:06
uhhh... sorry about the attachment. here's the source:

Code:
format PE console

include 'include/win32ax.inc'

SYSTEM equ win32

include 'include/fasmlib/include/fasm/fasmlib-src.inc'
;include 'k2-mMacros.inc'

TEXT_SIZE = 1024

macro abort xString
{
  error xstring
}

macro emit xString
{
 push    xString
     push    stream.stdout
       call    text.write
  jc              fasmError
}

macro emitLn xString
{
   emit xString
}

macro error xString
{
 emitLn xString
}

macro expected xString
{

}

macro expression
{

}

macro getChar
{
       push    stream.read
 call    text.read.char
      jc              fasmError
}

macro getLine
{
  push    TEXT_SIZE
   push    text
        push    stream.stdin
        call    text.read.line
      jc              fasmError
}

macro getName
{

}

macro getNum char
{

}

macro init
{

}

macro initialize
{
       call    mem.init
    jc              fasmError
   call    stream.init
 jc              fasmError
}

macro isAlpha char
{

}

macro isDigit char
{

}

macro lookAhead char
{
}

macro match xString
{

}

macro prompt xString
{
    push    xString
     push    stream.stdout
       call    text.write
}

.data
   _error  db 'fasm error: ',0
   _prompt db 'k2-m> ',0
  _text   db 'After str.ins and str.cat: ',0
    _text2  db '(a)',0
        _text3  db '(i)',0
        z               db 'i',0
  IncludeIData
        IncludeUData
        
    text    rb      TEXT_SIZE
   
    
.code
   
start:
      ; initialize modules 'mem' and 'stream'
 initialize

      prompt _prompt
      ; get line of text
  
    getChar


     getLine
     ; display line of text
      emit text


   ; unititialize modules in 'reverse' order
 call    stream.uninit
       jc              fasmError
   call    mem.uninit
  jc              fasmError

       ; exit without fasmError
    push    0
   call    process.exit


.end start




fasmError:
; eax holds fasmError code
; ebx = text of fasmError code in eax
push     eax
call     err.text
mov         ebx,eax

; display 'Error: '
push        _error
push  stream.stderr
call   text.write

; display fasmError message
push   ebx
push     stream.stderr
call   text.write

; unitialize modules
call  stream.uninit
call   mem.uninit

; exit with code '1'
push        1
call       process.exit    
Post 24 May 2007, 14:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 May 2007, 14:32
next time use [ code ] tags around to code Wink

going to look into it
Post 24 May 2007, 14:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 14:36
i was wondering how to do that: [ code ]
thanks.
Post 24 May 2007, 14:36
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 May 2007, 14:36
your code pushes stream.read instead of stream.stdin

But your first post said it pushes proper stream.stdin so you helped me find bug by mistake Wink
Post 24 May 2007, 14:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 24 May 2007, 14:40
uhhh. i forgot i had changed it (trying different ways). it's working now.

thank you vid!
Post 24 May 2007, 14:40
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.