flat assembler
Message board for the users of flat assembler.

Index > Windows > The returned parameter is an array

Author
Thread Post new topic Reply to topic
3371574870



Joined: 15 Sep 2020
Posts: 5
Location: null
3371574870
Smile
I called a function of an external DLL and it returned an array of parameters
The returned parameters are stored in an eax register
I don’t know how to extract an element of the array from eax
The returned eax is like this:

eax='1|249|5|23|21'

Are 5 elements separated by ‘|’

As a novice, I would like to ask for help, thank you very much for that!


Description: include 'include\win32ax.inc'
Download
Filename: Fasm.zip
Filesize: 360.19 KB
Downloaded: 18 Time(s)


_________________
Suddenly fell in love with fasm
Post 15 Sep 2020, 16:57
View user's profile Send private message Reply with quote
3371574870



Joined: 15 Sep 2020
Posts: 5
Location: null
3371574870
Post 15 Sep 2020, 18:59
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
Code:
        xchg esi,eax
_scan:  mov edx,esi     ; save start address of number
_more:  lodsb
        test al,al
        jz number_end
        cmp al,"|"
        jnz _more
number_end:

        ; < process number  starting at EDX>

        cmp byte[esi-1],0
        jnz scan    
...is a possiblity.

What to do with number though? ...and why program in x86?

_________________
¯\(°_o)/¯ unlicense.org
Post 15 Sep 2020, 20:12
View user's profile Send private message Visit poster's website Reply with quote
3371574870



Joined: 15 Sep 2020
Posts: 5
Location: null
3371574870
This is an unfinished code
I don’t know if this idea is feasible
I want to use registers to achieve all without memory access

mov edi,eax
mov al,'|'
repne scasb
invoke msg,0,edi,0,0
Post 15 Sep 2020, 23:51
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
3371574870 wrote:
I want to use registers to achieve all without memory access
Code:
    mov edi,eax
    mov esi,eax ; start of string
       mov al,'|'
       repne scasb
       mov byte [edi-1],0 ; null terminate
       invoke msg,0,esi,0,0    
The above should work.
SCASB is memory access. Confused

_________________
¯\(°_o)/¯ unlicense.org
Post 16 Sep 2020, 05:07
View user's profile Send private message Visit poster's website Reply with quote
3371574870



Joined: 15 Sep 2020
Posts: 5
Location: null
3371574870
Thank you for your answer. You made me discover the fun of fasm
Post 16 Sep 2020, 11:38
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.