flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 12 Jan 2013, 22:44
The reason you can't forward reference to future output is because the output does not yet exist when the load/store is encountered.
How would this work? Code: org 0 store byte 0xff at 1 dw 0 ;what value is stored here? |
|||
![]() |
|
HaHaAnonymous 12 Jan 2013, 23:36
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:02; edited 1 time in total |
|||
![]() |
|
shutdownall 13 Jan 2013, 00:17
revolution wrote: The reason you can't forward reference to future output is because the output does not yet exist when the load/store is encountered. It would work the same way like forward reference of labels is resolved. In the first pass byte at position 1 does not exist and can not be written. This is the same condition when we reference a label which is not yet defined. So the usual way to resolve is to do an additional pass and in the second pass the byte at position 1 is defined through the first pass and could be overwritten. And of course a store reference has a higher priority than a simple data definition. I think I did describe exactly what I want in my first post. ![]() |
|||
![]() |
|
revolution 13 Jan 2013, 06:47
Such a scheme would entail delaying the processing of all load/store commands until assembly has finished. I guess it might be possible but it seems like too much effort to solve a problem that would be better solved by another means.
|
|||
![]() |
|
shutdownall 13 Jan 2013, 22:12
Yes you maybe right, but it would be a nice feature, wouldn't it ?
![]() |
|||
![]() |
|
HaHaAnonymous 13 Jan 2013, 22:28
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:01; edited 1 time in total |
|||
![]() |
|
l_inc 15 Jan 2013, 16:29
shutdownall
Quote: It would work the same way like forward reference of labels is resolved. Bad analogy. Labels cannot be redefined. Load/store forward referencing is not possible for the same reason, that does not allow redefined numeric constants to be forward referenced. If you do a store, it's already a redefinition of what was stored before. The revolution's example may be not that clearly emphasizes the problem. Look at this example: Code: org 0 store byte 1 at 0 load x byte from 0 store byte 2 at 0 db 0 What value should have x? Is that what we stored with the first store? Is that what should be resolved after the final pass? What number of passes do we need to resolve the following? Code: org 0 load x byte from 0 x = x + 1 store byte x at 0 db 0 |
|||
![]() |
|
shutdownall 15 Jan 2013, 19:50
Bad example.
It depends on what you do and what you want. As I pointed out I want to read only data and modify other data depending on it's content. There can be always situations that can't be resolved regardless of using load / store or not. What do you say to following code in an assembly section: Is the redefinition of assembler time variables not allowed because it could be used in a bad way ? Code: var1=var2+1 var2=var1 Or next example with labels: Code: label1: db label2+1 dup(0) label2: How many passes does it need ? So I can accept that some functions not realized because they are not needed or planned that way but the reason of disabling features only because they could be missused or missinterpreted are not acceptable for me. ![]() |
|||
![]() |
|
l_inc 16 Jan 2013, 09:34
shutdownall
Quote: Bad example. Obviously you didn't understand the examples. If the second example would backward reference the data, it would be a valid and quite common construction. By allowing load/store forward referencing you change the semantics of the load/store, which would also affect backward referencing. Thus your idea would break much more useful things, than it would allow to do. Quote: Is the redefinition of assembler time variables not allowed because it could be used in a bad way ? None of these examples shows redefinition. In fact, if you tried to use redefinition, you wouldn't be able to forward-reference. As I already said the same situation occurs with forward-storing, cause storing is by definition a redefinition. Quote: but the reason of disabling features only because they could be missused or missinterpreted are not acceptable for me The reasoning behind not enabling load/store forward referencing is not just because it can be misused. Actually only rare cases exist, when it's possible to not misuse it. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.