Subversion Repositories Shiroi

Rev

Rev 3 | Rev 7 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 nishi 1
/* $Id: shiroi.h 6 2024-08-28 10:29:32Z 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,
3 nishi 21
	SHIROI_SYSTEM = 0x20,
22
	SHIROI_MATH_MARK_I,
23
	SHIROI_TEXT_MARK_I
1 nishi 24
};
25
 
26
typedef struct {
27
	uint32_t* fb;
28
	union {
29
		VrEmuTms9918* vdp;
30
	};
31
	int width;
32
	int height;
33
	int tick;
34
} shiroi_video_t;
35
 
36
typedef struct {
37
	union {
38
		ay38910_t psg;
39
	};
40
	int tick;
41
} shiroi_sound_t;
42
 
43
typedef struct {
44
	union {
45
		void* am9511;
46
	};
47
	int tick;
48
} shiroi_math_t;
49
 
50
typedef struct {
3 nishi 51
	unsigned char key;
6 nishi 52
	bool caps;
3 nishi 53
	int tick;
54
} shiroi_text_t;
55
 
56
typedef struct {
1 nishi 57
	union {
58
		shiroi_video_t video;
59
		shiroi_sound_t sound;
60
		shiroi_math_t math;
3 nishi 61
		shiroi_text_t text;
1 nishi 62
	};
63
	shiroi_video_t* videoptr;
64
	shiroi_sound_t* soundptr;
65
	shiroi_math_t* mathptr;
3 nishi 66
	shiroi_text_t* textptr;
1 nishi 67
	int type;
68
} shiroi_card_t;
69
 
70
typedef struct {
71
	uint8_t ram[64 * 1024];
72
	uint64_t z80_pins;
73
	z80_t z80;
74
	bool stop;
75
	void (*play_audio)(void* buffer, unsigned int frames);
76
	shiroi_card_t cards[256 / 3];
77
} shiroi_t;
78
 
79
void shiroi_init(shiroi_t* shiroi);
80
void shiroi_init_cards(shiroi_t* shiroi);
81
void shiroi_loop(shiroi_t* shiroi);
82
void shiroi_install(shiroi_t* shiroi, int slot, int card);
83
shiroi_card_t* shiroi_get_video_card(shiroi_t* shiroi);
84
shiroi_card_t* shiroi_get_sound_card(shiroi_t* shiroi);
85
shiroi_card_t* shiroi_get_math_card(shiroi_t* shiroi);
3 nishi 86
shiroi_card_t* shiroi_get_text_card(shiroi_t* shiroi);
1 nishi 87
 
88
#endif