The only additional instructions are: / and /+
They are used to align tables or set them to specific locations in the binary code string
Simple examples:
jmp long ok
o2 /0c
.ok
ret
produces:
0000: e9 07 00 00 00
0002: 00 00 00 00 00 00 00
000C: c3
jmp long ok
o2 /+4
.ok
ret
produces
0000: e9 03 00 00 00
0005: 00 00 00
0008: c3
you can see how this is applied in the import section of an EXE.
There is some fiddly pointering going on here, but the tables can be kept aligned to the correct boundaries.
ga produces the 4 byte offset for a specified label. (start of code string=0)
[code=thinbasic]
; IMPORT DIRECTORY ENTRY RECORD
; -----------------------------
/+1000
.imports
ga name_list ; 00001C00 dw RVA Function Name List 0000C040
hl00000000 ; 00001C04 dw Useless 1 00000000
hl00000000 ; 00001C08 dw Useless 2 00000000
ga module_name ; 00001C0C dw RVA Module Name 0000C244
ga proc_address_list ; 00001C10 dw RVA Function Address List 0000C0A8
; Function List (declare_order and name)
; ---------------------------------------
; 00001CB0 0000C0A0 0001 FreeLibrary
; 00001CBC 0000C0A4 0002 GetProcAddress
; 00001CC0 0000C0A8 0003 LoadLibraryA
/+4
.proc_address_list
ga FreeLibrary
ga GetProcAddress
ga LoadLibraryA
/+4
.module_name `KERNEL32.DLL` 00 00
/+4
.name_list
/+4 .FreeLibrary hw0001 `FreeLibrary` 00 00
/+4 .GetProcAddress hw0002 `GetProcAddress` 00 00
/+4 .LoadLibraryA hw0003 `LoadLibraryA` 00 00
[/code]
Bookmarks