Subversion Repositories Shiroi

Rev

Rev 1 | Rev 6 | 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 3 2024-08-28 09:19:04Z 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;
52
	int tick;
53
} shiroi_text_t;
54
 
55
typedef struct {
1 nishi 56
	union {
57
		shiroi_video_t video;
58
		shiroi_sound_t sound;
59
		shiroi_math_t math;
3 nishi 60
		shiroi_text_t text;
1 nishi 61
	};
62
	shiroi_video_t* videoptr;
63
	shiroi_sound_t* soundptr;
64
	shiroi_math_t* mathptr;
3 nishi 65
	shiroi_text_t* textptr;
1 nishi 66
	int type;
67
} shiroi_card_t;
68
 
69
typedef struct {
70
	uint8_t ram[64 * 1024];
71
	uint64_t z80_pins;
72
	z80_t z80;
73
	bool stop;
74
	void (*play_audio)(void* buffer, unsigned int frames);
75
	shiroi_card_t cards[256 / 3];
76
} shiroi_t;
77
 
78
void shiroi_init(shiroi_t* shiroi);
79
void shiroi_init_cards(shiroi_t* shiroi);
80
void shiroi_loop(shiroi_t* shiroi);
81
void shiroi_install(shiroi_t* shiroi, int slot, int card);
82
shiroi_card_t* shiroi_get_video_card(shiroi_t* shiroi);
83
shiroi_card_t* shiroi_get_sound_card(shiroi_t* shiroi);
84
shiroi_card_t* shiroi_get_math_card(shiroi_t* shiroi);
3 nishi 85
shiroi_card_t* shiroi_get_text_card(shiroi_t* shiroi);
1 nishi 86
 
87
#endif