ReactOS  0.4.15-dev-5499-g1341c38
font.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Console Text-Mode Device Driver
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Loading specific fonts into VGA.
5  * COPYRIGHT: Copyright 2008-2019 Aleksey Bragin (aleksey@reactos.org)
6  * Copyright 2008-2019 Colin Finck (mail@colinfinck.de)
7  * Copyright 2008-2019 Christoph von Wittich (christoph_vw@reactos.org)
8  */
9 
10 /* INCLUDES ***************************************************************/
11 
12 #include "blue.h"
13 
14 //
15 // FIXME: For the moment we support only a fixed 256-char 8-bit font.
16 //
17 
20 VOID LoadFont(_In_ PUCHAR Bitplane, _In_ PUCHAR FontBitfield);
21 
22 /* FUNCTIONS ****************************************************************/
23 
24 VOID
26  _In_ PUCHAR FontBitfield)
27 {
29  PUCHAR Bitplane;
30 
31  /* open bit plane for font table access */
32  OpenBitPlane();
33 
34  /* get pointer to video memory */
35  BaseAddress.QuadPart = BITPLANE_BASE;
36  Bitplane = (PUCHAR)MmMapIoSpace(BaseAddress, 0xFFFF, MmNonCached);
37 
38  LoadFont(Bitplane, FontBitfield);
39 
40  MmUnmapIoSpace(Bitplane, 0xFFFF);
41 
42  /* close bit plane */
43  CloseBitPlane();
44 }
45 
46 /* PRIVATE FUNCTIONS *********************************************************/
47 
48 /* Font-load specific funcs */
49 VOID
51 {
52  /* disable interrupts */
53  _disable();
54 
55  /* sequence reg */
60 
61  /* graphic reg */
65 
66  /* enable interrupts */
67  _enable();
68 }
69 
70 VOID
72 {
73  /* disable interrupts */
74  _disable();
75 
76  /* sequence reg */
81 
82  /* graphic reg */
86 
87  /* enable interrupts */
88  _enable();
89 }
90 
91 VOID
93  _In_ PUCHAR Bitplane,
94  _In_ PUCHAR FontBitfield)
95 {
96  UINT32 i, j;
97 
98  for (i = 0; i < 256; i++)
99  {
100  for (j = 0; j < 8; j++)
101  {
102  *Bitplane = FontBitfield[i * 8 + j];
103  Bitplane++;
104  }
105 
106  // padding
107  for (j = 8; j < 32; j++)
108  {
109  *Bitplane = 0;
110  Bitplane++;
111  }
112  }
113 }
VOID CloseBitPlane(VOID)
Definition: font.c:71
unsigned char * PUCHAR
Definition: retypes.h:3
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define SEQ_COMMAND
Definition: blue.h:88
#define SEQ_DATA
Definition: blue.h:89
#define SEQ_MEM_MODE
Definition: blue.h:97
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
unsigned int UINT32
#define SEQ_ENABLE_WRT_PLANE
Definition: blue.h:96
#define _In_
Definition: ms_sal.h:308
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define SEQ_RESET
Definition: blue.h:95
#define GCT_DATA
Definition: blue.h:92
VOID LoadFont(_In_ PUCHAR Bitplane, _In_ PUCHAR FontBitfield)
Definition: font.c:92
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define GCT_RW_MODES
Definition: blue.h:101
#define BITPLANE_BASE
Definition: blue.h:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define GCT_GRAPH_MODE
Definition: blue.h:102
VOID ScrSetFont(_In_ PUCHAR FontBitfield)
Definition: font.c:25
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define GCT_COMMAND
Definition: blue.h:91
#define GCT_READ_PLANE
Definition: blue.h:100
VOID OpenBitPlane(VOID)
Definition: font.c:50