.model small ; make this program a small program
.stack 100h ; reserve 100 bytes for the user stack (to store return addresses for PROC's)
.data
logo db "The name of your program",0ah,0dh,'$'
press db "Press any key to continue..",0ah,0dh,'$'
; This is the data segment where you can store data variables used in your program.
.code ; this is where your program code goes.
main proc near
;--- every program MUST have these two instructions.
;-----------------------------------------------------------------
mov ax,@data ;load ax reg with data segment address.
mov ds,ax ;move it into the data segment register.
;-----------------------------------------------------------------
; next I send the logo to the screen to confirm this program I.D.
;-----------------------------------------------------------------
mov dx,offset logo ; point dx at the begining of my logo message.
mov ah,9 ;tel O.S. what interrupt 10h task to perfrom.
int 21h ;perform the task. (i.e. display the logo message).
;--------------------------------------------------------------------------
; Your program instructions go here.
;----------------------------------------------------------------------------------
; now tell user to press any key.
;---------------------------------
mov ah,9 ; tell O.S. what interrupt tsak to perform.
mov dx,offset press ; the message to send to the screen.
int 21h ; do it!
call getkey ;The proc to wait for a key press
;----------------------------------------------------------------------------------
; The following code will terminate your program and return to the O.S.
mov ax,4c00h ;tel the O.S. what interrupt 21h task to perform
int 21h ;in this case its the terminate program task.
main endp ; this defines the end of the program.
;====================================================================================
; Procs used in your program go here.
;-----------------------------------------------
; The following proc will wait for a key |
; to be pressed, then return to the main |
; program with the ascii character of the key |
; pressed in the AL register. |
;----------------------------------------------
getkey proc near
mov ah,0
int 16h
ret ;return to the calling program.
getkey endp
;-------------------------------------------------------
end ;tell assembler this is the end of the program.