home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MLFASTWR.ZIP / MLFWA.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-08-26  |  1.9 KB  |  71 lines

  1. ;                       Fast Write with attribute   By: Miles Levy 8/89
  2. ;                       called:  MLFWA (X, Y, A, String)
  3. ;                                      X=Row, Y=Column, A=Attribute 
  4. ;                                      1..80, 1..25
  5. ;
  6. ;       Procedure MLFWA (x,y,a : Integer;  strng : String);
  7. ;
  8. code    segment byte public
  9.         assume  cs:code,ds:code
  10.         public  mlfwa
  11. ;
  12. strng   equ     dword ptr [bp+6]
  13. attr    equ     byte ptr [bp+10]
  14. y       equ     word ptr [bp+12]
  15. x       equ     word ptr [bp+14]
  16.  
  17. vid     equ     0B800H
  18. ;
  19. mlfwa   proc   far
  20. ;
  21. start:
  22.         push    bp
  23.         mov     bp,sp
  24.         push    ds
  25.  
  26.         mov     ax,vid
  27.     mov    es,ax
  28.         cld
  29.         lds     si,strng                ; DS:SI points to string[0]
  30.         lodsb                           ; length to Al
  31.         xor     ah,ah
  32.         mov     cx,ax
  33.         jcxz    fini                    ; exit if empty string
  34.         mov     bx,y                    ; row (line number / 1 relative )
  35.         dec     bx                      ; 0 relative
  36.         shl     bx,1
  37.         mov     di,word ptr cs:rowvect[bx]      ; line pointer
  38.         mov     bx,x
  39.         dec     bx                      ; column ( 0 relative )
  40.         shl     bx,1
  41.         add     di,bx                   ; di is tgt ptr
  42.         mov     ah,attr                 ; attribute ---> ah
  43. movelp:
  44.         lodsb                           ; char ---> al
  45.         stosw                           ; char/attr ---> video memory
  46.         loop    movelp
  47. ;
  48. fini:   
  49.         pop     ds
  50.         pop     bp
  51.         ret     8
  52.  
  53. ; ---------------------------------------------------
  54.  
  55. rowvect equ     $
  56. ;                                       Generate the row vectors
  57. adr     =       0
  58.         rept    25
  59.         dw      adr
  60. adr     =       adr+160
  61.     endm
  62.  
  63. mlfwa   endp
  64.  
  65. copywrt db     'Copyright 1989 Miles Levy'
  66.  
  67.  
  68. code    ends
  69.         end
  70.  
  71.