home *** CD-ROM | disk | FTP | other *** search
- ;************************************************************;
- ; ;
- ; Function 09H: Display String ;
- ; ;
- ; int disp_str(pstr) ;
- ; char *pstr; ;
- ; ;
- ; Returns 0. ;
- ; ;
- ;************************************************************;
-
- cProc disp_str,PUBLIC,<ds,di>
- parmDP pstr
- cBegin
- loadDP ds,dx,pstr ; DS:DX = pointer to string.
- mov ax,0900h ; Prepare to write dollar-terminated
- ; string to standard output, but
- ; first replace the 0 at the end of
- ; the string with '$'.
- push ds ; Set ES equal to DS.
- pop es ; (MS-C does not require ES to be
- ; saved.)
- mov di,dx ; ES:DI points at string.
- mov cx,0ffffh ; Allow string to be 64KB long.
- repne scasb ; Look for 0 at end of string.
- dec di ; Scasb search always goes 1 byte too
- ; far.
- mov byte ptr [di],'$' ; Replace 0 with dollar sign.
- int 21h ; Have MS-DOS print string.
- mov [di],al ; Restore 0 terminator.
- xor ax,ax ; Return 0.
- cEnd
-