~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to src/ciacore.h

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-03-27 13:06:04 UTC
  • mfrom: (4 hoary)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20050327130604-zodmv0i60dbbmcik
Tags: 1.16-3
Apply patch from Andreas Jochens <aj@andaco.de> to correct building on
AMD64 and GCC 4.x (closes: #300936)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * ciacore.h - Template file for MOS6526 (CIA) emulation.
3
 
 *
4
 
 * Written by
5
 
 *  Andr� Fachat <fachat@physik.tu-chemnitz.de>
6
 
 *  Ettore Perazzoli <ettore@comm2000.it>
7
 
 *  Andreas Boose <boose@rzgw.rz.fh-hannover.de>
8
 
 *
9
 
 * This file is part of VICE, the Versatile Commodore Emulator.
10
 
 * See README for copyright notice.
11
 
 *
12
 
 *  This program is free software; you can redistribute it and/or modify
13
 
 *  it under the terms of the GNU General Public License as published by
14
 
 *  the Free Software Foundation; either version 2 of the License, or
15
 
 *  (at your option) any later version.
16
 
 *
17
 
 *  This program is distributed in the hope that it will be useful,
18
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
 *  GNU General Public License for more details.
21
 
 *
22
 
 *  You should have received a copy of the GNU General Public License
23
 
 *  along with this program; if not, write to the Free Software
24
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25
 
 *  02111-1307  USA.
26
 
 *
27
 
 */
28
 
 
29
 
#include "vice.h"
30
 
 
31
 
#include <stdio.h>
32
 
#include <string.h>
33
 
 
34
 
#include "cia.h"
35
 
#include "log.h"
36
 
#include "types.h"
37
 
 
38
 
 
39
 
#ifdef CIA_SHARED_CODE
40
 
#define CIA_CONTEXT_PARAM       CIACONTEXT *ctxptr,
41
 
#define CIA_CONTEXT_PARVOID     CIACONTEXT *ctxptr
42
 
#define CIA_CONTEXT_CALL        ctxptr,
43
 
#define CIA_CONTEXT_CALLVOID    ctxptr
44
 
#define CIARPARM1               REGPARM2
45
 
#define CIARPARM2               REGPARM3
46
 
#else
47
 
#define CIA_CONTEXT_PARAM
48
 
#define CIA_CONTEXT_PARVOID     void
49
 
#define CIA_CONTEXT_CALL
50
 
#define CIA_CONTEXT_CALLVOID
51
 
#define CIARPARM1               REGPARM1
52
 
#define CIARPARM2               REGPARM2
53
 
#endif
54
 
 
55
 
/*
56
 
 * Prototypes for the used inline functions
57
 
 */
58
 
 
59
 
static inline void do_reset_cia(CIA_CONTEXT_PARVOID);
60
 
static inline void store_sdr(CIA_CONTEXT_PARAM BYTE byte);
61
 
static inline void read_ciaicr(CIA_CONTEXT_PARVOID);
62
 
static inline void store_ciapa(CIA_CONTEXT_PARAM CLOCK rclk, BYTE byte);
63
 
static inline void store_ciapb(CIA_CONTEXT_PARAM CLOCK rclk, BYTE byte);
64
 
static inline void pulse_ciapc(CIA_CONTEXT_PARAM CLOCK rclk);
65
 
static inline void undump_ciapa(CIA_CONTEXT_PARAM CLOCK rclk, BYTE byte);
66
 
static inline void undump_ciapb(CIA_CONTEXT_PARAM CLOCK rclk, BYTE byte);
67
 
static inline BYTE read_ciapa(CIA_CONTEXT_PARVOID);
68
 
static inline BYTE read_ciapb(CIA_CONTEXT_PARVOID);
69
 
 
70
 
 
71
 
#define STORE_OFFSET 1
72
 
#define READ_OFFSET 0
73
 
 
74
 
#define CIAT_STOPPED    0
75
 
#define CIAT_RUNNING    1
76
 
#define CIAT_COUNTTA    2
77
 
 
78
 
/*
79
 
 * Local variable and prototypes - moved here because they're used by
80
 
 * the inline functions
81
 
 */
82
 
 
83
 
static void int_ciata(CIA_CONTEXT_PARAM CLOCK offset);
84
 
static void int_ciatb(CIA_CONTEXT_PARAM CLOCK offset);
85
 
static void int_ciatod(CIA_CONTEXT_PARAM CLOCK offset);
86
 
 
87
 
#ifndef CIA_SHARED_CODE
88
 
 
89
 
#define ciaier cia[CIA_ICR]
90
 
 
91
 
static int ciaint;              /* Interrupt Flag register for cia 1 */
92
 
static CLOCK ciardi;            /* real clock = clk-offset */
93
 
 
94
 
static unsigned int cia_tat;    /* timer A toggle bit */
95
 
static unsigned int cia_tbt;    /* timer B toggle bit */
96
 
 
97
 
static CLOCK cia_todclk;        /* when is the next TOD alarm scheduled? */
98
 
 
99
 
static unsigned int ciasr_bits; /* number of bits still to send */
100
 
static BYTE cia_shifter;        /* actual shifter */
101
 
static int cia_sdr_valid;       /* when set, SDR contains new data to send */
102
 
 
103
 
static BYTE oldpa;              /* the actual output on PA (input = high) */
104
 
static BYTE oldpb;              /* the actual output on PB (input = high) */
105
 
 
106
 
static BYTE ciatodalarm[4];
107
 
static BYTE ciatodlatch[4];
108
 
static char ciatodstopped;
109
 
static char ciatodlatched;
110
 
static int ciatodticks = 100000;        /* approx. a 1/10 sec. */
111
 
 
112
 
static log_t cia_log = LOG_ERR;
113
 
 
114
 
/* global */
115
 
 
116
 
static BYTE cia[16];
117
 
 
118
 
/* local functions */
119
 
#endif
120
 
 
121
 
static void check_ciatodalarm(CIA_CONTEXT_PARAM CLOCK rclk);
122