flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 15 Apr 2025, 15:15
The postpone is compiled within the last section of the code But the target_label is in the first section.
load and store can't access bytes in another section. BTW: I turned off smileys in the post to avoid the corruption of the code. |
|||
![]() |
|
macomics 15 Apr 2025, 15:21
Thanks
Code: format PE64 GUI 6.0 section '.data' data readable writeable virtual at 0 target_data_buffer:: end virtual target_label: db target_data_size dup 0xFF macro display_hex@digit digit { if (digit) and 15 < 10 display (digit) and 15 + '0' else display (digit) and 15 - 10 + 'A' end if } macro display_hex [val] { forward match v=:h, val \{ rept h n:1 \\{ display_hex@digit (v) shr (4 * ( h - n )) \\} \} display ' ' } postpone { virtual target_data_buffer db 'Some text strings', 0 target_data_size = $ - $$ end virtual repeat target_data_size load a byte from target_data_buffer Code: $ fasm MAIN.ASM flat assembler version 1.73.32 (16384 kilobytes memory, x64) 00401000 53 S 00401001 6F o 00401002 6D m 00401003 65 e 00401004 20 00401005 74 t 00401006 65 e 00401007 78 x 00401008 74 t 00401009 20 0040100A 73 s 0040100B 74 t 0040100C 72 r 0040100D 69 i 0040100E 6E n 0040100F 67 g 00401010 73 s 00401011 00 MAIN.ASM [30]: MAIN.ASM [23] postpone [8]: store byte a at target_label + % - 1 processed: store byte a at target_label+%-1 error: value out of range. That's what confused me a bit. It's strange that he typed everything and got an error. If the error had appeared after the first iteration, then everything would have been much clearer. Last edited by macomics on 15 Apr 2025, 15:24; edited 1 time in total |
|||
![]() |
|
revolution 15 Apr 2025, 15:23
Simplified code:
Code: format PE64 GUI 6.0 section '.data' data readable writeable v: db 0 load a byte from v ; okay section '.text' code readable executable load b byte from v ; fails |
|||
![]() |
|
macomics 15 Apr 2025, 15:35
Then it might be worth replacing the error message in this case with "Outside the section". Just thinking out loud. I'll think about such a patch.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.