/*** vfd.c ***/
/* code to drive a Noritake GU128x64-311 VFD module and to determine the
   tach reading from a '92 Toyota Corolla engine */

/* copyright (c) Andrew Huang 1998 */

/* b ports */
#define DP0  0x8000
#define WP0  0x4000

#define D0_BIT 4   /* D0-D5 on PB 9-4 */
#define D6_BIT 12  /* D7-D6 on PB 13-12 */

#define BRAD 0x0001
#define WRITE_N 0x0002


/* a ports */
#define A1_BIT 7
#define A0   0x0004
#define A6   0x0002

#define READY_N 0x0002
#define CLEAR_N 0x0001

#define PACR1 (*(volatile unsigned short *)(0x5FFFFC8))
#define PACR2 (*(volatile unsigned short *)(0x5FFFFCA))
#define PBCR1 (*(volatile unsigned short *)(0x5FFFFCC))
#define PBCR2 (*(volatile unsigned short *)(0x5FFFFCE))
#define PBIOR (*(volatile unsigned short *)(0x5FFFFC6))
#define PAIOR (*(volatile unsigned short *)(0x5FFFFC4))
#define PBDR  (*(volatile unsigned short *)(0x5FFFFC2))
#define PADR  (*(volatile unsigned short *)(0x5FFFFC0))

#define TSTR  (*(volatile unsigned char *) (0x5FFFF00))
#define TSNC  (*(volatile unsigned char *) (0x5FFFF01))
#define TMDR  (*(volatile unsigned char *) (0x5FFFF02))
#define TFCR  (*(volatile unsigned char *) (0x5FFFF03))
#define TOCR  (*(volatile unsigned char *) (0x5FFFF31))
#define TCR3  (*(volatile unsigned char *) (0x5FFFF22))
#define TIOR3 (*(volatile unsigned char *) (0x5FFFF23))
#define TIER3 (*(volatile unsigned char *) (0x5FFFF24))
#define TSR3 (*(volatile unsigned char *)  (0x5FFFF25))
#define TCNT3 (*(volatile unsigned short *) (0x5FFFF26))
#define GRA3  (*(volatile unsigned short *) (0x5FFFF28))
#define GRB3  (*(volatile unsigned short *) (0x5FFFF2A))
#define BRA3  (*(volatile unsigned short *) (0x5FFFF2C))
#define BRB3  (*(volatile unsigned short *) (0x5FFFF2E))

/* VFD bitblt modes */
#define BLT_EQUALS 0
#define BLT_OR     1
#define BLT_AND    2
#define BLT_XOR    3

/* VFD charmap defines */
#define V_HYPHEN 0x0D
#define V_0  0x10
#define V_1  0x11
#define V_2  0x12
#define V_3  0x13
#define V_4  0x14
#define V_5  0x15
#define V_6  0x16
#define V_7  0x17
#define V_8  0x18
#define V_9  0x19

