-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreen.asm
168 lines (148 loc) · 3.1 KB
/
screen.asm
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
; Screen library
; NAMESPACE: "screen"
screen:
; GLOBAL SYMBOLS
screen.mode.text.4025 equ 0x01 ; 16 colors, 40x25
screen.mode.text.8025 equ 0x03 ; 16 colors, 80x25
screen.mode.gfx.cga_lowres equ 0x04 ; 4 colors, 320x200
screen.mode.gfx.cga_hires equ 0x06 ; 2 colors, 640x200
screen.mode.gfx.ega_lowres equ 0x0D ; 16 colors, 320x200
screen.mode.gfx.ega_midres equ 0x0E ; 16 colors, 640x200
screen.mode.gfx.ega_hires equ 0x10 ; 4 colors, 640x350
screen.mode.gfx.vga_hires equ 0x12 ; 16 colors, 640x480
screen.mode.gfx.vga_lowres equ 0x13 ; 256 colors, 320x200
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "setMode"
;
; param:
; al = video mode // see symbol definitions at top of file
; destroyed:
; ah
; al
macro screen.setMode
{
mov ah, 0x00
int 0x10
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "getMode"
;
; return:
; ah = number of character columns
; al = display mode
; bh = active page
macro screen.getMode
{
mov ah, 0x0F
int 0x10
}
; SECTION: "text"
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "text.setCursorPosition"
;
; param:
; bh = page number
; 0-3 in modes 2, 3
; 0-7 in modes 0, 1
; 0 in graphics modes
; dh = row
; dl = column
; destroyed:
; ah
macro screen.text.setCursorPosition
{
mov ah, 0x02
int 0x10
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "text.getCursorPosition"
;
; param:
; bh = page number
; 0-3 in modes 2, 3
; 0-7 in modes 0, 1
; 0 in graphics modes
; return:
; ax = 0x0000 (Phoenix BIOS)
; dh = row
; dl = column
; destroyed:
; ah
macro screen.text.getCursorPosition
{
mov ah, 0x03
push cx ; discard cursor shape data
int 0x10
pop cx
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "text.setCharacter"
;
; param:
; al = character to display
; bh = page number
; 0-3 in modes 2, 3
; 0-7 in modes 0, 1
; 0 in graphics modes
; bl = attribute data
; cx = number of times to write character
; destroyed:
; ah
macro screen.text.setCharacter
{
mov ah, 0x09
int 0x10
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "text.getCharacter"
;
; param:
; bh = page number
; 0-3 in modes 2, 3
; 0-7 in modes 0, 1
; 0 in graphics modes
; return:
; ah = character attribute
; al = character code
; destroyed:
; ah
macro screen.text.getCharacter
{
mov ah, 0x08
int 0x10
}
; SECTION: "gfx"
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "gfx.setPixel"
;
; param:
; bh = page number
; ignored if mode supports only one page
; al = pixel color
; if bit 7 set, value is XOR'd onto screen except in 256 color modes
; cx = column
; dx = row
; destroyed:
; ah
macro screen.gfx.setPixel
{
mov ah, 0x0C
int 0x10
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "gfx.getPixel"
;
; param:
; bh = page number
; ignored if mode supports only one page
; cx = column
; dx = row
; return:
; al = pixel color
; destroyed:
; ah
macro screen.gfx.getPixel
{
mov ah, 0x0D
int 0x10
}