-
Notifications
You must be signed in to change notification settings - Fork 27
/
io.h
49 lines (38 loc) · 1.23 KB
/
io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __6502_IO__
#include <stdio.h>
#include "cpu.h"
#define IO_PAINT 0xFEE8
#define IO_PUTCHAR 0xFF00
#define IO_GETCHAR 0xFF01
#define IO_MODEFLAGS 0xFF02
// writing to ADDRL, ADDRH or READ will trigger an interrupt that will read from
// the disk address specified by ADDRL and ADDRH and write the result into READ.
// if errors are encountered, ERR will be nonzero.
#define IO_BLCK0_ADDRL 0xFF03
#define IO_BLCK0_ADDRH 0xFF04
#define IO_BLCK0_READ 0xFF05
#define IO_BLCK0_WRITE 0xFF06
#define IO_BLCK0_ERR 0xFF07
#define IO_BLCK_ERR_EOF 0x01
#define IO_BLCK_ERR_SEEK 0x02
#define IO_VTERM_START 0xFB00
#define IO_VTERM_END 0xFF00
#define IO_MODEFLAG_VTERM 0x01
#define IO_MODEFLAG_WAIT_HALT 0x02
#define IO_PAINT_BLACK 0x00
#define IO_PAINT_RED 0x01
#define IO_PAINT_GREEN 0x02
#define IO_PAINT_YELLOW 0x03
#define IO_PAINT_BLUE 0x04
#define IO_PAINT_MAGENTA 0x05
#define IO_PAINT_CYAN 0x06
#define IO_PAINT_WHITE 0x07
// bitwise-OR these with one of the colors to modify them
#define IO_PAINT_DIM 0x20
#define IO_PAINT_UNDERLINE 0x40
#define IO_PAINT_BOLD 0x80
void set_block_source(FILE *source);
void init_io();
void finish_io();
void handle_io(cpu *m);
#endif