I_PIXEL.asm 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_PIXEL.ASM
  19. ;Description : PIXELIZE (1:4 tone) of size 32x32 to the display surface buffer
  20. INCLUDE IMGFUN.inc
  21. .CODE
  22. ;----------- BEGIN OF FUNCTION IMGpixel32x32 ------------
  23. ;
  24. ; Syntax : IMGpixel( imageBuf, pitch, x, y, colour )
  25. ;
  26. ; char *imageBuf - the pointer to the display surface buffer
  27. ; int pitch - the pitch of the display surface buffer
  28. ; int x,y - where to put the image on the surface buffer
  29. ; int color - color to pixelize with.
  30. ;
  31. ;-------------------------------------------------
  32. PUTFOUR MACRO
  33. ADD EDI,EBX
  34. MOV [ESI], AL
  35. MOV [EDI], AL
  36. ADD ESI,EBX
  37. ENDM
  38. PUBLIC IMGpixel32x32
  39. IMGpixel32x32 PROC imageBuf, pitch, x, y, color
  40. STARTPROC
  41. MOV EAX, imageBuf ; store the address of the image buffer to a variable
  42. MOV image_buf, EAX
  43. MOV EDX, pitch ; EDX = lineDiff
  44. ADD EDX,EDX
  45. SUB EDX,30
  46. CLD ; clear direction flag for MOVSB
  47. ;------- pixels loop --------;
  48. CALC_ADDR EDI, x, y, pitch ; Get the offset to the image buffer address
  49. MOV ESI,EDI
  50. MOV EAX,color
  51. MOV EBX,4
  52. MOV ECX,16
  53. @@loopstart:
  54. ADD EDI,2
  55. MOV [ESI], AL
  56. MOV [EDI], AL
  57. ADD ESI,EBX
  58. PUTFOUR
  59. PUTFOUR
  60. PUTFOUR
  61. PUTFOUR
  62. PUTFOUR
  63. PUTFOUR
  64. ADD EDI,EBX
  65. MOV [ESI], AL
  66. MOV [EDI], AL
  67. ADD ESI,2
  68. ;------ skip two line ------;
  69. ADD EDI,EDX
  70. ADD ESI,EDX
  71. LOOP @@loopstart
  72. @@end: ENDPROC
  73. IMGpixel32x32 ENDP
  74. ;----------- END OF FUNCTION IMGpixel32x32 ----------
  75. END