Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
xemu
cia6526.h
Go to the documentation of this file.
1
/* Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
2
Copyright (C)2016-2021 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
18
/* Based on an even more ugly JavaScript version, also from me
19
* -----------------------------------------------------------
20
* Quick&dirty 6526 CIA emulation
21
* (C)2013,2020 LGB Gabor Lenart
22
* Note: this is not an exact nor complete emulation!
23
* The only goal is to support what Commodore 64/65(?) uses even
24
* implemented incorrectly (not cycle exact, simplified, ignored
25
* conditions, etc).
26
* Some doc:
27
* http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
28
* http://www.c64-wiki.com/index.php/CIA
29
*/
30
31
#ifndef XEMU_COMMON_CIA6526_H_INCLUDED
32
#define XEMU_COMMON_CIA6526_H_INCLUDED
33
34
#include "
xemu/emutools_snapshot.h
"
35
#include <time.h>
36
37
struct
Cia6526
{
38
void (*
outa
)(
Uint8
data
);
39
void (*
outb
)(
Uint8
data
);
40
void (*
outsr
)(
Uint8
data
);
41
Uint8
(*
ina
)(void);
42
Uint8
(*
inb
)(void);
43
Uint8
(*
insr
)(void);
44
void (*
setint
)(
int
level);
45
const
char
*
name
;
46
Uint8
PRA
,
PRB
,
DDRA
,
DDRB
;
47
int
TCA
,
TCB
;
48
int
intLevel
;
49
Uint8
TLAL
,
TLAH
,
TLBL
,
TLBH
;
50
Uint8
CRA
,
CRB
;
51
Uint8
ICRmask
,
ICRdata
;
52
Uint8
SDR
;
53
Uint8
tod
[4];
54
Uint8
todAlarm
[4];
55
int
regWritten
[16];
56
};
57
58
59
extern
void
cia_init
(
60
struct
Cia6526
*cia,
const
char
*
name
,
61
void
(*outa)(
Uint8
data
),
62
void
(*outb)(
Uint8
data
),
63
void
(*outsr)(
Uint8
data
),
64
Uint8
(*ina)(
void
),
65
Uint8
(*inb)(
void
),
66
Uint8
(*insr)(
void
),
67
void
(*setint)(
int
level)
68
);
69
extern
void
cia_reset
(
struct
Cia6526
*cia);
70
extern
void
cia_write
(
struct
Cia6526
*cia,
int
addr
,
Uint8
data
);
71
extern
Uint8
cia_read
(
struct
Cia6526
*cia,
int
addr
);
72
extern
void
cia_tick
(
struct
Cia6526
*cia,
int
ticks);
73
extern
void
cia_dump_state
(
struct
Cia6526
*cia );
74
extern
void
cia_ugly_tod_updater
(
struct
Cia6526
*cia,
const
struct
tm *t,
Uint8
sec10,
int
hour_offset );
75
76
#ifdef XEMU_SNAPSHOT_SUPPORT
77
extern
int
cia_snapshot_load_state (
const
struct
xemu_snapshot_definition_st *def ,
struct
xemu_snapshot_block_st *
block
);
78
extern
int
cia_snapshot_save_state (
const
struct
xemu_snapshot_definition_st *def );
79
#endif
80
81
82
#endif
Cia6526::regWritten
int regWritten[16]
Definition:
cia6526.h:55
cia_reset
void cia_reset(struct Cia6526 *cia)
Definition:
cia6526.c:63
Cia6526::inb
Uint8(* inb)(void)
Definition:
cia6526.h:42
cia_dump_state
void cia_dump_state(struct Cia6526 *cia)
Definition:
cia6526.c:323
Cia6526::TLBH
Uint8 TLBH
Definition:
cia6526.h:49
cia_write
void cia_write(struct Cia6526 *cia, int addr, Uint8 data)
Definition:
cia6526.c:169
Cia6526::setint
void(* setint)(int level)
Definition:
cia6526.h:44
cia_tick
void cia_tick(struct Cia6526 *cia, int ticks)
Definition:
cia6526.c:281
Cia6526::DDRB
Uint8 DDRB
Definition:
cia6526.h:46
Cia6526::ICRmask
Uint8 ICRmask
Definition:
cia6526.h:51
Cia6526::todAlarm
Uint8 todAlarm[4]
Definition:
cia6526.h:54
cia_init
void cia_init(struct Cia6526 *cia, const char *name, void(*outa)(Uint8 data), void(*outb)(Uint8 data), void(*outsr)(Uint8 data), Uint8(*ina)(void), Uint8(*inb)(void), Uint8(*insr)(void), void(*setint)(int level))
Definition:
cia6526.c:98
Cia6526::TCB
int TCB
Definition:
cia6526.h:47
addr
int addr
Definition:
dma65.c:81
Cia6526::SDR
Uint8 SDR
Definition:
cia6526.h:52
cia_read
Uint8 cia_read(struct Cia6526 *cia, int addr)
Definition:
cia6526.c:121
m65-memcontent-generator.data
data
Definition:
m65-memcontent-generator.py:119
Uint8
uint8_t Uint8
Definition:
fat32.c:51
Cia6526::DDRA
Uint8 DDRA
Definition:
cia6526.h:46
Cia6526
Definition:
cia6526.h:37
block
Uint32 block
Definition:
fat32.c:156
Cia6526::insr
Uint8(* insr)(void)
Definition:
cia6526.h:43
Cia6526::ICRdata
Uint8 ICRdata
Definition:
cia6526.h:51
Cia6526::PRA
Uint8 PRA
Definition:
cia6526.h:46
Cia6526::TLAH
Uint8 TLAH
Definition:
cia6526.h:49
Cia6526::intLevel
int intLevel
Definition:
cia6526.h:48
Cia6526::name
const char * name
Definition:
cia6526.h:45
Cia6526::PRB
Uint8 PRB
Definition:
cia6526.h:46
Cia6526::CRB
Uint8 CRB
Definition:
cia6526.h:50
Cia6526::TLBL
Uint8 TLBL
Definition:
cia6526.h:49
Cia6526::ina
Uint8(* ina)(void)
Definition:
cia6526.h:41
Cia6526::TCA
int TCA
Definition:
cia6526.h:47
Cia6526::outa
void(* outa)(Uint8 data)
Definition:
cia6526.h:38
Cia6526::TLAL
Uint8 TLAL
Definition:
cia6526.h:49
emutools_snapshot.h
Cia6526::tod
Uint8 tod[4]
Definition:
cia6526.h:53
Cia6526::outb
void(* outb)(Uint8 data)
Definition:
cia6526.h:39
name
const char * name
Definition:
joystick.c:46
Cia6526::CRA
Uint8 CRA
Definition:
cia6526.h:50
cia_ugly_tod_updater
void cia_ugly_tod_updater(struct Cia6526 *cia, const struct tm *t, Uint8 sec10, int hour_offset)
Definition:
cia6526.c:270
Cia6526::outsr
void(* outsr)(Uint8 data)
Definition:
cia6526.h:40
Generated by
1.8.17