flat assembler
Message board for the users of flat assembler.

Index > Linux > Getting String Length from Scas

Author
Thread Post new topic Reply to topic
donn



Joined: 05 Mar 2010
Posts: 315
donn 05 Dec 2010, 01:49
Hi just wondering how to be able to print a strings length to a console. Using scas and printf. I was able to print immediate values, but having a little difficulty passing rcx(?)'s value to printf. I attached some code that prints a value of '6293840'' to the screen. I tried setting up the trailing zero but this string length number is getting all garbled. Just trying to get familiar with using scas.

Ok everyone,
Denat


Description:
Download
Filename: Scas.asm
Filesize: 898 Bytes
Downloaded: 350 Time(s)

Post 05 Dec 2010, 01:49
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 214
Location: Budapest, Hungary
Endre 07 Dec 2010, 18:49
There are multiple errors in your code, somewhere even the comment is wrong, but your main problem is that before calling to printf you load the address of 'Result' and not its content in esi (you know the rule: 'pass by value').
Post 07 Dec 2010, 18:49
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 315
donn 10 Jan 2011, 22:59
Hi, I dont know at all if this is the file I was editing before (the newest version), but I definitely got some results I was hoping for. This file may not be up to date, but I attached some file that I think got it to work, according to what you pointed out. Have to pass rsi the address.. I havent gotten that rule completely figured out yet...

Thanks a lot,
Denat

[Solved]


Description:
Download
Filename: Scas.asm
Filesize: 1.05 KB
Downloaded: 382 Time(s)

Post 10 Jan 2011, 22:59
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.