in assembly as in pascal,c and basic you have the option of using procedures, to declare a procedure you do : Proc name "proc" distance (far/near) . . . ret endp ; end proc and to call the proc you type "Call Procname" the ret must come because you have to return to the exact point you called the proc from, if you pushed registers and didn't pop them it might not return to the calling position. sseg segment db 10 dup (?) ends cseg segment assume cs:cseg,ds:cseg,ss:sseg,es:nothing clearscreen proc near mov ax,0b800h mov es,ax ; clear the screen, point to screen mov di,0 mov ax,0 mov cx,2000 rep stosw ; if don't understand go back to learn ret ; try to erase this and see what happends endp start : push ds call clearscreen pop ds mov ax,4c00h int 21h ends end start end
|
LESSON7 - PROCEDURES AND MACROS |