flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 30 Jul 2023, 22:18
bitRAKE wrote: My present work-around is to examine $%% Code: FIX_BUG := 0 USE_CALM := 0 virtual at Reserved.BASE Reserved:: if FIX_BUG db -1 end if end virtual Reserved.BASE: virtual Reserved rb 16 ; bug only happens when the whole area is uninitialized end virtual if USE_CALM contents AreaContent Reserved else load contents:sizeof Reserved from Reserved:Reserved.BASE end if db contents calminstruction(target) AreaContent? area* local string load string, area: 0, sizeof area publish target, string end calminstruction |
|||
![]() |
|
Tomasz Grysztar 31 Jul 2023, 06:29
Loading the uninitialized portion was not supposed to be correct, I think it's missing an error message in the partially-initialized case.
|
|||
![]() |
|
bitRAKE 31 Jul 2023, 07:16
So, the intended workflow would be to create an extra initialized byte at end of area, then load the area except that byte?
|
|||
![]() |
|
Tomasz Grysztar 31 Jul 2023, 09:45
Or you can store 0 into the last uninitialized byte, it initializes the whole block then.
|
|||
![]() |
|
bitRAKE 31 Jul 2023, 13:42
Is there a way to know when an area has trailing undefined space?
I get the concept that this trailing data is undefined. Yet, it seems like it's protecting a corner case? Code: virtual at _Data.BASE _Data:: db 0 db ? db 1 db ? end virtual _Data.BASE: load contents:1 from _Data:_Data.BASE + 0 db contents load contents:1 from _Data:_Data.BASE + 1 db contents load contents:1 from _Data:_Data.BASE + 2 db contents load contents:1 from _Data:_Data.BASE + 3 db contents In my particular case I can't know if trailing uninitialized space exists or not. For example, struct. Writing an extra byte is fine. Code: ; add a defined byte to force trailing undefined data to zeroes calminstruction(target) AreaContent? area* local string, line arrange line, =virtual area assemble line arrange line, =db -1 assemble line arrange line, =end =virtual assemble line load string, area: 0, sizeof area - 1 publish target, string end calminstruction I do like that I can read an empty area and output nothing. It makes empty abstractions collapse without additional bookkeeping. |
|||
![]() |
|
Tomasz Grysztar 31 Jul 2023, 14:02
Check the $@ symbol.
|
|||
![]() |
|
bitRAKE 31 Jul 2023, 19:16
Thank you, that is exactly what I was missing.
Code: struc (contents) AreaContent area* virtual area if $@ = $ load contents.db:$-$$ from area:$$ contents.rb = 0 else load contents.db:$@-$$ from area:$$ contents.rb = $-$@ end if end virtual end struc ![]() (I'm going to blame the heat on this one - damn, it's been hot here.) I did create a markdown version of the manual. Easier to read on mobile and click-copy code fragments. |
|||
![]() |
|
Tomasz Grysztar 02 Aug 2023, 10:51
After re-examining this bug I realized you were right, this should be the other way around (to not signal an error in either case). Some of my own sources were relying on the ability to load the contents of partially initialized section.
And the fix appears very simple then. I hope this sorts it out. |
|||
![]() |
|
bitRAKE 02 Aug 2023, 18:04
Many perspectives seem valid to me - viewing the virtual as just another output stream (reusing the same logic) -- all the way to -- having virtual as completely different type. I can even imagine a version without a default output stream, but I know you are on a migration path and not wandering around like a vagrant.
I'd like to try spending a whole day just using particular features - I think that would be challenging, but at the same time would force me to open my mind to possibilities that might not appear in the normal course of work. Of, course it's the wrong way. Just a little amusement. (Of course, I've done a little of that already. ![]() Thank you. |
|||
![]() |
|
Tomasz Grysztar 02 Aug 2023, 20:57
Something similar I attempted is to implement as many as possible of fasmg's built-in directives in form of CALM instructions. A large portion of the language can be re-created this way already, so it's conceivable that a simpler core reduced to CALM functionalities could be enough to construct a fasmg-compatible assembler with set of headers just like I've done it for fasm 1 compatibility. But I don't pursue the idea seriously, it's not really justifiable, just a fun thought experiment.
|
|||
![]() |
|
Tomasz Grysztar 03 Aug 2023, 08:28
...although removing x86-centric data directives and size constants from the core could be a reasonable thing to do. They are easy to reconstruct with CALM now.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.