1; Seven Kingdoms: Ancient Adversaries 2; 3; Copyright 1997,1998 Enlight Software Ltd. 4; 5; This program is free software: you can redistribute it and/or modify 6; it under the terms of the GNU General Public License as published by 7; the Free Software Foundation, either version 2 of the License, or 8; (at your option) any later version. 9; 10; This program is distributed in the hope that it will be useful, 11; but WITHOUT ANY WARRANTY; without even the implied warranty of 12; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13; GNU General Public License for more details. 14; 15; You should have received a copy of the GNU General Public License 16; along with this program. If not, see <http://www.gnu.org/licenses/>. 17; 18 19;Filename : IR.ASM 20;Description : Remap a bitmap on vga image buffer 21 22 23INCLUDE IMGFUN.inc 24 25.CODE 26 27;--------- BEGIN OF FUNCTION IMGremap ----------- 28; 29; Remap on the VGA screen 30; 31; Note : No border checking is made in this function. 32; Placing an icon outside image buffer will cause serious BUG. 33; 34; char *imageBuf - the pointer to the display surface buffer 35; int pitch - the pitch of the display surface buffer 36; int x1,y1 - the top left vertex of the bar 37; char *bitmapPtr - the pointer to the bitmap array 38; char **colorTableArray - the pointer to the scale 0 of remap table array 39; 40 PUBLIC IMGremap 41IMGremap PROC imageBuf, pitch, x1, y1, bitmapPtr, colorTableArray 42 LOCAL mapWidth:DWORD, destLineDiff:DWORD 43 STARTPROC 44 45 MOV EAX, imageBuf ; store the address of the image buffer to a variable 46 MOV image_buf, EAX 47 48 ;------ calc bar width and height -----; 49 50 MOV AX , DS 51 MOV ES , AX 52 53 XOR EAX, EAX 54 MOV ESI, bitmapPtr 55 LODSW 56 MOV mapWidth, EAX 57 LODSW 58 MOV ECX, EAX 59 60 MOV EDX, pitch 61 SUB EDX, mapWidth 62 MOV destLineDiff, EDX 63 64 MOV EDX, colorTableArray 65 66 CLD ; clear direction flag for MOVSB 67 68 ;------- pixels copying loop --------; 69 70 CALC_ADDR EDI, x1, y1, pitch ; Get the offset to the image buffer address 71 72@@startY: PUSH ECX 73 MOV ECX, mapWidth 74@@startX: 75 LODSB 76 MOVSX EAX, AL 77 MOV EBX, [EDX + 4*EAX] 78 MOV AL,[EDI] 79 XLATB [EBX] 80 STOSB 81 LOOP @@startX 82 83 POP ECX 84 ADD EDI, destLineDiff 85 LOOP @@startY 86 87@@end: ENDPROC 88 89IMGremap ENDP 90 91 92;---------- END OF FUNCTION IMGremap ------------ 93 94END 95