What happens in the following build commands?

Just a precaution. I am a complete nob on assembly. My only question is that only the following commands in DOS:

MOV  AH, 09
INT  21

MOV  AX, 4C01
INT  21

      

Does the second interrupt still have a parameter 09

meaning the display screen or will it change something AX

?

+3


source to share


2 answers


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

:

enter image description here


More details (from Wikipedia ):



enter image description here


These register-register registers have a long history at Intel with:

  • AX

    consists of AH

    and AL

    ;
  • eax

    consists of 16 bits plus another 16 of AX

    ;
  • rax

    consists of 32 bits and the other 32 of eax

    .

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).

+3


source


AH

and AL

- upper and lower halves AX

, respectively. So yes, the setup AX

changes AH

.



4C

is an "exit program".

+3


source







All Articles