|
Writing Library ModulesSince you have been using explicit segments in your coding so far, you will find it fairly simple to convert one of your procedures into a library module. Below is a sample of a module.
TITLE killTime.ASM
;=======================================================================
; killTime is a function designed to waste a large amount of time
;=======================================================================
; PreCond -- None
; PostCond -- This task will run indefinately
;=======================================================================
PUBLIC killTime
_TEXT SEGMENT USE16 WORD PUBLIC 'CODE'
ASSUME cs:_TEXT
killTime PROC FAR
push cx ;save register contents
push bx
mov bx, TimeKillConst ;outer count of Kill time loops
KillMoreTime:
xor cx, cx ;max loop time (inner loop)
loop $ ;loop in place
dec bx
jz SHORT KillTimeDone ;break out of loops when done
jmp SHORT KillMoreTime ;not finished with outter loop, continue
KillTimeDone:
pop bx ;restore register contents
pop cx
ret
killTime ENDP
_TEXT ENDS
END
So, lets walk through this file. As usual, there is the |