IB_DW.asm 2.5 KB

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