Previous: 2.3.7. Opcodes To the Table of Contents Next: 2.3.9. Opcode Mnemonics
2.3.7. Opcodes Table of Contents 2.3.9. Opcode Mnemonics

- 2.3.8. -
Table of Contents
2. TMT Pascal Language Description
2.3. Built-in Assembler
2.3.8. Registers


2.3.8. Registers


The following registers can appear in built-in assembler:
8-bit:AL BL CL DL AH BH CH DH
16-bit:AX BX CX DX SI DI BP SP
32-bit:EAX EBX ECX EDX ESI EDI EBP ESP
Segment:CS DS ES SS FS GS
8087:ST
Control:CRn
Debug:DRn
Test:TRn
The segment register can be used for segment overrides. 32-bit registers can be used for indexation following the standard 80386 conventions. 16-bit registers should never be used for addressing, unless your entire program does not exceed 64K. Even then,addressing with 16-bit registers is inefficient. Generally, an address is formed as
  Base + Index * Scale + Displacement
where Base is any of the 32-bit registers, Index is any 32-bit register but not ESP, and Scale should be 1,2,4, or 8. Finally, the Displacement is a 32-bit integer quantity.

Here are some valid and invalid indexing modes:
[EAX+EBX]ok
[EAX+EAX]ok, EAX is both base and index.
[ESP]ok, ESP is index, no base.
[EDX*2]ok, use this to index a global array of words.
[EAX*4+EBP]ok, use this to index a local array of longints.
[SI]ok, but is likely to lead to hard-to-find bugs.
[ESI+BX]illegal, mix of 16- and 32- bit registers.
[SI*4]illegal, 16-bit registers cannot be scaled.
[ESP*4]illegal, ESP cannot be an index.
Please consult Intel 80386 programmer's reference for more details.


Previous: 2.3.7. Opcodes To the Table of Contents Next: 2.3.9. Opcode Mnemonics
2.3.7. Opcodes Table of Contents 2.3.9. Opcode Mnemonics

- 2.3.8. -