flat assembler
Message board for the users of flat assembler.
Index
> Main > Converting from NASM to FASM, help required! |
Author |
|
dosin 02 Dec 2007, 05:27
A short is a unsigned WORD or SWORD..
near address A memory location specified by the offset from the start of the value in a segment register. A near address requires only 2 bytes. macro getbitM 0 add dx, dx jnz stillbitsleft ;jump if not zero mov dx, [esi] lea esi, [esi + 2] adc dx, dx stillbitsleft: endmacro as for the rest it should be fine- if not look under the macro section.. I don't use macros...I am not sure if the macro getbitM 0 needs to be mod.. |
|||
02 Dec 2007, 05:27 |
|
LocoDelAssembly 02 Dec 2007, 05:30
Code: ; I'm suppossing that the "0" is a typo macro getbitM { ; I'm assuming that a label that starts with %% is local to the macro. ; I added two dots to not affect the scope of possible surrounding labels local ..stillbitsleft add dx, dx jnz short ..stillbitsleft mov dx, [esi] lea esi, [esi + 2] adc dx, dx ..stillbitsleft: } short is to ensure that the offset will be short (1 byte), and near just specifies that the operand is an offset only so there will be no changes at CS register. http://flatassembler.net/docs.php?article=manual#1.2.5 If you know NASM already I suggest reading the fasm manual anyway since the syntax shares some aspects with NASM but is not 100 % compatible. |
|||
02 Dec 2007, 05:30 |
|
SomeoneNew 02 Dec 2007, 05:50
Thanks, I ported the entire code now and it compiles just fine but I don't have a way to try it out.
I have 2 problems 1) I don't know how to use file io in FASM, how can I read the contents of a file to memory and how can I write the contents of a memory area to a file? - I'm under Windows by the way. 2) How can I convert a "flat" source (ie no procedures, just labels) to a routine / proc ? Any procedure examples would be great, I just need to return 1 variable. |
|||
02 Dec 2007, 05:50 |
|
vid 02 Dec 2007, 10:44
Quote: I don't know how to use file io in FASM, how can I read the contents of a file to memory and how can I write the contents of a memory area to a file? - I'm under Windows by the way. many ways: Win32API - CreateFile(), ReadFile(), WriteFile() libc (msvcrt.dll) - fopen(), fread(), fwrite() FASMLIB Quote: How can I convert a "flat" source (ie no procedures, just labels) to a routine / proc ? best way is with "proc" macro - review FASM documentation of win32 headers (click "documentation" on FASM site) |
|||
02 Dec 2007, 10:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.