ReactOS
0.4.16-dev-1990-gfa5cf28
pccons.c
Go to the documentation of this file.
1
/*
2
* FreeLoader
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#include <
freeldr.h
>
20
21
VOID
22
PcConsPutChar
(
int
Ch
)
23
{
24
REGS
Regs;
25
26
/* If we are displaying a CR '\n' then do a LF also */
27
if
(
'\n'
==
Ch
)
28
{
29
/* Display the LF */
30
PcConsPutChar
(
'\r'
);
31
}
32
33
/* If we are displaying a TAB '\t' then display 8 spaces ' ' */
34
if
(
'\t'
==
Ch
)
35
{
36
/* Display the 8 spaces ' ' */
37
PcConsPutChar
(
' '
);
38
PcConsPutChar
(
' '
);
39
PcConsPutChar
(
' '
);
40
PcConsPutChar
(
' '
);
41
PcConsPutChar
(
' '
);
42
PcConsPutChar
(
' '
);
43
PcConsPutChar
(
' '
);
44
PcConsPutChar
(
' '
);
45
return
;
46
}
47
48
/* Int 10h AH=0Eh
49
* VIDEO - TELETYPE OUTPUT
50
*
51
* AH = 0Eh
52
* AL = character to write
53
* BH = page number
54
* BL = foreground color (graphics modes only)
55
*/
56
Regs.
b
.
ah
= 0x0E;
57
Regs.
b
.
al
=
Ch
;
58
Regs.
w
.
bx
= 1;
59
Int386
(0x10, &Regs, &Regs);
60
}
61
62
BOOLEAN
63
PcConsKbHit
(
VOID
)
64
{
65
REGS
Regs;
66
67
/* Int 16h AH=01h
68
* KEYBOARD - CHECK FOR KEYSTROKE
69
*
70
* AH = 01h
71
* Return:
72
* ZF set if no keystroke available
73
* ZF clear if keystroke available
74
* AH = BIOS scan code
75
* AL = ASCII character
76
*/
77
Regs.
b
.
ah
= 0x01;
78
Int386
(0x16, &Regs, &Regs);
79
80
return
0 == (Regs.
x
.
eflags
&
EFLAGS_ZF
);
81
}
82
83
int
84
PcConsGetCh
(
void
)
85
{
86
REGS
Regs;
87
static
BOOLEAN
ExtendedKey
=
FALSE
;
88
static
char
ExtendedScanCode
= 0;
89
90
/* If the last time we were called an
91
* extended key was pressed then return
92
* that keys scan code. */
93
if
(
ExtendedKey
)
94
{
95
ExtendedKey
=
FALSE
;
96
return
ExtendedScanCode
;
97
}
98
99
/* Int 16h AH=00h
100
* KEYBOARD - GET KEYSTROKE
101
*
102
* AH = 00h
103
* Return:
104
* AH = BIOS scan code
105
* AL = ASCII character
106
*/
107
Regs.
b
.
ah
= 0x00;
108
Int386
(0x16, &Regs, &Regs);
109
110
/* Check for an extended keystroke */
111
if
(0 == Regs.
b
.
al
)
112
{
113
ExtendedKey
=
TRUE
;
114
ExtendedScanCode
= Regs.
b
.
ah
;
115
}
116
117
/* Return keystroke */
118
return
Regs.
b
.
al
;
119
}
120
121
/* EOF */
BOOLEAN
unsigned char BOOLEAN
Definition:
ProcessorBind.h:185
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
freeldr.h
void
Definition:
nsiface.idl:2307
EFLAGS_ZF
#define EFLAGS_ZF
Definition:
ketypes.h:194
Int386
int __cdecl Int386(int ivec, REGS *in, REGS *out)
PcConsPutChar
VOID PcConsPutChar(int Ch)
Definition:
pccons.c:22
PcConsKbHit
BOOLEAN PcConsKbHit(VOID)
Definition:
pccons.c:63
PcConsGetCh
int PcConsGetCh(void)
Definition:
pccons.c:84
Ch
#define Ch(x, y, z)
Definition:
sha2.c:141
BYTEREGS::al
unsigned char al
Definition:
pcbios.h:133
BYTEREGS::ah
unsigned char ah
Definition:
pcbios.h:134
DWORDREGS::eflags
unsigned long eflags
Definition:
pcbios.h:107
WORDREGS::bx
unsigned short bx
Definition:
pcbios.h:114
ExtendedKey
static BOOLEAN ExtendedKey
Definition:
ueficon.c:17
ExtendedScanCode
static char ExtendedScanCode
Definition:
ueficon.c:18
REGS
Definition:
pcbios.h:161
REGS::x
DWORDREGS x
Definition:
pcbios.h:162
REGS::b
BYTEREGS b
Definition:
pcbios.h:165
REGS::w
WORDREGS w
Definition:
pcbios.h:164
boot
freeldr
freeldr
arch
i386
pc
pccons.c
Generated on Sun Dec 14 2025 06:02:58 for ReactOS by
1.9.6