What happens in the following build commands?
You need to find Ralf Brown's Interrupt List , this is the definitive guide to those old DOS / Windows interrupts.
Calling INT 21h with AH = 09H prints to the console the line $
-terminated located at DS:DX
.
A call to INT 21H with AH = 4cH exits your program with a return code in AL
(in this case 01H).
The second call will not have AH
set to 09H
simply because AH
- it's just the top 8 bits AX
. The second one MOV
sets AH
in 4cH
as part of the setup AX
:
More details (from Wikipedia ):
These register-register registers have a long history at Intel with:
-
AX
consists ofAH
andAL
; -
eax
consists of 16 bits plus another 16 ofAX
; -
rax
consists of 32 bits and the other 32 ofeax
.
along with similar approaches for other general and special registers, such as index or base registers, and the stack pointer.
Interestingly, they do not overlap with the ability to access high-halves extended registers, for example, eax
consisting of eah
and eal
(both myth, but the latter is an alias for AX
).
This would give us a large cache of extra small registers in higher modes, although I'm not sure what the price would be (no doubt Intel / AMD does know the cost, and this was probably considered too expensive).
source to share