home *** CD-ROM | disk | FTP | other *** search
- /* Register definitions for MIO
- * ----------------------------
- *
- * Written : March 10th, 1991
- * By : Stuart G. Phillips
- *
- * Register address definitions/bit definitions for MIO and MIO library
- * routine templates
- *
- */
-
-
- /* Control register bit definitions
- * Note register is WRITE only
- */
-
- #define HOLD 0x00
- #define RUN 0x80
- #define WC800 0x00
- #define WCC00 0x08
- #define WD800 0x10
- #define WDC00 0x18
- #define W8K 0x00
- #define W64K 0x04
- #define MIRQ2 0x00
- #define MIRQ3 0x01
- #define MIRQ5 0x02
- #define MIRQ7 0x03
-
-
- /* V40 Control registers - literal definitions
- * See NEC publication "uPD70208/216 V40/50 User's Manual"
- * Publication number NECEL-000652
- * for detailed information.
- *
- * Registers OPCN, OPHA, WCY1, WCY2, WMB, RFC are initialized by the
- * MIO Boot PROM and normally shouldnt be changed. Their values are
- * set as follows:
- *
- * OPCN:
- * 0xf0 - INT1/INT2 from INTP1/INTP2 pins
- * - Pin function select 0
- *
- * OPHA:
- * 0x00 - I/O block for internal peripherals at 0x00 -> 0xff
- *
- * WCY1:
- * 0x00 - Zero wait states for all RAM
- *
- * WCY2:
- * 0x00 - Zero wait states for refresh or DMA
- *
- * WMB:
- * 0x77 - Upper + lower memory block size = 512K
- *
- * RFC:
- * 0x8d - Refresh enable and timer divisor
- *
- */
-
- #define OPCN 0xfffe /* On-chip Peripheral Connection register */
- #define OPSEL 0xfffd /* On-chip Peripheral Selection register */
- #define OPHA 0xfffc /* On-chip Peripheral High address */
- #define DULA 0xfffb /* DMA low address register */
- #define IULA 0xfffa /* ICU low address register */
- #define TULA 0xfff9 /* TCU low address register */
- #define SULA 0xfff8 /* SCU low address register */
- #define WCY2 0xfff6 /* Wait cycle register 2 */
- #define WCY1 0xfff5 /* Wait cycle register 1 */
- #define WMB 0xfff4 /* Wait state memory boundary */
- #define RFC 0xfff2 /* Refresh control register */
- #define TCKS 0xfff0 /* Timer clock selection register */
-
-
- /* I/O Memory map for internal peripherals */
-
- #define TCUBASE 0x40 /* Timer */
- #define ICUBASE 0x50 /* Interrupt control (PIC) */
- #define DMABASE 0x60 /* DMA */
- #define IVEC 0x50 /* Interrupt vector base for ICU */
-
- /* Peripheral selects in OPSEL */
-
- #define DMAU 0x01 /* DMA Unit */
- #define ICU 0x02 /* Interrupt Unit */
- #define TCU 0x04 /* Timer Unit */
- #define SCU 0x08 /* Serial Unit */
- /* Timer control literals */
-
- #define TMD TCUBASE+3 /* Timer mode register address */
- #define TCT0 TCUBASE /* Timer count 0 */
- #define TST0 TCUBASE /* Timer status 0 */
- #define TCT1 TCUBASE+1 /* Timer count 1 */
- #define TST1 TCUBASE+1 /* Timer status 1 */
- #define TCT2 TCUBASE+2 /* Timer count 2 */
- #define TST2 TCUBASE+2 /* Timer status 2 */
-
- /* Timer mode register - TCUBASE + 3 */
-
- #define STCT0 0x00 /* Select timer 0 */
- #define STCT1 0x40 /* Select timer 1 */
- #define STCT2 0x80 /* Select timer 2 */
- #define SMLC 0xc0 /* Multiple latch */
- #define TCLC 0x00 /* Counter latch command */
- #define TLBO 0x10 /* Lower byte only */
- #define THBO 0x20 /* Higher byte only */
- #define TLFH 0x30 /* Lower byte followed by higher byte */
- #define TMOD0 0x00 /* Timer mode - 0 */
- #define TMOD1 0x02 /* Timer mode - 1 */
- #define TMOD2 0x04 /* Timer mode - 2 */
- #define TMOD3 0x06 /* Timer mode - 3 */
- #define TMOD4 0x08 /* Timer mode - 4 */
- #define TMOD5 0x0a /* Timer mode - 5 */
- #define TCBCD 0x01 /* Count value in BCD */
- #define TCHEX 0x00 /* Count value in HEX */
-
-
- /* Control bits for use with Multiple latch command */
-
- #define TC0NS 0x00 /* Counter 0 NOT selected */
- #define TC0S 0x02 /* Counter 0 selected */
- #define TC1NS 0x00 /* Counter 1 NOT selected */
- #define TC1S 0x04 /* Counter 1 selected */
- #define TC2NS 0x00 /* Counter 2 NOT selected */
- #define TC2S 0x08 /* Counter 2 selected */
- #define TSL 0x00 /* Status latched */
- #define TSNL 0x10 /* Status NOT latched */
- #define TCL 0x00 /* Count latched */
- #define TCNL 0x20 /* Count NOT latched */
- #define TNCV 0x00 /* Null count valid */
- #define TNCIV 0x40 /* Null count invalid */
- #define TOLL 0x00 /* Output level low */
- #define TOLH 0x80 /* Output level high */
-
-
- /* Interrupt Control Unit - literals */
-
- #define IMDW ICUBASE /* Interrupt Mode word */
- #define IMKW ICUBASE+1 /* Interrupt Mask word */
-
-
- /* Interrupt initialization words */
-
- #define IIW1 0x10 /* IIW1 selector */
- #define IIW4NR 0x00 /* IIW4 NOT required */
- #define IIW4R 0x01 /* IIW4 required */
- #define IEM 0x00 /* Extended mode - slave controllers */
- #define ISM 0x02 /* Single mode - no slave controllers */
- #define IET 0x00 /* Edge triggered */
- #define ILT 0x08 /* Level triggered */
- #define IIW4 0x00 /* IIW4 select */
- #define IFI 0x00 /* FI Command mode 8/
- #define ISFI 0x02 /* Self finish mode */
- #define INN 0x00 /* Normal nesting */
- #define IEN 0x10 /* Extended nesting */
- #define SI1 0x02 /* IRQ1 is slave */
- #define SI2 0x04 /* IRQ2 is slave */
- #define SI3 0x08 /* IRQ3 is slave */
- #define SI4 0x10 /* IRQ4 is slave */
- #define SI5 0x20 /* IRQ5 is slave */
- #define SI6 0x40 /* IRQ6 is slave */
- #define SI7 0x80 /* IRQ7 is slave */
-
- #define ISEOI 0x20 /* Specific End of Interrupt */
- #define IRQ0 0x00 /* IRQ 0 */
- #define IRQ1 0x01 /* IRQ 1 */
- #define IRQ2 0x02 /* IRQ 2 */
- #define IRQ3 0x03 /* IRQ 3 */
- #define IRQ4 0x04 /* IRQ 4 */
- #define IRQ5 0x05 /* IRQ 5 */
- #define IRQ6 0x06 /* IRQ 6 */
- #define IRQ7 0x07 /* IRQ 7 */
-
-
- /* Address of ROM monitor control field in shared memory window
- * Field is set to 0xF4 when the monitor is active.
- * Change the field to 0x90 causes the monitor to jump to 0000:0100
- * and begin execution from that address
- */
-
- #define BOOTCTL 0x9f
- #define WAITING 0xf4
- #define MON_GO 0x90
-
-
- /* Addresses of SCC bases */
-
- #define SCC1 0x0f40
- #define SCC2 0x0f44
-
- #define CHANA 0x02
- #define CHANB 0x00
- #define CMD 0x00
- #define DATA 0x01
-
-
- /* Inline procedure definitions */
-
- #define disable() __emit__((char)(0xfa))
- #define enable() __emit__((char)(0xfb))
-
- unsigned char __inportb__(int __portid);
- void __outportb__(int __portid,unsigned char __value);
-
- #define inportb __inportb__
- #define outportb __outportb__
-
-
- /* Library procedure templates */
-
- /* SCC.C */
-
- void scc_write (unsigned short,unsigned short,unsigned short);
- unsigned char scc_read (unsigned short,unsigned short);
- unsigned char scc_rdata (unsigned short);
- void scc_wdata(unsigned short,unsigned short);
-
-
- /* VECT.C */
-
- void setvect(int interruptno,void interrupt(far *isr)());
-