flat assembler
Message board for the users of flat assembler.

Index > Main > 2013-Oct - flat assembler 1.71.14

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 13 Jun 2015, 11:47
I've hit some issues with postpone that may not be immediately clear at a quick glance; hopefully this will save someone some time one day Razz. The first is passing ".labels" can be disassociated with its [intended] parent "label:" unless fully qualified to begin with. (side note: this is a useful feature to track the last occurrence of a block with a ".property" when playing with interleaved blocks)
Code:
macro do_thing x
{
        postpone
        \{
        db x
        \}
}
labelA:
.thing:
do_thing .thing ; this will actually be labelB.thing unless fully qualified to labelA.thing
db 0
labelB:
.thing:
db 0    
The second is that when using org things also go wrong. Here the only workaround I've found is to revert to the "old" way of performing do_thing after _end without postpone (incidentally this can be done with yet more postpone without changing the macro Very Happy).
Code:
macro do_thing s,e,d
{
        postpone
        \{
        local b
        local x

        x = $FF
        repeat (e-s)
                load b byte from s+(%-1)
                x = x xor b
        end repeat
        store byte x at d
        \}
}
_start:
xor ax,ax
mov al,0
.here:
do_thing _start,_end,_start.here-1
not ax
ret
_end:
;;postpone { ; this works around the org issue
;org $100 ; this causes a problem
fn:
inc eax
ret
;;} ; this works around the org issue    
Post 13 Jun 2015, 11:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20450
Location: In your JS exploiting you and your system
revolution 13 Jun 2015, 12:25
The issue with org is the address space difference. I expect you can attach an address space label there also (untested):
Code:
my_address_space::
do_thing my_address_space:_start,my_address_space:_end,my_address_space:_start.here-1    
Post 13 Jun 2015, 12:25
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 13 Jun 2015, 12:51
revolution wrote:
The issue with org is the address space difference. I expect you can attach an address space label there also (untested):
Code:
my_address_space::
do_thing my_address_space:_start,my_address_space:_end,my_address_space:_start.here-1    
Nailed it, thank you revolution Cool I had tried something similar but not with both the address space and start/end labels with the fully-fully qualified path (I've also fixed a load = vs eq issues that got exposed by this too which probably weren't helping). Even better is this fixes my real code which stored the result in the current address space but processed the other address space (this was impossible to resolve with the hack in my previous post).
Post 13 Jun 2015, 12:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.