doc/asm: add note about ad-hoc assembly frequent mistakes

This commit is contained in:
Virgil Dupras 2021-01-03 13:55:28 -05:00
parent a9cb5a42d4
commit 772c0c4fe4

View File

@ -45,6 +45,20 @@ To avoid using dict memory in compilation targets, we
pre-declare label variables here, which means we have a limited pre-declare label variables here, which means we have a limited
number of it. We have 4: L1, L2, L3, L4. number of it. We have 4: L1, L2, L3, L4.
# Ad-hoc assembly
A frequent usage of the assembler is to cross-assemble a new
Collapse OS binary. However, it can also be used to assemble
code for immediate usage on the machine that assemble.
A frequent mistake when doing so is to forget to set BIN( and
ORG. BIN( must match your system's binary offset (you get get
it with "0 BIN+") even for the most simple of code because
otherwise, ";CODE" will jump to the wrong offset.
ORG is less critical, but can lead to problems if not set, so
you should take the habit of setting it with "H@ ORG !".
# Flow # Flow
There are 2 label types: backward and forward. For each type, There are 2 label types: backward and forward. For each type,