Subversion Repositories Shiroi

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 nishi 1
/* $Id: debug.c 18 2024-08-29 06:56:23Z nishi $ */
2
 
3
#include "debug.h"
4
 
5
#include "../io.h"
6
 
7
short debug_addr;
8
short debug_data;
9
 
10
void debug_card(int t, int port){
11
	if(t == 0x23){
12
		debug_addr = port - 2;
13
		debug_data = port - 1;
14
		debug_number(0x0000);
15
	}
16
}
17
 
18
void debug_put_number(unsigned char addr, unsigned char n){
19
	if(debug_addr == -1) return;
20
 
21
	const unsigned char hex[] = {
22
		0b01110111,
23
		0b00100100,
24
		0b01011101,
25
		0b01101101,
26
		0b00101110,
27
		0b01101011,
28
		0b01111011,
29
		0b00100111,
30
		0b01111111,
31
		0b01101111,
32
		0b00111111,
33
		0b01111010,
34
		0b01010011,
35
		0b01111100,
36
		0b01011011,
37
		0b00011011
38
	};
39
 
40
	outp(debug_addr, addr);
41
	outp(debug_data, hex[n]);
42
}
43
 
44
void debug_number(unsigned short n){
45
	int i;
46
	for(i = 0; i < 4; i++){
47
		debug_put_number(i, (n & 0xf000) >> 12);
48
		n = n << 4;
49
	}
50
}