1 /* 2 * PROJECT: ReactOS Boot Video Driver for VGA-compatible cards 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: VGA definitions 5 * COPYRIGHT: Copyright 2007 Alex Ionescu <alex.ionescu@reactos.org> 6 */ 7 8 #pragma once 9 10 extern ULONG_PTR VgaRegisterBase; 11 extern ULONG_PTR VgaBase; 12 extern USHORT AT_Initialization[]; 13 extern USHORT VGA_640x480[]; 14 extern UCHAR PixelMask[8]; 15 16 #define __inpb(Port) \ 17 READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port))) 18 19 #define __inpw(Port) \ 20 READ_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port))) 21 22 #define __outpb(Port, Value) \ 23 WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value)) 24 25 #define __outpw(Port, Value) \ 26 WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value)) 27 28 VOID 29 InitPaletteWithTable( 30 _In_ PULONG Table, 31 _In_ ULONG Count); 32 33 VOID 34 PrepareForSetPixel(VOID); 35 36 FORCEINLINE 37 VOID 38 SetPixel( 39 _In_ ULONG Left, 40 _In_ ULONG Top, 41 _In_ UCHAR Color) 42 { 43 PUCHAR PixelPosition; 44 45 /* Calculate the pixel position */ 46 PixelPosition = (PUCHAR)(VgaBase + (Left >> 3) + (Top * (SCREEN_WIDTH / 8))); 47 48 /* Select the bitmask register and write the mask */ 49 __outpw(VGA_BASE_IO_PORT + GRAPH_ADDRESS_PORT, (PixelMask[Left & 7] << 8) | IND_BIT_MASK); 50 51 /* Dummy read to load latch registers */ 52 (VOID)READ_REGISTER_UCHAR(PixelPosition); 53 54 /* Set the new color */ 55 WRITE_REGISTER_UCHAR(PixelPosition, Color); 56 } 57 58 VOID 59 PreserveRow( 60 _In_ ULONG CurrentTop, 61 _In_ ULONG TopDelta, 62 _In_ BOOLEAN Restore); 63 64 VOID 65 DoScroll( 66 _In_ ULONG Scroll); 67 68 VOID 69 DisplayCharacter( 70 _In_ CHAR Character, 71 _In_ ULONG Left, 72 _In_ ULONG Top, 73 _In_ ULONG TextColor, 74 _In_ ULONG BackColor); 75