Subversion Repositories Shiroi

Rev

Rev 10 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 nishi 1
/* $Id: shiroi_math_mk_i.c 11 2024-08-29 02:49:47Z nishi $ */
2
#include "shiroi_math_mk_i.h"
3
 
4
#include "shiroi.h"
5
 
6
#include "am9511.h"
7
 
8
void shiroi_math_mk_i_install(shiroi_t* shiroi, int slot) {
9
	shiroi->cards[slot].type = SHIROI_MATH_MARK_I;
10
	shiroi->cards[slot].mathptr = &shiroi->cards[slot].math;
11
 
12
	shiroi->cards[slot].math.am9511 = am_create(0, 0);
13
}
14
 
10 nishi 15
void shiroi_math_mk_i_reset(shiroi_t* shiroi, int slot) { am_reset(shiroi->cards[slot].math.am9511); }
16
 
1 nishi 17
void shiroi_math_mk_i(shiroi_t* shiroi) {
18
	int i;
19
 
20
	uint16_t io = Z80_GET_ADDR(shiroi->z80_pins);
21
	uint16_t addr = io & 0xff;
22
	uint16_t data = (io >> 8) & 0xff;
23
 
24
	for(i = 0; i < 256 / SHIROI_IO_PORTS; i++) {
25
		if(shiroi->cards[i].type == SHIROI_MATH_MARK_I) {
26
			if(shiroi->z80_pins & Z80_RD) {
27
				/* I/O Read */
28
				if(addr == 6) {
29
					Z80_SET_DATA(shiroi->z80_pins, am_pop(shiroi->cards[i].math.am9511));
11 nishi 30
				} else if(addr == 7) {
31
					Z80_SET_DATA(shiroi->z80_pins, 1);
1 nishi 32
				} else if(addr == 8) {
33
					Z80_SET_DATA(shiroi->z80_pins, shiroi->cards[i].type);
34
				}
35
			} else if(shiroi->z80_pins & Z80_WR) {
36
				/* I/O Write */
37
				if(addr == 6) {
38
					am_push(shiroi->cards[i].math.am9511, data);
39
				} else if(addr == 7) {
40
					am_command(shiroi->cards[i].math.am9511, data);
41
				}
42
			}
43
		}
44
	}
45
}
46
 
47
void shiroi_math_mk_i_tick(shiroi_t* shiroi) {}