- This article is not detailed enough and needs to be expanded. Please help us by .
Hex2 is the most complex hex based language you probably would ever want to make and is the final logical conclusion of the hex0/hex1 series of languages. Extending to support multiple pointer sizes and formats as well as alignment and word oriented features and removing the single character label restriction of hex1 and enabled long label names
The prefixes for the pointers are standardized as:
- ! - 8 bit relative address
- @ - 16 bit relative address
- % - 32 bit relative address
- ~ - architecture specific relative (usually 24bits)
- $ - 16 bit absolute address
- & - 32 bit absolute address
Some exotic architectures with alignment and other messy details include:
- < pad to alignment
- . insert to word
- ^ word aligned calculation
# ;; Set p->Next = p->Next->Next->Next 18020000 # LOAD32 R0 R2 0 ; Get Next->Next->Next 23010000 # STORE32 R0 R1 0 ; Set Next = Next->Next->Next :Identify_Macros_1 18010000 # LOAD32 R0 R1 0 ; Get node->next A0300000 # CMPSKIPI.NE R0 0 ; If node->next is NULL 3C00 @Identify_Macros_Done # JUMP @Identify_Macros_Done ; Be done # ;; Otherwise keep looping 3C00 @Identify_Macros_0 # JUMP @Identify_Macros_0 :Identify_Macros_Done # ;; Restore registers 0902803F # POPR R3 R15 0902802F # POPR R2 R15 0902801F # POPR R1 R15 0902800F # POPR R0 R15 0D01001F # RET R15 :Identify_Macros_string 444546494E450000 # "DEFINE"
Example of .hex2 code from M0