-
Notifications
You must be signed in to change notification settings - Fork 7
ASSEMBLER
This is an concise overview. The assembler is meticulously documented in its chapter in the ciforth documentation. It is in no way dependant on a particular version.
The assembler that is available in forth.lab supports all instructions of the Pentium I. It is based on the postit-fixup principle explained in the ciasdis package and it is compatible with it. However while ciasdis makes it impossible to assemble a wrong instruction, the assembler built in into ciforth has no error detection, basically anything goes. This is no problem if the goal is to run assembler code that has previously been tested by ciasdis.
An assembler instruction goes through three stages:
- the opcode, which moves HERE
- fixups, they fill in fields in the opcode so beneath HERE
- commaers, (zero, one or more), data that is added, immediate or addresses. Unless absent, it moves HERE.
Add the assembler by "ASSEMBLERi86" WANTED and see an example with ASSEMBLERi86 LOCATE TEST-NEXT
The assembler can be loaded "high" by WANT ASSEMBLERi86-HIGH This is a somewhat dangerous manipulation that loads the assembler in uncharted dictionary space. It uses the SWAP-DP TRIM mechanism. After using the assembler, e.g. to load the floating package, you're supposed to immediately TRIM it. The result is that the ASSEMBLER namespace still exists, but is empty.
Usability for 64 bits
Surprisingly the assembler is largely usable for 64 bits code. In particular except for one screen each for 32 and 64 bits that handle integer conversions, the whole floating point package is valid for both sizes. This package is based on the 8087 instructions and has a stack depth limited to 8.