Search code examples
assemblydosdosbox

How to terminate the program Assembly Language


I am assigned to do a task with the following data and to find out the value of flags after each of the following instructions but I want my program to terminate after ADD BX, 0xF001; as I have used the INT 0x21 instruction but it doesn't and goes on due to which the answer of flags varies. Do I have to use MOV AX,4C00H instruction?

ORG 0x0100
MOV AX, 0x1254 ;
MOV BX, 0x0FFF ;
ADD AX, 0xEDAB ;
ADD AX, BX ;
ADD BX, 0xF001 ;
INT 0x21

Solution

  • Do I have to use MOV AX,4C00H instruction?

    Yes, you do. This should have been made clear in whatever documentation you were reading; if not, the Ralf Brown Interrupt List is a good resource.

    INT 0x21 is used for all of DOS's system services: accessing files, allocating memory, running other programs, and so on. The value in AH (here 4Ch) is the only way it knows you are requesting program termination instead of some other service.