I_BLACK.asm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_BLACK.ASM
  19. ;Description : Draw a black 32x32 sqaure on vga image buffer
  20. INCLUDE IMGFUN.inc
  21. .CODE
  22. COLOR = 0
  23. DUP_COLOR = COLOR * 01010101h
  24. ;--------- BEGIN OF FUNCTION IMGblack32x32 -----------
  25. ;
  26. ; Draw a black 32x32 square on the VGA screen
  27. ;
  28. ; Note : No border checking is made in this function.
  29. ; Placing an icon outside image buffer will cause serious BUG.
  30. ;
  31. ; char *imageBuf - the pointer to the display surface buffer
  32. ; int pitch - the pitch of the display surface buffer
  33. ; int x1,y1 - the top left vertex of the bar
  34. PUBLIC IMGblack32x32
  35. BLACKLINE MACRO
  36. MOV CL,BL
  37. REP STOSD
  38. ADD EDI,EDX
  39. ENDM
  40. IMGblack32x32 PROC imageBuf, pitch, x1, y1
  41. STARTPROC
  42. MOV EAX, imageBuf ; store the address of the image buffer to a variable
  43. MOV image_buf, EAX
  44. MOV AX, DS
  45. MOV ES, AX
  46. MOV EDX, pitch ; EDX = lineDiff
  47. SUB EDX, 32 ; lineDiff = image_width - icon_width
  48. MOV EAX, DUP_COLOR
  49. MOV BL,8
  50. XOR ECX, ECX
  51. CLD ; clear direction flag for MOVSB
  52. ;------- pixels copying loop --------;
  53. CALC_ADDR EDI, x1, y1, pitch ; Get the offset to the image buffer address
  54. @@line0:
  55. BLACKLINE
  56. BLACKLINE
  57. BLACKLINE
  58. BLACKLINE
  59. @@line4:
  60. BLACKLINE
  61. BLACKLINE
  62. BLACKLINE
  63. BLACKLINE
  64. @@line8:
  65. BLACKLINE
  66. BLACKLINE
  67. BLACKLINE
  68. BLACKLINE
  69. @@line12:
  70. BLACKLINE
  71. BLACKLINE
  72. BLACKLINE
  73. BLACKLINE
  74. @@line16:
  75. BLACKLINE
  76. BLACKLINE
  77. BLACKLINE
  78. BLACKLINE
  79. @@line20:
  80. BLACKLINE
  81. BLACKLINE
  82. BLACKLINE
  83. BLACKLINE
  84. @@line24:
  85. BLACKLINE
  86. BLACKLINE
  87. BLACKLINE
  88. BLACKLINE
  89. @@line28:
  90. BLACKLINE
  91. BLACKLINE
  92. BLACKLINE
  93. BLACKLINE
  94. @@end: ENDPROC
  95. IMGblack32x32 ENDP
  96. ;---------- END OF FUNCTION IMGblack32x32 ------------
  97. END