home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / info / uforce.lzh / NES.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-25  |  1.5 KB  |  56 lines

  1. /*
  2.  
  3.  NES.h - include file for NES.c - defines and function prototypes
  4.  
  5.  Ethan Dicks  <erd@kumiss.UUCP>
  6.  
  7.  Version 1.0    24-Mar-1992
  8.  
  9. */
  10. #ifndef NES_H_INCLUDE
  11. #define NES_N_INCLUDE
  12.  
  13. #include <exec/types.h>
  14. #include <hardware/cia.h>
  15. #include <resources/cia.h>
  16.  
  17. /* Structure definition for CIA-A chip (parallel port) */
  18. extern struct CIA far ciaa;
  19.  
  20. /* bits from parallel port -- Alan's hack */
  21. #define        GDATA           0x04    /* glove data in */
  22. #define        GLATCH          0x02    /* glove latch out */
  23. #define        GCLOCK          0x01    /* glove clock out */
  24. #define        GCLOLAT         (GLATCH|GCLOCK) /* latch and clock */
  25.  
  26. #define getbit()      (ciaa.ciaprb & GDATA) >> 2
  27. #define initport()    ciaa.ciaddrb = GCLOLAT
  28.  
  29. #define     C0L0()       ciaa.ciaprb = 0        /* clock 0 latch 0 */
  30. #define     C0L1()       ciaa.ciaprb = GLATCH   /* clock 0 latch 1 */
  31. #define     C1L0()       ciaa.ciaprb = GCLOCK   /* clock 1 latch 0 */
  32. #define     C1L1()       ciaa.ciaprb = GCLOLAT  /* clock 1 latch 1 */
  33.  
  34. #define     setporta()    delay(3)
  35. #define     setportb()  delay(3)
  36.  
  37. /* convert microseconds to cia ticks */
  38. #define delay(usec) timersleep((usec*1397)/1000)
  39.  
  40. /* Function prototypes for NES.c */
  41. int control_c( void );            /* ctrl-c trap handler */
  42. UBYTE query_NES( void );        /* controller poll routine */
  43. void init_NES( void );            /* I/O port initializer */
  44.  
  45. /* Bit definitions for standard NES controller bits */
  46. #define PG_right    1
  47. #define PG_left        2
  48. #define PG_down        4
  49. #define PG_up        8
  50. #define PG_start    16
  51. #define PG_select    32
  52. #define PG_B        64
  53. #define PG_A        128
  54.  
  55. #endif /* NES_H_INCLUDE */
  56.