-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.c
94 lines (76 loc) · 1.13 KB
/
screen.c
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <types.h>
extern pascal void SetMasterSCB(Word) inline(0x1604,dispatcher);
extern pascal void SetAllSCBs(Word) inline(0x1404,dispatcher);
extern pascal void SetColorTable(Word, ColorTable) inline(0x0E04,dispatcher);
void ClearScreen(void);
void screen_init(void) {
#define WHITE 0x0fff
#define YELLOW 0x0ff0
#define BLACK 0x0000
#define BLUE 0x000f
#define GREEN 0x0080
#define RED 0x0f00
static ColorTable ct =
{
WHITE, // background
RED, // underline / blink
BLUE, // bold
GREEN, // foreground
WHITE,
RED,
BLUE,
GREEN,
WHITE,
RED,
BLUE,
GREEN,
WHITE,
RED,
BLUE,
GREEN,
};
unsigned i;
SetMasterSCB(0xc080);
SetAllSCBs(0xc080);
for (i = 0; i < 16; i++)
SetColorTable(i, ct);
ClearScreen();
// linearize memory, enable shadowing.
asm {
phb
pea 0xe0e0
plb
plb
sep #0x20
lda #0xC1
tsb 0xc029
lda #0x08
trb 0xc035
rep #0x20
plb
}
}
asm void screen_on(void) {
phb
pea 0xe0e0
plb
plb
sep #0x20
lda #0x80
tsb 0xc029
rep #0x20
plb
rtl
}
asm void screen_off(void) {
phb
pea 0xe0e0
plb
plb
sep #0x20
lda #0x80
trb 0xc029
rep #0x20
plb
rtl
}