neilobremski
Experienced Member
It's possible to override the implied segment of an instruction with a prefix. I was trying to figure out how to do this in DEBUG [SUP][1][/SUP], specifically to copy the byte at ES:[DI] into AL. I couldn't figure out the correct syntax and the MSDN reference was not helping. I finally just looked up the machine code of such a prefix (26h) and then looked at what DEBUG disassembled it as:
To actually use this in the DEBUG assembler, you can write:
You'll notice this is somewhat different than the ability to write the following (which doesn't work in DEBUG):
This reminds me of the BYTE and WORD PTR directives that also tend to be on the left rather than the right side of the statement. Anyway, hope this helps others looking for this answer!
Footnotes:
[SUP][1][/SUP] DEBUG as included with MS-DOS version 2.11 for the Tandy 1000 HX. Later versions (and Enhanced DEBUG) support the newer prefix syntax.
Code:
0100 BF0301 MOV DI,0103 ; set DI to next instruction byte
0103 26 ES: ; 26h = ES segment prefix override
0104 8A05 MOV AL,[DI] ; puts 26h into AL
0106 CC INT 3
To actually use this in the DEBUG assembler, you can write:
Code:
ES: MOV AL, [DI]
You'll notice this is somewhat different than the ability to write the following (which doesn't work in DEBUG):
Code:
MOV AL, ES:[DI]
This reminds me of the BYTE and WORD PTR directives that also tend to be on the left rather than the right side of the statement. Anyway, hope this helps others looking for this answer!
Footnotes:
[SUP][1][/SUP] DEBUG as included with MS-DOS version 2.11 for the Tandy 1000 HX. Later versions (and Enhanced DEBUG) support the newer prefix syntax.