home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l040 / 11.ddi / WHEREIS.ZIP / IASCIIZS.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-10-27  |  2.6 KB  |  81 lines

  1. ;   FILENAME: IASCIIZS.ASM
  2. ;
  3. ;   Copyright (c) 1988, 1992 by Borland International, Inc.
  4. ;
  5. ;   DESCRIPTION: This module implements a routine that displays ASCIIZ
  6. ;   style strings. The module uses Ideal mode syntax.
  7. ;
  8. ;   ASSEMBLY INSTRUCTIONS: To assemble this module use the following
  9. ;   TASM command line.
  10. ;
  11. ;       TASM /m /dMDL=memorymodel iasciizs
  12. ;
  13. ;   /m in the above command line allows TASM to use extra passes to resolve
  14. ;   jumps and other operations to their shortest form and get rid of extra NOPs.
  15. ;   'memorymodel' in the above command line may be replaced by TINY, SMALL,
  16. ;   MEDIUM, COMPACT, LARGE or HUGE. If assembling this module to run on
  17. ;   a 286/386 machine, turn on the P286 directive in order to take advantage
  18. ;   of 286/386 specific instructions. For example:
  19. ;
  20. ;       TASM /m /dMDL=memorymodel /jP286 iasciizs
  21.  
  22. %tabsize 4
  23.  
  24. ifndef  MDL
  25.     display "Error: This module requires that you provide a memory model"
  26.     display "       definition on the command line. I.E. /dMDL=SMALL."
  27.     err ; Force a fatal error
  28. else
  29.  
  30.     ideal                   ; Use TASM's Ideal mode
  31. %   model   MDL             ; Define the memory model
  32.  
  33.     include "imacros.mac"
  34.     include "dos.inc"
  35.     include "idos.mac"
  36.     include "bios.inc"
  37.     include "ibios.mac"
  38.  
  39.     dataseg
  40.     global  DisplayPage:byte        ; declare extrn variable
  41.  
  42.     codeseg
  43.  
  44.     global  WriteASCIIZString:proc  ; declare public proc
  45.  
  46.     proc    WriteASCIIZString
  47.  
  48.     ;   This routine displays a string to the screen by calling the BIOS
  49.     ;   service to display a character in TTY mode. It expects a far pointer
  50.     ;   to the string to be passed on the stack.
  51.     ;
  52.     ;   Input
  53.     ;       StrAddress - Far pointer to string to display
  54.     ;   Output
  55.     ;       none
  56.     ;   Calling convention
  57.     ;       Pascal
  58.     ;   Registers modified
  59.     ;       di, es, Flags
  60.  
  61.     ARG StrAddress:dword=ParamSize  ; Define parameters passed on the stack
  62.  
  63.         push    bp
  64.         mov     bp, sp
  65.         les     di, [StrAddress]    ; Get the address of the string
  66.     DisplayChar:                    ; Display the next character
  67.         cmp     [byte es:di], 0     ; Check for the terminating NULL character
  68.         je      Exit
  69.         CharacterOutput <[byte es:di]>
  70.         inc     di                  ; Point to the next character
  71.         jmp     DisplayChar
  72.     Exit:
  73.         pop     bp
  74.         ret     ParamSize           ; Clean up the stack since we're using
  75.                                     ; Pascal calling conventions
  76.     endp    WriteASCIIZString
  77.  
  78. endif   ; ifndef MDL
  79.  
  80. end
  81.