Subversion Repositories Shiroi

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8 nishi 1
/* $Id: io.c 8 2024-08-28 16:29:15Z nishi $ */
2
 
3
#include "io.h"
4
 
5
unsigned char inp(unsigned char port) __naked {
6
__asm
7
	ld      hl,#2
8
	add     hl,sp
9
	ld      c,(hl)
10
	in      a,(c)
11
	ld      l,a
12
	ld      h,#0
13
	ret
14
__endasm;
15
}
16
 
17
void outp(unsigned char port, unsigned char data) __naked {
18
__asm
19
	push bc
20
	ld      hl,#4
21
	add     hl,sp
22
	ld      c,(hl)
23
	inc     hl
24
	ld      b,(hl)
25
	out     (c),b
26
	pop     bc
27
	ret
28
__endasm;
29
}