flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > CALM load and store |
Author |
|
Tomasz Grysztar 19 Apr 2023, 16:24
fabbel wrote: 1/ what is meant by 'pre-compiled expressions', in the context of load and store CALM instructions 16. Assembly commands in CALM instructions wrote: They perform elementary operations, mostly on a single unit of data, but at the same time they can perform many calculations in-place, because their arguments, with few exceptions, are pre-compiled expressions, similar to the second argument to "compute". Whether you need more information depends on your use patterns and if you are likely to encounter some of the rarer interactions. For example, because the expression is pre-compiled, any references to symbols are frozen in place at the time of definition of CALM instruction. And text replacements (defined with DEFINE or EQU) are not applied when pre-compiling an expression, the expression keeps references to all these symbols and check their values at run-time, when the expression is evaluated. These details do matter only under specific circumstances, though. The manual is organized in such way, that later sections often refer to things specified in the earlier ones, so if you're not reading it all consecutively, you may need to do a lot of jumping back. fabbel wrote: 2/ typ., acceptable syntax for 2nd argument to load (or 1st argument to store), when need to refer to some specific addresss space area (i.e. using :: ...) ? As mentioned in the first paragraph of this section, this set of commands allows each of the arguments to be a freely formed expression, so even though the commands themselves are elementary operations, the arguments are allowed to be complex. You specify everything directly, for example: Code: virtual Some_Area:: db 'ABC' end virtual calminstruction demo local char load char, Some_Area: 0, 1 display char+20h end calminstruction demo ; displays 'a' Code: virtual at 1000h Some_Area:: example db 'ABC' end virtual calminstruction demo address local char load char, Some_Area: address - 1 metadataof Some_Area, 1 display char+20h end calminstruction demo example ; displays 'a' Code: HEADER_LENGTH := 0 calminstruction patch offset*, str* store HEADER_LENGTH+offset, lengthof str, str end calminstruction db "Example text" patch 7+1, "here" Code: calminstruction (target) AreaContent? area* local string load string, area: 0, sizeof area publish target, string end calminstruction text AreaContent Some_Area display text |
|||
19 Apr 2023, 16:24 |
|
Tomasz Grysztar 19 Apr 2023, 16:54
A more complex example from my own testing:
Code: file 'fasmg.exe' macro xorwithkey value* local key virtual key:: db string value end virtual xorout key end macro calminstruction xorout key_area local offset, bytes, key, length compute length, sizeof key_area load key, key_area:0, length compute offset, 0 loop: check offset = $% jyes done check offset + length <= $% jyes xor compute length, $% - offset load key, key_area:0, length xor: load bytes, offset, length store offset, length, bytes xor key compute offset, offset + length jump loop done: end calminstruction xorwithkey 'fasmg' |
|||
19 Apr 2023, 16:54 |
|
fabbel 28 Apr 2023, 00:33
Hi again,
First, thx for prev feedback. Now, another question: is there a load/store syntax to specify access to current virtual area - w/o explicitely naming it ? i.e. typ. : Code: macro test virtual at 0 (...) calm_inx (...) end virtual end macro calminstruction calm_inx local _tmp load _tmp,????,10 ; ??? load 10 bytes from current area ??? end calminstruction How can I direct load (or store) to operate on current area ? I tried: load _tmp,0,10 to load 10 first bytes, but does not seem to work... .. it looks like it is only able to operate on general output, even if calm_inx is enclosed in a virtual block (as in macro above) tx |
|||
28 Apr 2023, 00:33 |
|
Tomasz Grysztar 28 Apr 2023, 05:55
There is no way to access current area without having it labeled. Like most CALM instructions, these variants of LOAD/STORE have streamlined syntax and for anything out of its limited scope they require assistance.
|
|||
28 Apr 2023, 05:55 |
|
fabbel 28 Apr 2023, 08:49
Ok.. not possible by design then. Tx
|
|||
28 Apr 2023, 08:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.