home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbopas / tsrhelp.zip / WRITE.INC < prev   
Text File  |  1992-05-28  |  2KB  |  79 lines

  1.     Page 50,132
  2. ;-------------------------------------------------------------------------
  3. ; Program Name:  Write.Asm
  4. ;
  5. ; Author:  Steve Poulsen
  6. ;
  7. ; This include file will write characters to the screen without changing the
  8. ; color and using fast screen writes.  Upon entry SI should point to the start
  9. ; of the string to write in which a $ ends.  A 13 code will cause a CR and a
  10. ; line feed all at once.  BL should contain the row to start on with zero being
  11. ; the first row.  BH should be the column. CL is the attribute.
  12. ;------------------------------------------------------------------------
  13. Write   Proc    Near
  14.         Assume CS:Code,DS:Code,ES:Nothing
  15.         Push AX
  16.         Push ES
  17.         Push DI
  18.         Push DS
  19.         Push SI
  20.         Mov AX,CS
  21.         Mov DS,AX
  22.         
  23.         Push BX
  24.         
  25.         Mov AX,0B800h                   ; Screen memory segment for color
  26.         Mov ES,AX
  27.         Mov AH,0Fh                      ; Check video mode
  28.         Int 10h
  29.         Cmp AL,07h                      ; Monochrome?
  30.         JNE Color
  31.         Mov AX,0B000h                   ; Screen memory segment for mono
  32.         Mov ES,AX
  33. Color:  
  34.         Pop BX      
  35.         Mov AL,160                      ; Add 160 [80 char+80 color] for
  36.         Mul BL                          ; each Y value.
  37.         Mov DI,AX
  38.         Mov AL,BH
  39.         Mov AH,0
  40.         Shl AX,1
  41.         Add DI,AX
  42.         
  43.         
  44. Repeat:        
  45.         Cmp [SI],Byte Ptr 13            ; Is it a CR
  46.         JNE EndCheck
  47.  
  48.         Inc BL                          ; Increment Y value
  49.         Mov AL,160                      ; Refigure DI 
  50.         Mul BL
  51.         
  52.         Mov DI,AX
  53.         Mov AL,BH
  54.         Mov AH,0
  55.         Shl AX,1
  56.         Add DI,AX
  57.         Inc SI
  58.  
  59.         Jmp Repeat
  60. EndCheck:        
  61.         Cmp [SI],Byte Ptr '$'           ; Is it a $ ?    
  62.         JNE MoveIt
  63.         Jmp MoveDone                    ; If so then exit
  64. MoveIt:
  65.         Movsb                           ; Mov char. from DS:SI to
  66.         Mov ES:DI,CL
  67.         Inc DI                          ; ES:DI [screen] and inc DI twice
  68.         
  69.         Jmp Repeat
  70. MoveDone:
  71.         Pop SI
  72.         Pop DS
  73.         Pop DI
  74.         Pop ES
  75.         Pop AX
  76.         Ret        
  77. Write   EndP
  78.  
  79.