home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / progrmng / stk110.lzh / STKSRC.COM / GR_LOW.DEF < prev    next >
Encoding:
Text File  |  1991-02-25  |  2.3 KB  |  87 lines

  1. /**********************************************************************
  2. * The hardware INdependent skeletons for the hardware dependent
  3. * low level routines. This file is included by the file gr_low.c
  4. * once for each different graphics card.
  5. **********************************************************************
  6.                     This file is part of
  7.  
  8.           STK -- The sprite toolkit -- version 1.1
  9.  
  10.               Copyright (C) Jari Karjala 1991
  11.  
  12. The sprite toolkit (STK) is a FreeWare toolkit for creating high
  13. resolution sprite graphics with PCompatible hardware. This toolkit 
  14. is provided as is without any warranty or such thing. See the file
  15. COPYING for further information.
  16.  
  17. **********************************************************************/
  18.  
  19.  
  20. /**********************************************************************
  21. * ADDR
  22. * Return the address of the given (x,y) coordinate pair in the
  23. * given graphics page.
  24. * x,y     X,Y coordinates
  25. * page    The graphics page (0/1)
  26. *
  27. * Return: far pointer into the screen.
  28. **********************************************************************/
  29. BYTE far *ADDR(WORD x, WORD y, BYTE page)
  30. {
  31.     return (BYTE far *)MK_FP(SCR_SEG+page*SCR_PAGE_2_SEG, SCR_OFS(x,y));
  32. }
  33.  
  34.  
  35. /**********************************************************************
  36. * PUTCH
  37. *
  38. * Put character 'c' at the given address. Use OVERWRITE mode.
  39. **********************************************************************/
  40. void PUTCH(BYTE far *addr, BYTE chr)
  41. {
  42. #ifdef C_VER
  43.  
  44.     BYTE far *font = gr_font_addr + 8*chr;
  45.     int i;
  46.     
  47.     for (i=0; i<8; i++) {
  48.         *addr = *font++;
  49.         NEXT_SCAN_LINE(addr,0);
  50.     }
  51. #else
  52. /***** Assembler version is about 2 to 3 times faster *****/
  53. asm push ds
  54. asm push es
  55. asm cld
  56.     /** fetch parameters **/
  57. asm les  di, addr
  58. asm lds  si, gr_font_addr
  59. asm mov  al, chr
  60. asm xor  ah, ah
  61. asm mov  cl, 3
  62. asm shl  ax, cl
  63. asm add  si, ax
  64. asm mov  cx, 8
  65. CHAR_LOOP:
  66. asm lodsb
  67. asm mov  es:[di],al
  68. ASM_NEXT_SCAN_LINE(di)
  69. asm loop CHAR_LOOP
  70. asm pop  es
  71. asm pop  ds
  72.  
  73. #endif
  74. }
  75.  
  76.  
  77. /** Undefine hardware dependent macros to make later redefinition easier **/
  78.  
  79. #undef ADDR
  80. #undef PUTCH
  81. #undef NEXT_SCAN_LINE
  82. #undef ASM_NEXT_SCAN_LINE
  83. #undef SCR_OFS
  84. #undef SCR_SEG
  85. #undef SCR_PAGE_2_SEG
  86.