home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / STDOUT01.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  76 lines

  1.     page    66,132
  2. ;******************************** STDOUT01.ASM *******************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. ;----------------------------------------------------------------------------
  13. ;============================================================================
  14. ; stdout_char - display character to stdout
  15. ;  inputs: al = char.
  16. ;
  17.     public    stdout_char
  18. stdout_char    proc    far
  19.         push    dx
  20.         push    ax
  21.         mov    ah,02h
  22.         mov    dl,al    
  23.         int    21h
  24.         pop    ax
  25.         pop    dx
  26.         retf            
  27. stdout_char    endp        
  28. ;=============================================================================
  29. ; stdout_string - put string to stdout
  30. ; inputs ds:si point at string terminated with a zero
  31. ; output:ds:si point at end of string
  32. ;
  33.     public    stdout_string
  34. stdout_string    proc    far
  35.     push    ax
  36.     cld
  37. ds_loop:lodsb                     ;get next char
  38.     test    al,al
  39.     jz    stdout_string_exit        ;exit if done
  40.     call    stdout_char
  41.     jmp    ds_loop
  42. stdout_string_exit:
  43.     pop    ax
  44.     retf
  45. stdout_string    endp    
  46. ;=============================================================================
  47. ; stdout_crlf - sends cr/lf to stdout one time
  48. ;   inputs:  none
  49. ;   output:  ax modified
  50. ;
  51.     public    stdout_crlf
  52. stdout_crlf    proc    far
  53.     mov    al,0dh
  54.     call    stdout_char
  55.     mov    al,0ah
  56.     call    stdout_char
  57.     retf
  58. stdout_crlf    endp    
  59. ;=============================================================================
  60. ;  stdout_spaces - put one or more spaces to stdout
  61. ;    inputs:  ah = space count
  62. ;    output:  ax modified
  63. ;
  64.     public    stdout_spaces
  65. stdout_spaces    proc    far
  66.     mov    al,' '
  67. display_repeat:
  68.     call    stdout_char
  69.     dec    ah
  70.     jnz    display_repeat
  71.     retf
  72. stdout_spaces    endp
  73.  
  74. LIBSEG    ENDS
  75.     end
  76.