fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/arch/macplus/macplus.h *
7 * Created: 2007-04-15 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2007-2020 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PCE_MACPLUS_MACPLUS_H
24#define PCE_MACPLUS_MACPLUS_H 1
25
26
27#include "adb.h"
28#include "adb_keyboard.h"
29#include "adb_mouse.h"
30#include "iwm.h"
31#include "keyboard.h"
32#include "rtc.h"
33#include "scsi.h"
34#include "serial.h"
35#include "sony.h"
36#include "sound.h"
37#include "video.h"
38
39#include <chipset/e6522.h>
40#include <chipset/e8530.h>
41
42#include <cpu/e68000/e68000.h>
43
44#include <devices/memory.h>
45#include <devices/nvram.h>
46
47#include <drivers/block/block.h>
48
49#include <drivers/video/terminal.h>
50
51#include <lib/brkpt.h>
52
53
54#define PCE_MAC_PLUS 1
55#define PCE_MAC_SE 2
56#define PCE_MAC_CLASSIC 4
57
58#define PCE_MAC_SPEED_CNT 2
59#define PCE_MAC_SPEED_USER 0
60#define PCE_MAC_SPEED_IWM 1
61
62
63/*****************************************************************************
64 * @short The macplus context struct
65 *****************************************************************************/
66struct macplus_s {
67 unsigned model;
68
69 e68000_t *cpu;
70
71 memory_t *mem;
72
73 mem_blk_t *ram;
74 mem_blk_t *rom;
75
76 mem_blk_t *ram_ovl;
77 mem_blk_t *rom_ovl;
78
79 bp_set_t bps;
80
81 e6522_t via;
82 e8530_t scc;
83 mac_rtc_t rtc;
84 mac_kbd_t *kbd;
85 mac_adb_t *adb;
86 adb_kbd_t *adb_kbd;
87 adb_mouse_t *adb_mouse;
88 mac_iwm_t iwm;
89 mac_scsi_t scsi;
90 mac_sony_t sony;
91 mac_sound_t sound;
92 mac_video_t *video;
93 terminal_t *trm;
94 disks_t *dsks;
95
96 mac_ser_t ser[2];
97
98 unsigned char via_port_a;
99 unsigned char via_port_b;
100
101 int overlay;
102 int reset;
103 int memtest;
104
105 unsigned long vbuf1;
106 unsigned long vbuf2;
107
108 unsigned long sbuf1;
109 unsigned long sbuf2;
110
111 unsigned char intr;
112 unsigned char intr_scsi_via;
113
114 long mouse_delta_x;
115 long mouse_delta_y;
116 unsigned mouse_button;
117 unsigned long mouse_last_click;
118
119 unsigned disk_id;
120
121 unsigned char dcd_a;
122 unsigned char dcd_b;
123
124 char *rtc_fname;
125
126 char pause;
127 unsigned brk;
128
129 unsigned speed_factor;
130 unsigned speed_limit[PCE_MAC_SPEED_CNT];
131 unsigned long speed_clock_extra;
132
133 unsigned long sync_clk;
134 unsigned long sync_us;
135 long sync_sleep;
136
137 unsigned ser_clk;
138
139 unsigned long long clk_cnt;
140 unsigned long clk_div[4];
141};
142
143
144void mac_init (macplus_t *sim, ini_sct_t *ini);
145
146/*****************************************************************************
147 * @short Create a new macplus context
148 * @param ini A libini macplus section. Can be NULL.
149 *****************************************************************************/
150macplus_t *mac_new (ini_sct_t *ini);
151
152void mac_free (macplus_t *sim);
153
154/*****************************************************************************
155 * @short Delete a macplus context
156 *****************************************************************************/
157void mac_del (macplus_t *sim);
158
159void mac_interrupt (macplus_t *sim, unsigned level, int val);
160
161/*****************************************************************************
162 * @short Get the number of clock cycles
163 * @return The number of clock cycles the simulation went through since the
164 * last initialization
165 *****************************************************************************/
166unsigned long long mac_get_clkcnt (macplus_t *sim);
167
168void mac_clock_discontinuity (macplus_t *sim);
169
170void mac_set_pause (macplus_t *sim, int pause);
171
172void mac_set_speed (macplus_t *sim, unsigned idx, unsigned factor);
173
174int mac_set_msg_trm (macplus_t *sim, const char *msg, const char *val);
175
176int mac_set_cpu_model (macplus_t *sim, const char *model);
177
178/*****************************************************************************
179 * @short Reset the simulator
180 *****************************************************************************/
181void mac_reset (macplus_t *sim);
182
183/*****************************************************************************
184 * @short Clock the simulator
185 * @param n The number of clock cycles.
186 *****************************************************************************/
187void mac_clock (macplus_t *sim, unsigned n);
188
189
190#endif