flat assembler
Message board for the users of flat assembler.
Index
> Main > Change output data (modify MZ stub of PE from source code) |
Author |
|
edemko 09 May 2010, 14:56
store dword 'leo:' at $xxxxxxxx
edit: weird i cannot store to $400'000 |
|||
09 May 2010, 14:56 |
|
Leo_yz 09 May 2010, 15:50
Quote: Both load and store directives are limited to operate on places in current addressing space. The $$ symbol is always equal to the base address of current addressing space, and the $ symbol is the address of current position in that addressing space, therefore these two values define limits of the area, where load and store can operate. |
|||
09 May 2010, 15:50 |
|
edemko 09 May 2010, 19:32
edit
Hope Tomasz will ever fix that. Number display macros you can use to see addresses etc: http://board.flatassembler.net/topic.php?t=11516 Last edited by edemko on 17 May 2010, 12:29; edited 1 time in total |
|||
09 May 2010, 19:32 |
|
LocoDelAssembly 09 May 2010, 19:57
You can't do that*. Also, are you sure you want it at that offset?? Note those are not unused bytes: http://www.delorie.com/djgpp/doc/exe/
*Well you could by using "format binary as 'exe'" and then defining all the MZ and PE structures yourself instead of letting fasm do that for you. Some people posted examples in this forum but I can't find them now... Also, you could use the debugging information and an external tool that search for your label in the .fas file and then patches the executable with the address the file says the label is located at. |
|||
09 May 2010, 19:57 |
|
edemko 09 May 2010, 20:07
...or you are just approaching masm
fasm must go forward he might wants some file stamping or needS to write addr of label to MZ-header.(STUB or somewhere) masm: no provocation - facts |
|||
09 May 2010, 20:07 |
|
DOS386 10 May 2010, 08:09
Quote: I need to write addr of label to "somedata" after MZ-signature - at offset 0x2 of EXE file. How can it be done? Help me please Bad idea. Quote: Some people posted examples in this forum but I can't find them now Can't find the forest anymore because of all the trees http://board.flatassembler.net/topic.php?t=10874 Code: ; *** MZ-Header, stub (0,$60) *** ccstacktop = $1040 ; MZ header $20 ; Program $0040 ; Heap 0 ; Stack $1000 db "MZ" ; Mark's Sigi dw $60 ; Bytes in last block (0 is full, includes header size) dw 1 ; Blocks per 512 Bytes (includes header size) db 0,0 ; No relocs db 2,0 ; Header size dw $1000 ; Min (Heap + Stack) 4 KiB dw $1000 ; Max (Heap + Stack) 4 KiB dw 0 ; Stack segment: SS=CS !!! dw ccstacktop ; Stack size (almost 4 KiB) / pointer in bytes !!! db 0,0,0,0,0,0 ; CHK, IP, CS dw $1C ; Useless reloc offset db 0,0 ; Useless "overlay" db 0,0,0,0 ; Padding / empty reloc ; org = $20 , should be 0 but irrelevant db $0E,$1F ; PUSH CS | POPE DS db $B4,9,$BA,$20,0 ; MOV AH, 9 | MOV DX, $0020 db $CD,$21 ; INT $21 db $B8,1,$4C ; MOV AX, $4C01 db $CD,$21 ; INT $21 db 0,0 ; Wasting 2 bytes ; org = $30 db 0,0,0,0,0,0,0,0,0,0,0,0 ; Wasting 12 bytes db $60,0,0,0 ; PE begins here ; org = $40, should be $20 db "Need HX-DOS Extender to run !",$0D,$0A,$24 ; 29 chars + 3 special ; org = $60, content moved by +$20 bytes ; *** PE-Header ($60,$1 *** db "PE", 0, 0 ; Signature Put it somewhere where I wrote "padding" or "wasting" Quote: edit: weird i cannot store to $400'000 better: $0040'0000 AKA 4 MiB |
|||
10 May 2010, 08:09 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.