home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Aktief 1995 #6 / CDA_6.iso / shell / utils / disked29.arj / SOURCE.ZIP / CONSOLE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-19  |  3.2 KB  |  91 lines

  1. /***
  2. *console.h - disked definitions/declarations for hardware specific functions.
  3. *
  4. *Copyright (c) 1991-1995, Gregg Jennings.  All wrongs reserved.
  5. *   P O Box 200, Falmouth, MA 02541-0200
  6. *
  7. *Purpose:
  8. *  BIOS Screen, BIOS Keyboard, Video memory functions, etc.
  9. *
  10. *Notice:
  11. *   This progam may be freely used and distributed.  Any distrubution
  12. *   with modifications must retain the above copyright statement and
  13. *   modifications noted.
  14. *   No pulp-publication, in whole or in part, permitted without
  15. *   permission (magazines or books).
  16. *******************************************************************************/
  17.  
  18. /*
  19.    ver   1.1   01-Sep-1994    cleanup
  20.    ver   0.1   27-Aug-1994    fixed clreol() bug
  21. */
  22.  
  23. #ifndef GENERAL_H
  24. #include "general.h"    /* machine dependent and compiler */
  25. #endif                  /*  specific stuff */
  26.  
  27.  
  28. extern void initvideo(int iomode);
  29.  
  30. /* string printing */
  31.  
  32. extern int (*input)(void);          /* pointer to keyboard input function */
  33. extern int (*output)(int);          /* pointer to console output function */
  34. extern int (*print)(const char *,...);
  35.  
  36. extern void printc(const char *s);
  37. extern void bprint(const char *s);
  38. extern void disptext(char *text[]);
  39. extern char *replicate(int i,int c);
  40.  
  41. #define put(i,c)  print(replicate(i,c))
  42.  
  43.  
  44. /* BIOS Interrupt 10h services */
  45.  
  46. extern int int10(int _ax, int _bx, int _cx, int _dx);
  47.  
  48. extern  int getcursor(void);
  49. extern void get_cursor(unsigned int *a, unsigned int *b);
  50. extern void set_cursor(unsigned int a, unsigned int b);
  51. extern  int getcursortype(void);
  52. extern void cursor(int);
  53.  
  54. #define savecursor() cursor(1)
  55. #define restcursor() cursor(0)
  56.  
  57. #define setvideo(m)              int10(m,0,0,0);
  58. #define cursoron()               int10(0x0100,0,0x0B0C,0)
  59. #define cursoroff()              int10(0x0100,0,0x2000,0)
  60. #define setcursortype(s,e)       int10(0x0100,0,(s<<8)+(e),0)
  61. #define setcurpos(r,c)           int10(0x0200,0,0,(r<<8)+(c))
  62. #define gotoxy(x,y)              int10(0x0200,0,0,(((x)<<8)|(y)));
  63. #define setcursor(c)             int10(0x0200,0,0,(c))
  64. #define cls()                    int10(0x0600,0x0700,0,0x184f)
  65. #define scrollup(n,ly,lx,ry,rx)  int10(0x0600+(n),7,(ly<<8)+(lx),(ry<<8)+(rx))
  66. #define scrolldn(n,ly,lx,ry,rx)  int10(0x0700+(n),7,(ly<<8)+(lx),(ry<<8)+(rx))
  67. #define charatcursor()           int10(0x0800,0,0,0)
  68. #define charouta(c,a)            int10(0x0900+(c),a,1,0)
  69. #define charouts(c,n)            int10(0x0A00+(c),0,n,0)
  70. #define charout(c)               int10(0x0A00+(c),0,1,0)
  71. #ifndef __BORLANDC__
  72. #define clreol()                 int10(0x0A20,0,79,0)
  73. #endif
  74. #define outchar(c)               int10(0x0E00+(c),0,0,0)
  75. #define videomode()              (int10(0x0F00,0,0,0) & 0xFF)
  76. #define curright()               setcursor(getcursor()+1)
  77. #define curleft()                setcursor(getcursor()-1)
  78.  
  79.  
  80. /* BIOS Interrupt 16h services */
  81.  
  82. extern int int16(int _ax, int _bx, int _cx, int _dx);
  83.  
  84. #define readkey()       int16(0,0,0,0)
  85. #define scankey()       int16(0,0,0,0)
  86. #define keyflags()      int16(0x0200,0,0,0)
  87. #define keyrepeat(d,r)  int16(0x0305,(d<<8)+(r),0,0)
  88. #define putkey(s,c)     int16(0x0500,0,(s<<8)+(c),0)
  89. #define ereadkey()      int16(0x1000,0,0,0)
  90. #define ekeyflags()     int16(0x1200,0,0,0)
  91.