flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
crc 06 Jul 2004, 10:53
Raw binary doesn't use sections, but other than that the following code compiles under the latest version of FASM. I haven't done a disassemble, but it should be ok:
Code: format binary ptrMMX64 equ [ebp-4] ptrMC equ [ebp-8] Use32 ; Get absolute address ; to mcode buffer in VB Call BufferADDR sub eax,5 ; --- jmp GETOUT ; --- ; GETOUT: emms pop ebx pop esi pop edi mov esp,ebp pop ebp ret 16 ; ===================== ; Get mcode buffer ; absolute start address BufferADDR: pop eax push eax RET ;=========================== ReadMMX64: mov edi,ptrMMX64 ;; ;; RET PADDB_Demo: ret ; Added since this is not defined elsewhere PADDW_Demo: ret ; As above ;NASM FASM ; Jump table Sub0 dd PADDB_Demo Sub1 dd PADDW_Demo Use format binary to tell FASM to produce raw binary with no headers. |
|||
![]() |
|
Robert Rayment 06 Jul 2004, 11:22
Many thanks crc
I successfully converted a NASM asm file to FASM asm & com file and, though the code was slightly different to NASM bin file, it ran with the particular VB prog just fine. Previously I had converted from A386 to NASM and had the same problem in finding the correct syntax - sorted out by trial & error! So now you've given me quick start - thanks again. |
|||
![]() |
|
Madis731 06 Jul 2004, 11:25
Did you find out the differences? There shouldn't be any (maybe only
from size optimizations) because FASM doesn't change your typed code. Does NASM optimize code? |
|||
![]() |
|
Robert Rayment 06 Jul 2004, 12:09
To Madis731
Example of difference between NASM & FASM binary files Comparing raw binary files:- The NASM bin file is 1444 B starting: E8 43 00 00 00 2D 05 00 00 00 55 The FASM com file is 1435 B starting: E8 3C 00 00 00 83 E8 05 55 Now I have a List file for NASM showing addr offsets; hexbytes: mnemonics But I don't know if FASM can produce such a List file. The NASM List files starts:- 17 00000000 E843000000 Call BufferADDR 18 00000005 2D05000000 sub eax,5 19 20 0000000A 55 push ebp So, not looked into it, but presumably E8 43 equiv E8 3C and 2D 05 equiv 83 E8 Possibly long & short ways of calc offsets and size of immediate number. |
|||
![]() |
|
Madis731 06 Jul 2004, 14:07
Well, the things are as I suspected. FASM code is
size optimized and NASM isn't: Code: 17 00000000 E843000000 Call BufferADDR 18 00000005 2D05000000 sub eax,dword 5 19 0000000A 55 push ebp <= as you can see, there are 3 useless bytes after 5 Code: 17 00000000 E83C000000 Call BufferADDR ;Obviously the location of the call changes with code 18 00000005 83E805 sub eax,byte 5 19 00000008 55 push ebp That explains why FASM is shorter: it uses shorter forms where possible[/code] |
|||
![]() |
|
Chewy509 25 Jul 2004, 08:59
The biggest difference that I found between NASM and FASM where local labels and size overrides...
In NASM the following local label is allowed, but in FASM is not: Code: label: mov eax, 02 .1 nop jmp .1 but in FASM you need: Code: label: mov eax, 02 .p1: nop jmp .p1 (Notice the letter, as this is needed as FASM will interept .1 as 0.1, and additional the colon) The other difference, was that if a variable was defined as a word, FASM would complain if you tried to access it as a byte, without a size override. (The same applies for other sizes as well, eg myvar dd 0, and accessed as a word, etc). Other than that, no differences. |
|||
![]() |
|
vid 25 Jul 2004, 12:52
Quote: (Notice the letter, as this is needed as FASM will interept .1 as 0.1, and additional the colon) Incomplete floating point numbers should be disallowed since version 1.53. It was causing problems when it was argument of structure. |
|||
![]() |
|
scientica 28 Jul 2004, 12:42
yup, iirc and it was names like ".f" and ".e" that cuased some trouble too.
|
|||
![]() |
|
vid 28 Jul 2004, 19:05
yes, i remember that (i was sending big report about this like probably many others)
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.