home *** CD-ROM | disk | FTP | other *** search
- ;
- ; put these routines into individual library modules
- ;
- .model small
- .code
- public exit_program,ms_dos,outchr,outchr_newline,outchr_unsigned
-
- ;; exit program
- ;
- exit_program proc
- mov ax,4C00h
- jmp ms_dos
- exit_program endp
-
-
- ;; ms dos
- ;
- ms_dos proc
- int 21h
- ret
- ms_dos endp
-
-
- ;; outchr
- ;
- ; entry AL character
- ; uses AX
- ;
- outchr proc
- push dx
- mov ah,2
- mov dl,al
- call ms_dos
- pop dx
- ret
- outchr endp
-
-
- ;; outchr newline
- ;
- ; uses AX
- ;
- outchr_newline proc
- mov al,'M'-'@'
- call outchr
- mov al,'J'-'@'
- jmp outchr
- outchr_newline endp
-
-
- ;; outchr unsigned
- ;
- ; entry AX number
- ; uses AX
- ;
- outchr_unsigned proc
- push cx
- push dx
-
- mov cx,10
- mov dx,-1 ; push sentinal
- ocu1: push dx
- xor dx,dx
- div cx ; divide & push decimal digits
- and ax,ax
- jnz ocu1
- inc dx
- ocu2: xchg ax,dx ; pop & display digits
- add al,'0'-1
- call outchr
- pop dx
- inc dx
- jnz ocu2 ; if not sentinal
- pop dx
- pop cx
- ret
- outchr_unsigned endp
-
- end
-