SETFPAL.ASM 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  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 3 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. ;***************************************************************************
  19. ;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  20. ;***************************************************************************
  21. ;* *
  22. ;* Project Name : 32 bit library Text Print *
  23. ;* *
  24. ;* File Name : TEXTPRNT.ASM *
  25. ;* *
  26. ;* Programmer : Scott K. Bowen *
  27. ;* *
  28. ;* Start Date : July 2, 1994 *
  29. ;* *
  30. ;* Last Update : July 2, 1994 [SKB] *
  31. ;* *
  32. ;*-------------------------------------------------------------------------*
  33. ;* Functions: *
  34. ;* Text_Print -- Assembly text print routine. *
  35. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  36. IDEAL
  37. P386
  38. MODEL USE32 FLAT
  39. GLOBAL ColorXlat:BYTE
  40. GLOBAL Set_Font_Palette_Range:NEAR
  41. CODESEG
  42. ;***********************************************************
  43. ; SET_FONT_PALETTE_RANGE
  44. ;
  45. ; VOID Set_Font_Palette_Range(VOID *palette, WORD start, WORD end);
  46. ;
  47. ; This routine changes the local Draw_Char color translation table
  48. ; with the color numbers in palette.
  49. ;
  50. ; Bounds Checking: forces start and end to a range of 0-15
  51. ;*
  52. PROC Set_Font_Palette_Range C near
  53. USES eax, ebx, ecx,edi,esi
  54. ARG palette:DWORD
  55. ARG start:DWORD
  56. ARG endval:DWORD
  57. cld
  58. mov esi,[palette]
  59. mov ebx,[start]
  60. and ebx,0FH ; value 0-15
  61. mov ecx,[endval]
  62. and ecx,0FH ; value 0-15
  63. cmp ecx,ebx ; if end < start then exit
  64. jl short ??exit
  65. sub ecx,ebx ; number of colors = end - start + 1
  66. inc ecx
  67. mov edi,OFFSET ColorXlat ; get start of xlat table
  68. add edi,ebx ; add starting offset
  69. shl ebx,4 ; multiply start offset by 16
  70. add ebx,OFFSET ColorXlat ; add start of xlat table
  71. ; updates 0-15 for lonibble xlat
  72. ; updates 0,16,32,...,240 for hinibble xlat
  73. ??setpal:
  74. lodsb ; get color number
  75. stosb ; save color number for lonibble xlat
  76. mov [ebx],al ; save color number for hinibble xlat
  77. add ebx,010H ; add 16 to index for hinibble offset
  78. dec ecx
  79. jnz ??setpal
  80. ??exit:
  81. ret
  82. ENDP Set_Font_Palette_Range
  83. ;***********************************************************
  84. ;***********************************************************
  85. END