Click to See Complete Forum and Search --> : Exiting an assembly program


Bluefox815
September 17th, 2008, 01:35 PM
I've been looking at an interrupt reference and I've seen program termination interrupts with a note saying "DO NOT CALL THIS INTERRUPT DIRECTLY!". So, I want to know how I can safely exit an assembly program without using DOS interrupts, in case I wanted to try to make a stand-alone (no OS) .com program.

Example:

.model small
.stack
.data

.code

main proc

mov ax, 4c00h ; this is what I DON'T want
int 21h

main endp
end main

iviggers
September 17th, 2008, 03:23 PM
Try Int 20h, Int 00h (divide exception) or adding to sp (esp) register with opcode retn.

Int 00h looks most straight-forward but this depends on your program.