1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- ; Seven Kingdoms: Ancient Adversaries
- ;
- ; Copyright 1997,1998 Enlight Software Ltd.
- ;
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 2 of the License, or
- ; (at your option) any later version.
- ;
- ; This program is distributed in the hope that it will be useful,
- ; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see <http://www.gnu.org/licenses/>.
- ;
- ;Filename : IB_4.ASM
- ;Description : Blt a bitmap to the display surface buffer without color key transparency handling
- ; Width must be dword aligned
- INCLUDE IMGFUN.inc
- .CODE
- ;----------- BEGIN OF FUNCTION IMGbltDW ------------
- ;
- ; Put an non-compressed bitmap on image buffer.
- ; It does not handle color key transparency.
- ;
- ; Syntax : IMGbltDW( imageBuf, pitch, x, y, bitmapBuf )
- ;
- ; char *imageBuf - the pointer to the display surface buffer
- ; int x,y - where to put the image on the surface buffer
- ; char *bitmapPtr - the pointer to the bitmap buffer
- ;
- ;-------------------------------------------------
- ;
- ; Format of the bitmap data :
- ;
- ; <short> width
- ; <short> height
- ; <char..> bitmap image
- ;
- ;-------------------------------------------------
- PUBLIC IMGbltDW
- IMGbltDW PROC imageBuf, pitch, x, y, bitmapPtr
- STARTPROC
- MOV EAX, imageBuf ; store the address of the image buffer to a variable
- MOV image_buf, EAX
- ;------ get the bitmap width and height -----;
- MOV AX , DS
- MOV ES , AX
- MOV ESI, bitmapPtr
- XOR EAX, EAX
- LODSW ; get bitmap width
- MOV EBX, EAX
- LODSW ; get bitmap height
- MOV ECX, EAX
- MOV EDX, pitch ; EDX = lineDiff
- SUB EDX, EBX ; lineDiff = pitch - bitmap_width
- SHR EBX, 2 ; no. of dword of each line
- CLD ; clear direction flag for MOVSB
- ;------- pixels copying loop --------;
- CALC_ADDR EDI, x, y, pitch ; Get the offset to the image buffer address
- MOV EAX, ECX
- ALIGN 4
- @@putLine:
- MOV ECX, EBX
- REP MOVSD
- ADD EDI, EDX ; EDX = lineDiff
- DEC EAX
- JNZ @@putLine ; decrease the remain height and loop
- @@end: ENDPROC
- IMGbltDW ENDP
- ;----------- END OF FUNCTION IMGbltDW ----------
- END
|