ReactOS 0.4.15-dev-7934-g1dc8d80
pccons.c File Reference
#include <freeldr.h>
Include dependency graph for pccons.c:

Go to the source code of this file.

Macros

#define TEXTMODE_BUFFER   0xb8000
 
#define TEXTMODE_BUFFER_SIZE   0x8000
 
#define TEXT_COLS   80
 
#define TEXT_LINES   25
 

Functions

VOID PcConsPutChar (int Ch)
 
BOOLEAN PcConsKbHit (VOID)
 
int PcConsGetCh (void)
 

Macro Definition Documentation

◆ TEXT_COLS

#define TEXT_COLS   80

Definition at line 24 of file pccons.c.

◆ TEXT_LINES

#define TEXT_LINES   25

Definition at line 25 of file pccons.c.

◆ TEXTMODE_BUFFER

#define TEXTMODE_BUFFER   0xb8000

Definition at line 21 of file pccons.c.

◆ TEXTMODE_BUFFER_SIZE

#define TEXTMODE_BUFFER_SIZE   0x8000

Definition at line 22 of file pccons.c.

Function Documentation

◆ PcConsGetCh()

int PcConsGetCh ( void  )

Definition at line 90 of file pccons.c.

91{
92 REGS Regs;
93 static BOOLEAN ExtendedKey = FALSE;
94 static char ExtendedScanCode = 0;
95
96 /* If the last time we were called an
97 * extended key was pressed then return
98 * that keys scan code. */
99 if (ExtendedKey)
100 {
102 return ExtendedScanCode;
103 }
104
105 /* Int 16h AH=00h
106 * KEYBOARD - GET KEYSTROKE
107 *
108 * AH = 00h
109 * Return:
110 * AH = BIOS scan code
111 * AL = ASCII character
112 */
113 Regs.b.ah = 0x00;
114 Int386(0x16, &Regs, &Regs);
115
116 /* Check for an extended keystroke */
117 if (0 == Regs.b.al)
118 {
120 ExtendedScanCode = Regs.b.ah;
121 }
122
123 /* Return keystroke */
124 return Regs.b.al;
125}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char al
Definition: pcbios.h:131
unsigned char ah
Definition: pcbios.h:132
static BOOLEAN ExtendedKey
Definition: ueficon.c:20
static char ExtendedScanCode
Definition: ueficon.c:21
Definition: pcbios.h:159
BYTEREGS b
Definition: pcbios.h:163

Referenced by MachInit(), and PcVideoSetDisplayMode().

◆ PcConsKbHit()

BOOLEAN PcConsKbHit ( VOID  )

Definition at line 69 of file pccons.c.

70{
71 REGS Regs;
72
73 /* Int 16h AH=01h
74 * KEYBOARD - CHECK FOR KEYSTROKE
75 *
76 * AH = 01h
77 * Return:
78 * ZF set if no keystroke available
79 * ZF clear if keystroke available
80 * AH = BIOS scan code
81 * AL = ASCII character
82 */
83 Regs.b.ah = 0x01;
84 Int386(0x16, &Regs, &Regs);
85
86 return 0 == (Regs.x.eflags & EFLAGS_ZF);
87}
#define EFLAGS_ZF
Definition: ketypes.h:185
unsigned long eflags
Definition: pcbios.h:105
DWORDREGS x
Definition: pcbios.h:160

Referenced by MachInit().

◆ PcConsPutChar()

VOID PcConsPutChar ( int  Ch)

Definition at line 28 of file pccons.c.

29{
30 REGS Regs;
31
32 /* If we are displaying a CR '\n' then do a LF also */
33 if ('\n' == Ch)
34 {
35 /* Display the LF */
36 PcConsPutChar('\r');
37 }
38
39 /* If we are displaying a TAB '\t' then display 8 spaces ' ' */
40 if ('\t' == Ch)
41 {
42 /* Display the 8 spaces ' ' */
43 PcConsPutChar(' ');
44 PcConsPutChar(' ');
45 PcConsPutChar(' ');
46 PcConsPutChar(' ');
47 PcConsPutChar(' ');
48 PcConsPutChar(' ');
49 PcConsPutChar(' ');
50 PcConsPutChar(' ');
51 return;
52 }
53
54 /* Int 10h AH=0Eh
55 * VIDEO - TELETYPE OUTPUT
56 *
57 * AH = 0Eh
58 * AL = character to write
59 * BH = page number
60 * BL = foreground color (graphics modes only)
61 */
62 Regs.b.ah = 0x0E;
63 Regs.b.al = Ch;
64 Regs.w.bx = 1;
65 Int386(0x10, &Regs, &Regs);
66}
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
#define Ch(x, y, z)
Definition: sha2.c:141
unsigned short bx
Definition: pcbios.h:112
WORDREGS w
Definition: pcbios.h:162

Referenced by MachInit(), and PcConsPutChar().