This code is assemble using Turbo Assembler but when I try running it in DOSBox , it freezes and DOSBox dies. Is there anything wrong with it?
TITLE SAMPLE PROGRAM
.MODEL SMALL
.STACK 64
.DATA
.CODE
MYCODE PROC
MOV AX,04
MOV BX,0212
CMP AX, BX
JG action1
JLE action2
action1:
ADD AL, 30
JMP exit
action2:
ADD BL, 20
JMP exit
exit:
MOV AX, 4CH
INT 21H
MYCODE ENDP
END MYCODE
Exit to DOS is done by setting AH
to 4CH
and calling int 21h
. By writing MOV AX,4CH
you will set AL
with this value and not AH
. In AL you can set exit code.
Either do (option 1):
mov ah,4CH
int 21h
or (option 2)
mov AX,4C00H ; or change 00 to any exit code you want.
int 21h