1 /***************************************************************************** 2 * 3 * i8x41.h 4 * Portable UPI-41/8041/8741/8042/8742 emulator interface 5 * 6 * Copyright (c) 1999 Juergen Buchmueller, all rights reserved. 7 * 8 * - This source code is released as freeware for non-commercial purposes. 9 * - You are free to use and redistribute this code in modified or 10 * unmodified form, provided you list me in the credits. 11 * - If you modify this source code, you must add a notice to each modified 12 * source file that it has been changed. If you're a nice person, you 13 * will clearly mark each change too. :) 14 * - If you wish to use this for commercial purposes, please contact me at 15 * pullmoll@t-online.de 16 * - The author of this copywritten work reserves the right to change the 17 * terms of its usage and license at any time, including retroactively 18 * - This entire notice must remain in the source code. 19 * 20 * TLP (10-Jan-2003) 21 * Added output ports registers to the debug viewer 22 * Added the Clock Divider 23 * 24 *****************************************************************************/ 25 26 #ifndef _I8X41_H 27 #define _I8X41_H 28 29 #include "cpuintrf.h" 30 #include "osd_cpu.h" 31 32 33 /* The i8x41/i8x42 input clock is divided by 15. Use it with your CPU speed */ 34 #define I8X41_CLOCK_DIVIDER 15 35 36 /* Note: 37 * I8X41_DATA is A0 = 0 and R/W 38 * I8X41_CMND is A0 = 1 and W only 39 * I8X41_STAT is A0 = 1 and R only 40 */ 41 42 43 /**************************************************************************** 44 * Interrupt constants 45 */ 46 47 #define I8X41_INT_IBF 0 /* input buffer full interrupt */ 48 #define I8X41_INT_TEST1 1 /* test1 line (also counter interrupt; taken on cntr overflow) */ 49 50 51 /**************************************************************************** 52 * Use these in the I/O port fields of your driver for the test lines - i.e, 53 * { I8X41_t0, I8X41_t0, i8041_test0_r }, 54 * { I8X41_t1, I8X41_t1, i8041_test1_r }, 55 * { I8X41_ps, I8X41_ps, i8041_port_strobe_w }, 56 */ 57 58 #define I8X41_t0 0x80 /* TEST0 input port handle */ 59 #define I8X41_t1 0x81 /* TEST1 input port handle */ 60 #define I8X41_ps 0x82 /* Prog pin strobe for expanded port sync */ 61 62 63 /**************************************************************************** 64 * The i8x41/i8x42 have 128/256 bytes of internal memory respectively 65 */ 66 67 #define I8X41_intRAM_MASK 0x7f 68 #define I8X42_intRAM_MASK 0xff 69 70 71 enum { 72 I8X41_PC=1, I8X41_SP, I8X41_PSW, I8X41_T, I8X41_DATA, I8X41_DATA_DASM, 73 I8X41_CMND, I8X41_CMND_DASM, I8X41_STAT, I8X41_P1, I8X41_P2,I8X41_A, 74 I8X41_R0, I8X41_R1, I8X41_R2, I8X41_R3, I8X41_R4, I8X41_R5, I8X41_R6, I8X41_R7 75 }; 76 77 78 79 /**************************************************************************** 80 * Public Functions 81 */ 82 83 extern int i8x41_ICount; /* cycle count */ 84 85 extern void i8x41_init (void); /* Initialize save states */ 86 extern void i8x41_reset (void *param); /* Reset registers to the initial values */ 87 extern void i8x41_exit (void); /* Shut down CPU core */ 88 extern int i8x41_execute(int cycles); /* Execute cycles - returns number of cycles actually run */ 89 extern unsigned i8x41_get_context (void *dst); /* Get registers, return context size */ 90 extern void i8x41_set_context (void *src); /* Set registers */ 91 extern unsigned i8x41_get_reg (int regnum); 92 extern void i8x41_set_reg (int regnum, unsigned val); 93 extern void i8x41_set_irq_line(int irqline, int state); 94 extern void i8x41_set_irq_callback(int (*callback)(int irqline)); 95 extern const char *i8x41_info(void *context, int regnum); 96 extern unsigned i8x41_dasm(char *buffer, unsigned pc); 97 98 #ifdef MAME_DEBUG 99 extern unsigned Dasm8x41( char *dst, unsigned pc ); 100 #endif 101 102 #endif /* _I8X41_H */ 103