Subversion Repositories Shiroi

Rev

Rev 7 | Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 10
Line 1... Line 1...
1
/* $Id: shiroi.c 7 2024-08-28 14:02:52Z nishi $ */
1
/* $Id: shiroi.c 10 2024-08-29 01:39:27Z nishi $ */
2
 
2
 
3
#include "shiroi.h"
3
#include "shiroi.h"
4
 
4
 
5
#include "card/shiroi_video_mk_i.h"
5
#include "card/shiroi_video_mk_i.h"
6
#include "card/shiroi_video_mk_ii.h"
6
#include "card/shiroi_video_mk_ii.h"
Line 78... Line 78...
78
	} else if(card == SHIROI_TEXT_MARK_I) {
78
	} else if(card == SHIROI_TEXT_MARK_I) {
79
		shiroi_text_mk_i_install(shiroi, slot);
79
		shiroi_text_mk_i_install(shiroi, slot);
80
	}
80
	}
81
}
81
}
82
 
82
 
-
 
83
void shiroi_reset_card(shiroi_t* shiroi, int slot) {
-
 
84
	int card = shiroi->cards[slot].type;
-
 
85
	if(card == 0) {
-
 
86
	} else if(card == SHIROI_VIDEO_MARK_I) {
-
 
87
		shiroi_video_mk_i_reset(shiroi, slot);
-
 
88
	} else if(card == SHIROI_VIDEO_MARK_II) {
-
 
89
		shiroi_video_mk_ii_reset(shiroi, slot);
-
 
90
	} else if(card == SHIROI_SOUND_MARK_I) {
-
 
91
		shiroi_sound_mk_i_reset(shiroi, slot);
-
 
92
	} else if(card == SHIROI_MATH_MARK_I) {
-
 
93
		shiroi_math_mk_i_reset(shiroi, slot);
-
 
94
	} else if(card == SHIROI_TEXT_MARK_I) {
-
 
95
		shiroi_text_mk_i_reset(shiroi, slot);
-
 
96
	}
-
 
97
}
-
 
98
 
83
void shiroi_init(shiroi_t* shiroi) {
99
void shiroi_init(shiroi_t* shiroi) {
84
	shiroi->z80_pins = z80_init(&shiroi->z80);
100
	shiroi->z80_pins = z80_init(&shiroi->z80);
85
	shiroi->stop = false;
101
	shiroi->stop = false;
-
 
102
	shiroi->reset = false;
86
	shiroi->play_audio = shiroi_play_audio;
103
	shiroi->play_audio = shiroi_play_audio;
87
 
104
 
88
	int i;
105
	int i;
89
 
106
 
90
	for(i = 0; i < 480; i++) {
107
	for(i = 0; i < 480; i++) {
Line 94... Line 111...
94
 
111
 
95
void shiroi_loop(shiroi_t* shiroi) {
112
void shiroi_loop(shiroi_t* shiroi) {
96
	int x = 0;
113
	int x = 0;
97
	int y = 0;
114
	int y = 0;
98
	while(!shiroi->stop) {
115
	while(!shiroi->stop) {
-
 
116
		if(shiroi->reset) {
-
 
117
			z80_reset(&shiroi->z80);
-
 
118
			int i;
-
 
119
			for(i = 0; i < 256 / SHIROI_IO_PORTS; i++) {
-
 
120
				shiroi_reset_card(shiroi, i);
-
 
121
			}
-
 
122
			shiroi->reset = false;
-
 
123
		}
99
		shiroi->z80_pins = z80_tick(&shiroi->z80, shiroi->z80_pins);
124
		shiroi->z80_pins = z80_tick(&shiroi->z80, shiroi->z80_pins);
100
		if(shiroi->z80_pins & Z80_MREQ) {
125
		if(shiroi->z80_pins & Z80_MREQ) {
101
			uint16_t addr = Z80_GET_ADDR(shiroi->z80_pins);
126
			uint16_t addr = Z80_GET_ADDR(shiroi->z80_pins);
102
			if(shiroi->z80_pins & Z80_RD) {
127
			if(shiroi->z80_pins & Z80_RD) {
103
				uint8_t data = shiroi->ram[addr];
128
				uint8_t data = shiroi->ram[addr];