]> git.sur5r.net Git - cc65/blobdiff - include/nes.h
Remove trailings spaces from CBM-related asm files
[cc65] / include / nes.h
index 934b8a8025cef7055544297ad1ab209c8076e823..217a90779ac716b6c644b6f8105d4216b76e896d 100644 (file)
 #define COLOR_LIGHTBLUE         0x0E
 #define COLOR_GRAY3             0x0F
 
+/* Masks for joy_read */
+#define JOY_UP_MASK     0x10
+#define JOY_DOWN_MASK   0x20
+#define JOY_LEFT_MASK   0x40
+#define JOY_RIGHT_MASK  0x80
+#define JOY_BTN_1_MASK  0x01
+#define JOY_BTN_2_MASK  0x02
+#define JOY_BTN_3_MASK  0x04
+#define JOY_BTN_4_MASK  0x08
+
+#define JOY_BTN_A_MASK  JOY_BTN_1_MASK
+#define JOY_BTN_B_MASK  JOY_BTN_2_MASK
+#define JOY_SELECT_MASK JOY_BTN_3_MASK
+#define JOY_START_MASK  JOY_BTN_4_MASK
+
+#define JOY_BTN_A(v)    ((v) & JOY_BTN_A_MASK)
+#define JOY_BTN_B(v)    ((v) & JOY_BTN_B_MASK)
+#define JOY_SELECT(v)   ((v) & JOY_SELECT_MASK)
+#define JOY_START(v)    ((v) & JOY_START_MASK)
+
 /* Return codes of get_tv */
 #define TV_NTSC         0
 #define TV_PAL          1
 /* No support for dynamically loadable drivers */
 #define DYN_DRV         0
 
-/* The joystick keys - all keys are supported */
-#define KEY_A           0x01
-#define KEY_B           0x02
-#define KEY_SELECT      0x04
-#define KEY_START       0x08
-#define KEY_UP          0x10
-#define KEY_DOWN        0x20
-#define KEY_LEFT        0x40
-#define KEY_RIGHT       0x80
-
 /* Define hardware */
 
 /* Picture Processing Unit */
@@ -155,7 +165,7 @@ struct __apu {
 };
 #define APU             (*(struct __apu*)0x4000)
 
-#define JOYPAD          ((unsigned char volatile const[2])0x4016)
+#define JOYPAD          ((unsigned char volatile[2])0x4016)
 
 /* The addresses of the static drivers */
 extern void nes_stdjoy_joy[];       /* Referred to by joy_static_stddrv[] */
@@ -163,8 +173,8 @@ extern void nes_64_56_2_tgi[];      /* Referred to by tgi_static_stddrv[] */
 
 
 
-void waitvblank (void);
-/* Wait for the vertical blanking */
+void waitvsync (void);
+/* Wait for start of the next frame */
 
 unsigned char get_tv (void);
 /* Return the video mode the machine is using. */