home *** CD-ROM | disk | FTP | other *** search
/ The Equalizer BBS / equalizer-bbs-collection_2004.zip / equalizer-bbs-collection / DEMOSCENE-STUFF / BKISSSRC.ZIP / DRAWSTR.INC < prev    next >
Text File  |  1994-02-10  |  3KB  |  73 lines

  1. ;this module was originally from Patch of Avalanche's PCXTOOLS package
  2. ;this version has been modified to work in normal unchained mode 13h
  3.  
  4. TransparentText = 0     ;set to 0 to draw backgrounds of letters
  5. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  6. ; void far Draw_Letter(byte far *fontdata, byte far *string,
  7. ;                  word xcoord, word ycoord, byte far *videoseg);
  8. ;
  9. PROC            _Draw_Letter far
  10.                 push bp
  11.                 mov bp,sp
  12.                 push si ds es fs gs
  13.  
  14.                 lds si,[dword bp + 6]       ; DS:SI -> fontdata
  15.                 add si,3                    ; point to offset table
  16.  
  17.                 les di,[dword bp + 18]
  18.                 add di,[bp + 14]            ; X coord
  19.                 mov dx,[bp + 16]            ; Y coord
  20.                 shl dx,4                    ; *16
  21.                 mov bx,dx                   ; save
  22.                 shl dx,2                    ; *64
  23.                 add dx,bx                   ; *64 + *16 = *80
  24.                 shl dx,2                    ; *80 *4 = *320
  25.                 add di,dx                   ; ES:DI -> video offset to start
  26.  
  27.                 lfs bp,[dword bp + 10]      ; FS:BP -> string
  28.  
  29. @@setupletter:  xor bh,bh
  30.                 mov bl,[byte fs:bp]                 ; load letter from message
  31.                 shl bx,1                            ; *2 = word sized
  32.  
  33.                 mov cx,[word si + bx]
  34.                 mov gs,si                           ; save font pointer
  35.                 sub si,3                            ; back to start
  36.                 add si,cx                           ; point to proper spot in font file
  37.  
  38. movzx ax,[byte si+1]
  39. push ax
  40.                 mov dh,[byte si + 1]                ; get X size
  41.                 mov dl,[byte si + 2]                ; get Y size
  42.                 or dx,dx
  43.                 jz @@nextcharacter
  44.                 add si,03h                          ; point to start of data
  45.  
  46. @@drawcol:      mov bx,di                           ; save video pointer
  47.                 mov cl,dl                           ; CL = height in pixels
  48. @@PixelLoop:    lodsb
  49.                 if TransparentText eq 1
  50.                     or al,al
  51.                     jz @@NextPixel
  52.                 endif
  53.                 mov [byte es:di],al
  54. @@NextPixel:    add di,320
  55.                 dec cl
  56.                 jnz @@PixelLoop
  57.                 mov di,bx                           ; restore video pointer
  58.                 inc di                              ; go to next column
  59.                 dec dh                              ;\ loop until all rows
  60.                 jnz @@drawcol                       ;/ are done
  61.  
  62. @@nextcharacter:mov si,gs
  63.                 ;inc bp                              ; next letter in message
  64.                 ;cmp [byte fs:bp],00h
  65.                 ;jne @@setupletter
  66. pop ax
  67.  
  68.                 pop gs fs es ds si
  69.                 pop bp
  70.                 ret
  71. ENDP            _Draw_Letter
  72. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  73.