home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / turbo55 / tp55 / tasm / iasciizs.asm < prev    next >
Assembly Source File  |  1989-05-01  |  2KB  |  79 lines

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