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
|
# Screen primitives for character-oriented output.
#
# Unlike the top-level, this text mode has no scrolling.
fn draw-grapheme screen: (addr screen), g: grapheme, x: int, y: int, color: int {
{
compare screen, 0
break-if-!=
draw-grapheme-on-real-screen g, x, y, color
return
}
# TODO: fake screen
}
fn cursor-position screen: (addr screen) -> _/eax: int, _/ecx: int {
{
compare screen, 0
break-if-!=
var x/eax: int <- copy 0
var y/ecx: int <- copy 0
x, y <- cursor-position-on-real-screen
return x, y
}
# TODO: fake screen
return 0, 0
}
fn set-cursor-position screen: (addr screen), x: int, y: int {
{
compare screen, 0
break-if-!=
set-cursor-position-on-real-screen x, y
return
}
# TODO: fake screen
}
fn clear-screen screen: (addr screen) {
{
compare screen, 0
break-if-!=
clear-real-screen
return
}
# TODO: fake screen
}
fn clear-real-screen {
var y/eax: int <- copy 0
{
compare y, 0x300 # 768
break-if->=
var x/edx: int <- copy 0
{
compare x, 0x400 # 1024
break-if->=
pixel-on-real-screen x, y, 0 # black
x <- increment
loop
}
y <- increment
loop
}
}
|