This will go over the header (HED) command and how to use it with JMP (and by extension BNE and BEQ).
Defining
To define a header use a command like:
HED,00000000
which will define a header in memory at HED space + the argument (00000000 in this example).
Headers must always have an argument that is a multiple of 2, as they take up 2 bytes in memory. For example
HED,00000001
is not a valid header, as it will overwrite the second byte of any HED,00000000 you have.
You can have 128 (256 if you can figure out using 1 byte per) headers, so knock yourself out.
You can now also just use names, but it is subject to the same rules of only having 128. This works like
HED,name
or
JMH,name
but a header can NEVER have the same name as a variable.
Hey, update on this rule!
I've tested with over 1000 headers and they like all worked fine.
No clue what's happening, the ram viewer doesn't show any difference besides program size, but everything works.
My system has become greater than me.
Anyways, just try not to use more than 256 of em or you might over-write your program code (or the headers if you request inputs).
¯\_(ツ)_/¯
Jumping
To jump to a header you will use a command such as:
JMH,00000000
which would jump to header 00000000
or HNE,00000000
which is BNE but it would go to header 00000000
You could also use:
JMP,$(header number + header position in ram)
For example you could JMP to HED 00000100 by doing something like:
JMP,$0000010110000100
or
BEQ $0000010110000100.
All of this jumping logic works for any branching command (as of writing JMP, BNE, and BEQ, which can be used for headers as JMH HNE and HEQ).