1 | /*
|
---|
2 | * Copyright (C) 2017 The Contributors
|
---|
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 3 of the License, or (at
|
---|
7 | * your option) any later version.
|
---|
8 | *
|
---|
9 | * This program is distributed in the hope that it will be useful, but
|
---|
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * General Public License for more details.
|
---|
13 | *
|
---|
14 | * A copy of the GNU General Public License can be found in the file
|
---|
15 | * "gpl-v3.txt" in the top directory of this repository.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include <stdbool.h>
|
---|
19 | #include <stddef.h>
|
---|
20 | #include <stdint.h>
|
---|
21 | #include <stdio.h>
|
---|
22 | #include <unistd.h>
|
---|
23 |
|
---|
24 | #include <m68k.h>
|
---|
25 |
|
---|
26 | #include <SDL2/SDL.h>
|
---|
27 |
|
---|
28 | #define inf(...) SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__);
|
---|
29 | #define err(...) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__);
|
---|
30 |
|
---|
31 | #define fail(...) { \
|
---|
32 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
|
---|
33 | exit(1); \
|
---|
34 | }
|
---|
35 |
|
---|
36 | #define ARRAY_COUNT(_a) (int32_t)(sizeof (_a) / sizeof (_a)[0])
|
---|
37 |
|
---|
38 | extern bool sdl_verbose;
|
---|
39 | extern bool cpu_verbose;
|
---|
40 | extern bool fpu_verbose;
|
---|
41 | extern bool vid_verbose;
|
---|
42 | extern bool tim_verbose;
|
---|
43 | extern bool lcd_verbose;
|
---|
44 | extern bool ser_verbose;
|
---|
45 | extern bool mid_verbose;
|
---|
46 | extern bool fdd_verbose;
|
---|
47 | extern bool snd_verbose;
|
---|
48 | extern bool led_verbose;
|
---|
49 | extern bool kbd_verbose;
|
---|
50 |
|
---|
51 | extern void sdl_init(void);
|
---|
52 | extern void sdl_quit(void);
|
---|
53 |
|
---|
54 | extern void cpu_loop(const char *bios);
|
---|
55 |
|
---|
56 | extern void fpu_init(void);
|
---|
57 | extern void fpu_quit(void);
|
---|
58 | extern void fpu_exec(void);
|
---|
59 | extern uint32_t fpu_read(uint32_t off, int32_t sz);
|
---|
60 | extern void fpu_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
61 |
|
---|
62 | extern void vid_init(void);
|
---|
63 | extern void vid_quit(void);
|
---|
64 | extern void vid_exec(void);
|
---|
65 | extern uint32_t vid_read(uint32_t off, int32_t sz);
|
---|
66 | extern void vid_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
67 |
|
---|
68 | extern void tim_init(void);
|
---|
69 | extern void tim_quit(void);
|
---|
70 | extern void tim_exec(void);
|
---|
71 | extern uint32_t tim_read(uint32_t off, int32_t sz);
|
---|
72 | extern void tim_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
73 |
|
---|
74 | extern void lcd_init(void);
|
---|
75 | extern void lcd_quit(void);
|
---|
76 | extern void lcd_exec(void);
|
---|
77 | extern uint32_t lcd_read(uint32_t off, int32_t sz);
|
---|
78 | extern void lcd_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
79 |
|
---|
80 | extern void ser_init(void);
|
---|
81 | extern void ser_quit(void);
|
---|
82 | extern void ser_exec(void);
|
---|
83 | extern uint32_t ser_read(uint32_t off, int32_t sz);
|
---|
84 | extern void ser_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
85 |
|
---|
86 | extern void mid_init(void);
|
---|
87 | extern void mid_quit(void);
|
---|
88 | extern void mid_exec(void);
|
---|
89 | extern uint32_t mid_read(uint32_t off, int32_t sz);
|
---|
90 | extern void mid_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
91 |
|
---|
92 | extern void fdd_init(void);
|
---|
93 | extern void fdd_quit(void);
|
---|
94 | extern void fdd_exec(void);
|
---|
95 | extern uint32_t fdd_read(uint32_t off, int32_t sz);
|
---|
96 | extern void fdd_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
97 |
|
---|
98 | extern void snd_init(void);
|
---|
99 | extern void snd_quit(void);
|
---|
100 | extern void snd_exec(void);
|
---|
101 | extern uint32_t snd_read(uint32_t off, int32_t sz);
|
---|
102 | extern void snd_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
103 |
|
---|
104 | extern void led_init(void);
|
---|
105 | extern void led_quit(void);
|
---|
106 | extern void led_exec(void);
|
---|
107 | extern uint32_t led_read(uint32_t off, int32_t sz);
|
---|
108 | extern void led_write(uint32_t off, int32_t sz, uint32_t val);
|
---|
109 |
|
---|
110 | extern void kbd_init(void);
|
---|
111 | extern void kbd_quit(void);
|
---|
112 | extern void kbd_exec(void);
|
---|
113 | extern uint32_t kbd_read(uint32_t off, int32_t sz);
|
---|
114 | extern void kbd_write(uint32_t off, int32_t sz, uint32_t val);
|
---|