Subversion Repositories Shiroi

Rev

Rev 7 | Rev 12 | 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 10 2024-08-29 01:39:27Z 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"
7 nishi 10
#include "mc6847.h"
1 nishi 11
 
12
#include <stdint.h>
13
#include <stdbool.h>
14
 
15
#define SHIROI_IO_PORTS 3
16
 
17
enum SHIROI_CARD {
18
	SHIROI_VIDEO = 0x00,
19
	SHIROI_VIDEO_MARK_I,
7 nishi 20
	SHIROI_VIDEO_MARK_II,
1 nishi 21
	SHIROI_SOUND = 0x10,
22
	SHIROI_SOUND_MARK_I,
3 nishi 23
	SHIROI_SYSTEM = 0x20,
24
	SHIROI_MATH_MARK_I,
25
	SHIROI_TEXT_MARK_I
1 nishi 26
};
27
 
28
typedef struct {
7 nishi 29
	uint32_t fb[800 * 600];
1 nishi 30
	union {
31
		VrEmuTms9918* vdp;
7 nishi 32
		mc6847_t mc6847;
1 nishi 33
	};
7 nishi 34
	uint16_t vram_addr;
35
	uint8_t vram[64 * 1024];
1 nishi 36
	int width;
37
	int height;
38
	int tick;
39
} shiroi_video_t;
40
 
41
typedef struct {
42
	union {
43
		ay38910_t psg;
44
	};
45
	int tick;
46
} shiroi_sound_t;
47
 
48
typedef struct {
49
	union {
50
		void* am9511;
51
	};
52
	int tick;
53
} shiroi_math_t;
54
 
55
typedef struct {
3 nishi 56
	unsigned char key;
6 nishi 57
	bool caps;
3 nishi 58
	int tick;
59
} shiroi_text_t;
60
 
61
typedef struct {
1 nishi 62
	union {
63
		shiroi_video_t video;
64
		shiroi_sound_t sound;
65
		shiroi_math_t math;
3 nishi 66
		shiroi_text_t text;
1 nishi 67
	};
68
	shiroi_video_t* videoptr;
69
	shiroi_sound_t* soundptr;
70
	shiroi_math_t* mathptr;
3 nishi 71
	shiroi_text_t* textptr;
1 nishi 72
	int type;
73
} shiroi_card_t;
74
 
75
typedef struct {
76
	uint8_t ram[64 * 1024];
77
	uint64_t z80_pins;
78
	z80_t z80;
79
	bool stop;
80
	void (*play_audio)(void* buffer, unsigned int frames);
81
	shiroi_card_t cards[256 / 3];
10 nishi 82
	bool reset;
1 nishi 83
} shiroi_t;
84
 
85
void shiroi_init(shiroi_t* shiroi);
86
void shiroi_init_cards(shiroi_t* shiroi);
87
void shiroi_loop(shiroi_t* shiroi);
88
void shiroi_install(shiroi_t* shiroi, int slot, int card);
89
shiroi_card_t* shiroi_get_video_card(shiroi_t* shiroi);
90
shiroi_card_t* shiroi_get_sound_card(shiroi_t* shiroi);
91
shiroi_card_t* shiroi_get_math_card(shiroi_t* shiroi);
3 nishi 92
shiroi_card_t* shiroi_get_text_card(shiroi_t* shiroi);
1 nishi 93
 
94
#endif