flat assembler
Message board for the users of flat assembler.
Index
> Windows > File as DB sequence |
Author |
|
Tomasz Grysztar 05 May 2018, 14:01
The simplest method is to use FILE directive:
Code: my_file FILE 'name.ext' But if for some reason you need to have your entire source in text form, you can also use fasm to convert any binary file into DB definitions: Code: BYTES_PER_LINE = 16 virtual at 0 buffer:: file 'name.ext' size = $ end virtual repeat size if (%-1) mod BYTES_PER_LINE = 0 if %-1 > 0 db 13,10 end if db 'DB ' else db ',' end if load a byte from buffer:%-1 h = a shr 4 l = a and 0Fh if h >= 10 db '0', 'A' + h - 10 else db '0' + h end if if l >= 10 db 'A' + l - 10 else db '0' + l end if db 'h' end repeat |
|||
05 May 2018, 14:01 |
|
NEASM 05 May 2018, 22:08
Thanks, Grysztar. I really appreciate your hard work to create a fast, portable and multiplatform assembler. And I have to say, the job succeeded perfectly. In fact, FASM is one of the best assemblers that exist. And, as icing on the cake, one of the best forums there are. Brilliant, and thank you very much for your reply.
|
|||
05 May 2018, 22:08 |
|
rugxulo 05 May 2018, 22:38
Just FYI, I think the tool frequently used for this kind of thing is od (octal dump) although that has somewhat been supplanted in recent OSes with hexdump (and its alias "hd", which IIRC is same as "hexdump -C"). IIRC, for hex output you can use "od -v -Ax -tx1".
Oh, and just to keep barely on-topic, Brian Raiter rewrote hexdump in NASM assembly for Linux (202 bytes!). |
|||
05 May 2018, 22:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.