Subversion Repositories Shiroi

Rev

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

Rev Author Line No. Line
12 nishi 1
/* $Id: shiroi_debug.c 21 2024-08-31 09:25:21Z nishi $ */
2
#include "shiroi_debug.h"
3
 
4
#include "shiroi.h"
5
 
6
#include <stdlib.h>
7
 
8
void shiroi_debug_install(shiroi_t* shiroi, int slot) {
9
	shiroi->cards[slot].type = SHIROI_DEBUG;
10
	shiroi->cards[slot].debugptr = &shiroi->cards[slot].debug;
11
 
12
	int i;
13
	for(i = 0; i < 4; i++) shiroi->cards[slot].debug.latch[i] = 0xff;
14
}
15
 
16
void shiroi_debug_reset(shiroi_t* shiroi, int slot) {
17
	shiroi->cards[slot].text.key = 0;
18
	shiroi->cards[slot].text.caps = false;
19
}
20
 
21
void shiroi_debug(shiroi_t* shiroi) {
22
	int i;
23
 
24
	uint16_t io = Z80_GET_ADDR(shiroi->z80_pins);
25
	uint16_t addr = io & 0xff;
26
	uint16_t data = (io >> 8) & 0xff;
27
 
28
	for(i = 0; i < 256 / SHIROI_IO_PORTS; i++) {
29
		if(shiroi->cards[i].type == SHIROI_DEBUG) {
30
			if(shiroi->z80_pins & Z80_RD) {
31
				/* I/O Read */
32
				if(addr == 14) {
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 == 12) {
21 nishi 38
					printf("!\n");
12 nishi 39
					shiroi->cards[i].debug.latch_addr = data;
40
				} else if(addr == 13) {
41
					shiroi->cards[i].debug.latch[shiroi->cards[i].debug.latch_addr] = data;
42
				}
43
			}
44
		}
45
	}
46
}
47
 
48
void shiroi_debug_tick(shiroi_t* shiroi) {}