File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88#pragma once
99
10- extern PUSHORT VgaArmBase ;
11-
12- #define LCDTIMING0_PPL (x ) ((((x) / 16 - 1) & 0x3f) << 2)
13- #define LCDTIMING1_LPP (x ) (((x) & 0x3ff) - 1)
14- #define LCDCONTROL_LCDPWR (1 << 11)
15- #define LCDCONTROL_LCDEN (1)
16- #define LCDCONTROL_LCDBPP (x ) (((x) & 7) << 1)
17- #define LCDCONTROL_LCDTFT (1 << 5)
18-
19- #define PL110_LCDTIMING0 (PVOID)0xE0020000
20- #define PL110_LCDTIMING1 (PVOID)0xE0020004
21- #define PL110_LCDTIMING2 (PVOID)0xE0020008
22- #define PL110_LCDUPBASE (PVOID)0xE0020010
23- #define PL110_LCDLPBASE (PVOID)0xE0020014
24- #define PL110_LCDCONTROL (PVOID)0xE0020018
25-
2610#define READ_REGISTER_ULONG (r ) (*(volatile ULONG * const)(r))
2711#define WRITE_REGISTER_ULONG (r , v ) (*(volatile ULONG *)(r) = (v))
2812
@@ -34,8 +18,7 @@ InitPaletteWithTable(
3418 _In_reads_ (Count ) const ULONG * Table ,
3519 _In_ ULONG Count );
3620
37- VOID
38- PrepareForSetPixel (VOID );
21+ #define PrepareForSetPixel ()
3922
4023VOID
4124SetPixel (
Original file line number Diff line number Diff line change 1010#define NDEBUG
1111#include <debug.h>
1212
13- PUSHORT VgaArmBase ;
14- PHYSICAL_ADDRESS VgaPhysical ;
13+ /* GLOBALS ********************************************************************/
14+
15+ #define LCDTIMING0_PPL (x ) ((((x) / 16 - 1) & 0x3f) << 2)
16+ #define LCDTIMING1_LPP (x ) (((x) & 0x3ff) - 1)
17+ #define LCDCONTROL_LCDPWR (1 << 11)
18+ #define LCDCONTROL_LCDEN (1)
19+ #define LCDCONTROL_LCDBPP (x ) (((x) & 7) << 1)
20+ #define LCDCONTROL_LCDTFT (1 << 5)
21+
22+ #define PL110_LCDTIMING0 (PVOID)0xE0020000
23+ #define PL110_LCDTIMING1 (PVOID)0xE0020004
24+ #define PL110_LCDTIMING2 (PVOID)0xE0020008
25+ #define PL110_LCDUPBASE (PVOID)0xE0020010
26+ #define PL110_LCDLPBASE (PVOID)0xE0020014
27+ #define PL110_LCDCONTROL (PVOID)0xE0020018
28+
29+ static PUSHORT VgaArmBase ;
30+ static PHYSICAL_ADDRESS VgaPhysical ;
1531
1632/* PRIVATE FUNCTIONS *********************************************************/
1733
@@ -31,13 +47,6 @@ VidpBuildColor(
3147 return ((Red & 0x1F ) << 11 ) | ((Green & 0x1F ) << 6 ) | ((Blue & 0x1F ));
3248}
3349
34- VOID
35- PrepareForSetPixel (VOID )
36- {
37- /* Nothing to prepare */
38- NOTHING ;
39- }
40-
4150FORCEINLINE
4251VOID
4352SetPixel (
Original file line number Diff line number Diff line change 77 */
88
99#include "precomp.h"
10+ #include "vga.h"
1011
1112//
1213// Minimal Attribute Controller Registers initialization command stream.
1314// Compatible EGA.
1415//
15- USHORT AT_Initialization [] =
16+ const USHORT AT_Initialization [] =
1617{
1718 /* Reset ATC to index mode */
1819 IB ,
@@ -43,7 +44,7 @@ USHORT AT_Initialization[] =
4344// 640x480 256-color 60Hz mode (BIOS mode 12) set command stream for VGA.
4445// Adapted from win32ss/drivers/miniport/vga_new/vgadata.c
4546//
46- USHORT VGA_640x480 [] =
47+ const USHORT VGA_640x480 [] =
4748{
4849 /* Write the Sequencer Registers */
4950 OWM ,
Original file line number Diff line number Diff line change 1212
1313static BOOLEAN
1414VgaInterpretCmdStream (
15- _In_ PUSHORT CmdStream )
15+ _In_ const USHORT * CmdStream )
1616{
1717 USHORT Cmd ;
1818 UCHAR Major , Minor ;
@@ -23,7 +23,8 @@ VgaInterpretCmdStream(
2323 USHORT ShortValue ;
2424
2525 /* First make sure that we have a Command Stream */
26- if (!CmdStream ) return TRUE;
26+ if (!CmdStream )
27+ return TRUE;
2728
2829 /* Loop as long as we have commands */
2930 while (* CmdStream != EOD )
@@ -63,7 +64,7 @@ VgaInterpretCmdStream(
6364 Count = * CmdStream ++ ;
6465
6566 /* Write the USHORT to the port; the buffer is what's in the command stream */
66- WRITE_PORT_BUFFER_USHORT ((PUSHORT )(VgaRegisterBase + Port ), CmdStream , Count );
67+ WRITE_PORT_BUFFER_USHORT ((PUSHORT )(VgaRegisterBase + Port ), ( PUSHORT ) CmdStream , Count );
6768
6869 /* Move past the buffer in the command stream */
6970 CmdStream += Count ;
Original file line number Diff line number Diff line change 77
88#pragma once
99
10+ #include "vga.h"
11+
1012extern ULONG_PTR VgaRegisterBase ;
1113extern ULONG_PTR VgaBase ;
12- extern USHORT AT_Initialization [];
13- extern USHORT VGA_640x480 [];
14- extern UCHAR PixelMask [8 ];
14+ extern const USHORT AT_Initialization [];
15+ extern const USHORT VGA_640x480 [];
16+ extern const UCHAR PixelMask [8 ];
1517
1618#define __inpb (Port ) \
1719 READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))
Original file line number Diff line number Diff line change 1212
1313/* GLOBALS *******************************************************************/
1414
15- static UCHAR lMaskTable [8 ] =
15+ static const UCHAR lMaskTable [8 ] =
1616{
1717 (1 << 8 ) - (1 << 0 ),
1818 (1 << 7 ) - (1 << 0 ),
@@ -23,7 +23,7 @@ static UCHAR lMaskTable[8] =
2323 (1 << 2 ) - (1 << 0 ),
2424 (1 << 1 ) - (1 << 0 )
2525};
26- static UCHAR rMaskTable [8 ] =
26+ static const UCHAR rMaskTable [8 ] =
2727{
2828 (1 << 7 ),
2929 (1 << 7 ) + (1 << 6 ),
@@ -34,7 +34,7 @@ static UCHAR rMaskTable[8] =
3434 (1 << 7 ) + (1 << 6 ) + (1 << 5 ) + (1 << 4 ) + (1 << 3 ) + (1 << 2 ) + (1 << 1 ),
3535 (1 << 7 ) + (1 << 6 ) + (1 << 5 ) + (1 << 4 ) + (1 << 3 ) + (1 << 2 ) + (1 << 1 ) + (1 << 0 ),
3636};
37- UCHAR PixelMask [8 ] =
37+ const UCHAR PixelMask [8 ] =
3838{
3939 (1 << 7 ),
4040 (1 << 6 ),
@@ -45,7 +45,7 @@ UCHAR PixelMask[8] =
4545 (1 << 1 ),
4646 (1 << 0 ),
4747};
48- static ULONG lookup [16 ] =
48+ static const ULONG lookup [16 ] =
4949{
5050 0x0000 ,
5151 0x0100 ,
Original file line number Diff line number Diff line change 88/* INCLUDES *******************************************************************/
99
1010#include "precomp.h"
11+ #include <drivers/pc98/video.h>
1112
1213/* GLOBALS ********************************************************************/
1314
14- static ULONG_PTR PegcControl = 0 ;
15- ULONG_PTR FrameBuffer = 0 ;
15+ #define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8)
1616
1717#define PEGC_MAX_COLORS 256
1818
19+ static ULONG_PTR PegcControl = 0 ;
20+ ULONG_PTR FrameBuffer = 0 ;
21+
1922/* PRIVATE FUNCTIONS **********************************************************/
2023
2124static BOOLEAN
@@ -318,12 +321,6 @@ PreserveRow(
318321 WRITE_REGISTER_ULONG (NewPosition ++ , READ_REGISTER_ULONG (OldPosition ++ ));
319322}
320323
321- VOID
322- PrepareForSetPixel (VOID )
323- {
324- NOTHING ;
325- }
326-
327324VOID
328325DoScroll (
329326 _In_ ULONG Scroll )
Original file line number Diff line number Diff line change 77
88#pragma once
99
10- /* INCLUDES *******************************************************************/
11-
12- #include <drivers/pc98/video.h>
13-
1410/* GLOBALS ********************************************************************/
1511
16- #define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8)
1712#define FB_OFFSET (x , y ) ((y) * SCREEN_WIDTH + (x))
1813
1914extern ULONG_PTR FrameBuffer ;
@@ -25,8 +20,7 @@ InitPaletteWithTable(
2520 _In_reads_ (Count ) const ULONG * Table ,
2621 _In_ ULONG Count );
2722
28- VOID
29- PrepareForSetPixel (VOID );
23+ #define PrepareForSetPixel ()
3024
3125FORCEINLINE
3226VOID
Original file line number Diff line number Diff line change 1515
1616/* GLOBALS ********************************************************************/
1717
18+ #define BB_OFFSET (x , y ) ((y) * SCREEN_WIDTH + (x))
19+ #define FB_OFFSET (x , y ) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel)
20+
1821static ULONG_PTR FrameBufferStart = 0 ;
1922static ULONG FrameBufferWidth , FrameBufferHeight , PanH , PanV ;
2023static UCHAR BytesPerPixel ;
@@ -248,13 +251,6 @@ InitPaletteWithTable(
248251 ApplyPalette ();
249252}
250253
251- VOID
252- PrepareForSetPixel (VOID )
253- {
254- /* Nothing to prepare */
255- NOTHING ;
256- }
257-
258254VOID
259255SetPixel (
260256 _In_ ULONG Left ,
Original file line number Diff line number Diff line change 99
1010#pragma once
1111
12- #define BB_OFFSET (x , y ) ((y) * SCREEN_WIDTH + (x))
13- #define FB_OFFSET (x , y ) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel)
14-
1512VOID
1613InitPaletteWithTable (
1714 _In_reads_ (Count ) const ULONG * Table ,
1815 _In_ ULONG Count );
1916
20- VOID
21- PrepareForSetPixel (VOID );
17+ #define PrepareForSetPixel ()
2218
2319VOID
2420SetPixel (
You can’t perform that action at this time.
0 commit comments