IB2.asm 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 : IB2.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 IMGblt2 ------------
  23. ;
  24. ; Put an non-compressed bitmap on image buffer.
  25. ; It does not handle color key transparency.
  26. ;
  27. ; Syntax : IMGblt2( imageBuf, pitch, x, y, bitmapWidth, bitmapHeight, bitmapBuf )
  28. ;
  29. ; char *imageBuf - the pointer to the display surface buffer
  30. ; int pitch - picth of display surface buffer
  31. ; int x,y - where to put the image on the surface buffer
  32. ; int bitmapWidth - width of the bitmap
  33. ; int bitmapHeight - height of the bitmap
  34. ; char *bitmapPtr - the pointer to the bitmap buffer
  35. ;
  36. ;-------------------------------------------------
  37. ;
  38. ; Format of the bitmap data :
  39. ;
  40. ; <short> width
  41. ; <short> height
  42. ; <char..> bitmap image
  43. ;
  44. ;-------------------------------------------------
  45. PUBLIC IMGblt2
  46. IMGblt2 PROC imageBuf, pitch, x, y, bitmapWidth, bitmapHeight, bitmapPtr
  47. STARTPROC
  48. MOV EAX, imageBuf ; store the address of the image buffer to a variable
  49. MOV image_buf, EAX
  50. ;------ get the bitmap width and height -----;
  51. MOV AX , DS
  52. MOV ES , AX
  53. MOV ESI, bitmapPtr
  54. MOV EBX, bitmapWidth
  55. MOV ECX, bitmapHeight
  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. IMGblt2 ENDP
  70. ;----------- END OF FUNCTION IMGblt2 ----------
  71. END