Subversion Repositories Shiroi

Rev

Rev 3 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 nishi 1
/* $Id: shiroi.h 1 2024-08-28 08:10:28Z nishi $ */
2
 
3
#ifndef __SHIROI_H__
4
#define __SHIROI_H__
5
 
6
#include "chips_common.h"
7
#include "z80.h"
8
#include "ay38910.h"
9
#include "tms9918.h"
10
 
11
#include <stdint.h>
12
#include <stdbool.h>
13
 
14
#define SHIROI_IO_PORTS 3
15
 
16
enum SHIROI_CARD {
17
	SHIROI_VIDEO = 0x00,
18
	SHIROI_VIDEO_MARK_I,
19
	SHIROI_SOUND = 0x10,
20
	SHIROI_SOUND_MARK_I,
21
	SHIROI_MATH = 0x20,
22
	SHIROI_MATH_MARK_I
23
};
24
 
25
typedef struct {
26
	uint32_t* fb;
27
	union {
28
		VrEmuTms9918* vdp;
29
	};
30
	int width;
31
	int height;
32
	int tick;
33
} shiroi_video_t;
34
 
35
typedef struct {
36
	union {
37
		ay38910_t psg;
38
	};
39
	int tick;
40
} shiroi_sound_t;
41
 
42
typedef struct {
43
	union {
44
		void* am9511;
45
	};
46
	int tick;
47
} shiroi_math_t;
48
 
49
typedef struct {
50
	union {
51
		shiroi_video_t video;
52
		shiroi_sound_t sound;
53
		shiroi_math_t math;
54
	};
55
	shiroi_video_t* videoptr;
56
	shiroi_sound_t* soundptr;
57
	shiroi_math_t* mathptr;
58
	int type;
59
} shiroi_card_t;
60
 
61
typedef struct {
62
	uint8_t ram[64 * 1024];
63
	uint64_t z80_pins;
64
	z80_t z80;
65
	bool stop;
66
	void (*play_audio)(void* buffer, unsigned int frames);
67
	shiroi_card_t cards[256 / 3];
68
} shiroi_t;
69
 
70
void shiroi_init(shiroi_t* shiroi);
71
void shiroi_init_cards(shiroi_t* shiroi);
72
void shiroi_loop(shiroi_t* shiroi);
73
void shiroi_install(shiroi_t* shiroi, int slot, int card);
74
shiroi_card_t* shiroi_get_video_card(shiroi_t* shiroi);
75
shiroi_card_t* shiroi_get_sound_card(shiroi_t* shiroi);
76
shiroi_card_t* shiroi_get_math_card(shiroi_t* shiroi);
77
 
78
#endif