OpenCores
URL https://opencores.org/ocsvn/t48/t48/trunk

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_1/] [sw/] [i8039emu/] [i8039.h] - Blame information for rev 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 49 arniml
/**************************************************************************
2
 *                      Intel 8039 Portable Emulator                      *
3
 *                                                                        *
4
 *                   Copyright (C) 1997 by Mirko Buffoni                  *
5
 *  Based on the original work (C) 1997 by Dan Boris, an 8048 emulator    *
6
 *     You are not allowed to distribute this software commercially       *
7
 *        Please, notify me, if you make any changes to this file         *
8
 *                                                                        *
9
 *    Adapted for the T48 uController project, 2004 by Arnim Laeuger      *
10
 *      See http://www.opencores.org/projects.cgi/web/t48/overview        *
11
 *                                                                        *
12 58 arniml
 * $Id: i8039.h,v 1.2 2004-04-15 22:03:53 arniml Exp $
13 49 arniml
 **************************************************************************/
14
 
15
#ifndef _I8039_H
16
#define _I8039_H
17
 
18
#ifndef INLINE
19
#define INLINE static inline
20
#endif
21
 
22
#include "types.h"
23
 
24
 
25
/**************************************************************************
26
    Internal Clock divisor
27
 
28
    External Clock is divided internally by 3 to produce the machine state
29
    generator. This is then divided by 5 for the instruction cycle times.
30
    (Each instruction cycle passes through 5 machine states).
31
*/
32
 
33
#define I8039_CLOCK_DIVIDER     (3*5)
34
 
35
 
36
 
37
enum { I8039_PC=1, I8039_SP, I8039_PSW, I8039_A,  I8039_TC,
38
       I8039_P1,   I8039_P2, I8039_R0,  I8039_R1, I8039_R2,
39
       I8039_R3,   I8039_R4, I8039_R5,  I8039_R6, I8039_R7
40
};
41
 
42
/*   This handling of special I/O ports should be better for actual MAME
43
 *   architecture.  (i.e., define access to ports { I8039_p1, I8039_p1, dkong_out_w })
44
 */
45
 
46
#define  I8039_p0   0x100   /* Not used */
47
#define  I8039_p1   0x101
48
#define  I8039_p2   0x102
49
#define  I8039_p4   0x104
50
#define  I8039_p5   0x105
51
#define  I8039_p6   0x106
52
#define  I8039_p7   0x107
53
#define  I8039_t0   0x110
54
#define  I8039_t1   0x111
55
#define  I8039_bus  0x120
56
 
57
 
58
#include "memory.h"
59
 
60
/*
61
 *   Input a UINT8 from given I/O port
62
 */
63
#define I8039_In(Port) ((UINT8)io_read_byte_8((UINT8)Port))
64
 
65
 
66
/*
67
 *   Output a UINT8 to given I/O port
68
 */
69
#define I8039_Out(Port,Value) (io_write_byte_8((UINT8)Port,(UINT8)Value))
70
 
71
 
72
/*
73
 *   Read a UINT8 from given memory location
74
 */
75
#define I8039_RDMEM(A) ((unsigned)program_read_byte_8(A))
76
 
77
 
78
/*
79
 *   Write a UINT8 to given memory location
80
 */
81
#define I8039_WRMEM(A,V) (program_write_byte_8(A,V))
82
 
83
 
84
/*
85
 *   I8039_RDOP() is identical to I8039_RDMEM() except it is used for reading
86
 *   opcodes. In case of system with memory mapped I/O, this function can be
87
 *   used to greatly speed up emulation
88
 */
89
#define I8039_RDOP(A) ((unsigned)cpu_readop(A))
90
 
91
 
92
/*
93
 *   I8039_RDOP_ARG() is identical to I8039_RDOP() except it is used for reading
94
 *   opcode arguments. This difference can be used to support systems that
95
 *   use different encoding mechanisms for opcodes and opcode arguments
96
 */
97
#define I8039_RDOP_ARG(A) ((unsigned)cpu_readop_arg(A))
98
 
99
int     Dasm8039(char *dst, unsigned pc);
100
 
101
void i8039_reset(void *);
102 58 arniml
int  i8039_execute(int, int);
103
void set_irq_line(int, int);
104 49 arniml
 
105
void logerror(char *, UINT16, UINT8);
106
 
107
#endif  /* _I8039_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.