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

  1. ;----------------------------------------------------------------------
  2. ; put_masked_pbm - write a bitmap from system ram to video ram all zero
  3. ; source bitmap bytes indicate destination byte to be left unchanged
  4. ;
  5. ; void put_masked_bitmap(X, Y, ScrnOffs, Width, Height, char far *Bitmap)
  6. ;
  7. ;----------------------------------------------------------------------
  8. proc        put_masked_bitmap
  9. arg         X:word,Y:word,ScrnOffs:word,Width:word,Height:word,Bitmap:dword
  10.             push bp                         ;\
  11.             mov bp,sp                       ; > initialize our stack frame
  12.             push ds                         ;/
  13.             cld                             ;clear the direction flag
  14.             mov es,[VGASeg]                 ;\
  15.             mov ax,[Y]                      ; \
  16.             mul [ModeXLogWidth]             ;  \
  17.             mov di,[ScrnOffs]               ;   \ ES:DI ==> video segment position
  18.             add di,ax                       ;   /
  19.             mov cx,[X]                      ;  /
  20.             shr cx,2                        ; /
  21.             add di,cx                       ;/
  22.             lds si,[Bitmap]                 ;DS:SI ==> Bitmap data
  23.             mov [@@Plane],0                 ;Set plane counter to 0
  24.             mov [@@Source],si               ;\ save our pointers
  25.             mov [@@Target],di               ;/
  26. @@PlaneLoop:mov cl,[@@Plane]                ;\
  27.             mov ah,1                        ; \ send out plane to access
  28.             shl ah,cl                       ; /
  29.             @Set_Write_Plane                ;/
  30.             mov si,[@@Source]
  31.             mov di,[@@Target]
  32.  
  33.             mov dx,[Height]                 ;DX = number of rows in image
  34. @@RowLoop:  mov cx,[Width]                  ;CX = number of columns in image
  35.             dec cx                          ;     minus one
  36.             mov [@@TempRow],di
  37. @@ColLoop:  mov al,[byte ds:si]             ;\
  38.             add si,4                        ; \
  39.             or al,al                        ;  \ display a pixel
  40.             jz @@NoPixel                    ;  /
  41.             mov [byte es:di],al             ; /
  42. @@NoPixel:  inc di                          ;/
  43.             sub cx,4                        ;\ do the next column
  44.             jnc @@ColLoop                   ;/
  45.             mov di,[@@TempRow]
  46.             add di,[ModeXLogWidth]
  47.             dec dx                          ;\ do the next row
  48.             jnz @@RowLoop                   ;/
  49.             inc [@@Source]                  ;\
  50.             inc [@@Plane]                   ; \ do the next plane
  51.             cmp [@@Plane],4                 ; /
  52.             jnz @@PlaneLoop                 ;/
  53.  
  54.             pop ds                          ;\ deinitialize the stack frame
  55.             pop bp                          ;/
  56.             ret                             ;return
  57. @@Plane     db ?
  58. @@Source    dw ?
  59. @@Target    dw ?
  60. @@TempRow   dw ?
  61. endp        put_masked_bitmap
  62.