IB.asm 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. ;Filename : I_BLTT.ASM
  19. ;Description : Blt a bitmap to the display surface buffer without color key transparency handling
  20. INCLUDE IMGFUN.inc
  21. .CODE
  22. ;----------- BEGIN OF FUNCTION IMGblt ------------
  23. ;
  24. ; Put an non-compressed bitmap on image buffer.
  25. ; It does not handle color key transparency.
  26. ;
  27. ; Syntax : IMGblt( imageBuf, pitch, x, y, bitmapBuf )
  28. ;
  29. ; char *imageBuf - the pointer to the display surface buffer
  30. ; int x,y - where to put the image on the surface buffer
  31. ; char *bitmapPtr - the pointer to the bitmap buffer
  32. ;
  33. ;-------------------------------------------------
  34. ;
  35. ; Format of the bitmap data :
  36. ;
  37. ; <short> width
  38. ; <short> height
  39. ; <char..> bitmap image
  40. ;
  41. ;-------------------------------------------------
  42. PUBLIC IMGblt
  43. IMGblt PROC imageBuf, pitch, x, y, bitmapPtr
  44. STARTPROC
  45. MOV EAX, imageBuf ; store the address of the image buffer to a variable
  46. MOV image_buf, EAX
  47. ;------ get the bitmap width and height -----;
  48. MOV AX , DS
  49. MOV ES , AX
  50. MOV ESI, bitmapPtr
  51. XOR EAX, EAX
  52. LODSW ; get bitmap width
  53. MOV EBX, EAX
  54. LODSW ; get bitmap height
  55. MOV ECX, EAX
  56. MOV EDX, pitch ; EDX = lineDiff
  57. SUB EDX, EBX ; lineDiff = image_width - bitmap_width
  58. CLD ; clear direction flag for MOVSB
  59. ;------- pixels copying loop --------;
  60. CALC_ADDR EDI, x, y, pitch ; Get the offset to the image buffer address
  61. @@putLine:
  62. PUSH ECX
  63. MOV ECX, EBX
  64. REP MOVSB
  65. ADD EDI, EDX ; EDX = lineDiff
  66. POP ECX
  67. LOOP @@putLine ; decrease the remain height and loop
  68. @@end: ENDPROC
  69. IMGblt ENDP
  70. ;----------- END OF FUNCTION IMGblt ----------
  71. END