flat assembler
Message board for the users of flat assembler.
Index
> Linux > 64-bit Numeric Recognition |
Author |
|
LocoDelAssembly 01 Jul 2010, 04:47
In a quick look I see you are "reading" the values with "mov r14, Answers", it should actually be "mov r14, [Answers]" (i.e. compare the contents of Answers, not the pointer).
The comparison still is not good, a character takes one byte (or two but I believe these C functions return 8-bit chars), so you should either load [Answers] in a byte register or just doing the comparison directly (cmp byte[Answers], '1'). You have not provided the format string, in case it wasn't %c but %d instead then you should use a dword register or use "cmp dword[Answers], 1". About the extra info if possible please provide a compilable code so we can better assist you in the solution instead of providing you best guesses. Please always do this! |
|||
01 Jul 2010, 04:47 |
|
donn 28 Jul 2010, 21:56
Hey, yeah the contents [answers] works. Here's what I used for the compare section, from your advice, :
Code: cmp byte[Answers], 1 je SectionA1 cmp byte[Answers], 2 je SectionA2 The application works fine, you helped a ton! That's my first application I wrote, all the information you provided made it work very quickly. A huge help. I have it attached in 32 and 64 bit versions. I have 64bit machine but 32 works, not sure if it works on 32 machine. Any idea of how to get it to run on Windows? There a win32 argument for fasm and gcc? I couldnt find one. So here it is, its a text game for console. Hm, can't load the executable from this mac as attachment, just the .asm's. Have a good one, Denat
|
|||||||||||||||||||||
28 Jul 2010, 21:56 |
|
LocoDelAssembly 29 Jul 2010, 06:56
denat, I couldn't test it here yet but seems well done. The only problem I see is that you forgot to add to ESP as much arguments as you pushed multiplied by 4. (This is for the 32-bit version only)
To improve this program I suggest you to build some data structure to hold all the messages and then walk the structure according to user's answers. I haven't checked very carefully but it looks that there are no cycles so a binary tree seems appropriate for this program. As for Windows, you better check the Windows forum for examples using msvcrt. In Windows is much easier to get executables as fasm can produce them straight. Well, with the latest extensions to fasm you can actually make ELF executables that links to shared objects, but it is still not as easy as with the Windows package with its macros. If you want the linker way, you have to use "format MS COFF" and download the LIBs and linker from somewhere. |
|||
29 Jul 2010, 06:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.