The example I showed above will run,but it will not exit.

For a program to be a program,it must be complete.ie it must exit.

we must tell dos we want to exit :It is done simply by using the operator "int" which calls to interrupt.

(0..0FFH) and instruct him what to do, so lets discuss  some int's :

009h - the keyboard interrupt

010h - the screen interrupt

013h - the sectors, (format, read, write) interrupt

016h - the keyboard interrupt

017h - the printer interrupt

021h - the main dos command

 each interrupt got many command and each one needs difrrent parameters

(if you want to know get the complete int list from your local BBS)

INT 21 - TERMINATE

ah - 4ch

al - errorlevel

so in order to initiate this interrupt we will do :

mov ah,4ch

mov al,0 ; if you want it can every value

int 21h ; and then the program will exit to dos

but how will the compiler know where to start, well we have to tell

him, the compiler will know to start excatly in the first, label -

label is a name which you can jump to him, the label will be like :

Name : - "start :", "now :", "rt :" all of those are labels, so this is

a basic (working) assembly program :

 

Sseg segment

db 10 dup (?) ; will be disscused late

ends

Dseg segment

ends

Cseg segment

assume cs:cseg,ds:dseg,ss:sseg

start : ; the compiler will start here

mov ah,4ch

mov al,0

int 21h ; terminate

ends ; the segment must finish before the label

end start ; close the label

end ; tell compiler script ends here

 

 

 

                                                                         NEXT PAGE

LESSON3 - INTERRUPTS LABELS AND DB