Skip to content

Commit e048380

Browse files
committed
[FREELDR:PC] pcvideo.c: Move PcVideoVesaGetSVGAModeInformation() and PcVideoSetBiosVesaMode() at the top
Will be used in the next commit.
1 parent afbadf5 commit e048380

File tree

1 file changed

+136
-136
lines changed

1 file changed

+136
-136
lines changed

boot/freeldr/freeldr/arch/i386/pc/pcvideo.c

Lines changed: 136 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,142 @@ PcVideoDetectVideoCard(VOID)
201201
return VIDEOCARD_EGA;
202202
}
203203

204+
static BOOLEAN
205+
PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
206+
{
207+
REGS Regs;
208+
209+
RtlZeroMemory((PVOID)BIOSCALLBUFFER, 256);
210+
211+
/* VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
212+
* AX = 4F01h
213+
* CX = SuperVGA video mode (see #04082 for bitfields)
214+
* ES:DI -> 256-byte buffer for mode information (see #00079)
215+
* Return:
216+
* AL = 4Fh if function supported
217+
* AH = status
218+
* 00h successful
219+
* ES:DI buffer filled
220+
* 01h failed
221+
*
222+
* Desc: Determine the attributes of the specified video mode.
223+
*
224+
* Note: While VBE 1.1 and higher will zero out all unused bytes
225+
* of the buffer, v1.0 did not, so applications that want to be
226+
* backward compatible should clear the buffer before calling.
227+
*/
228+
Regs.w.ax = 0x4F01;
229+
Regs.w.cx = Mode;
230+
Regs.w.es = BIOSCALLBUFSEGMENT;
231+
Regs.w.di = BIOSCALLBUFOFFSET;
232+
Int386(0x10, &Regs, &Regs);
233+
234+
if (Regs.w.ax != 0x004F)
235+
return FALSE;
236+
237+
RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(SVGA_MODE_INFORMATION));
238+
239+
TRACE("\n");
240+
TRACE("BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
241+
TRACE("ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
242+
TRACE("WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
243+
TRACE("WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
244+
TRACE("WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
245+
TRACE("WindowSize = %dKB\n", ModeInformation->WindowSize);
246+
TRACE("WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
247+
TRACE("WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
248+
TRACE("WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
249+
TRACE("BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
250+
TRACE("WidthInPixels = %d\n", ModeInformation->WidthInPixels);
251+
TRACE("HeightInPixels = %d\n", ModeInformation->HeightInPixels);
252+
TRACE("CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
253+
TRACE("CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
254+
TRACE("NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
255+
TRACE("BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
256+
TRACE("NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
257+
TRACE("MemoryModel = %d\n", ModeInformation->MemoryModel);
258+
TRACE("BankSize = %d\n", ModeInformation->BankSize);
259+
TRACE("NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
260+
TRACE("---VBE v1.2+ ---\n");
261+
TRACE("RedMaskSize = %d\n", ModeInformation->RedMaskSize);
262+
TRACE("RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
263+
TRACE("GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
264+
TRACE("GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
265+
TRACE("BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
266+
TRACE("BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
267+
TRACE("ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
268+
TRACE("ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
269+
TRACE("\n");
270+
271+
return TRUE;
272+
}
273+
274+
static BOOLEAN
275+
PcVideoSetBiosVesaMode(USHORT Mode)
276+
{
277+
REGS Regs;
278+
279+
/* Int 10h AX=4F02h
280+
* VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
281+
*
282+
* AX = 4F02h
283+
* BX = new video mode
284+
* ES:DI -> (VBE 3.0+) CRTC information block, bit mode bit 11 set
285+
* Return:
286+
* AL = 4Fh if function supported
287+
* AH = status
288+
* 00h successful
289+
* 01h failed
290+
*
291+
* Values for VESA video mode:
292+
* 00h-FFh OEM video modes (see #00010 at AH=00h)
293+
* 100h 640x400x256
294+
* 101h 640x480x256
295+
* 102h 800x600x16
296+
* 103h 800x600x256
297+
* 104h 1024x768x16
298+
* 105h 1024x768x256
299+
* 106h 1280x1024x16
300+
* 107h 1280x1024x256
301+
* 108h 80x60 text
302+
* 109h 132x25 text
303+
* 10Ah 132x43 text
304+
* 10Bh 132x50 text
305+
* 10Ch 132x60 text
306+
* ---VBE v1.2+ ---
307+
* 10Dh 320x200x32K
308+
* 10Eh 320x200x64K
309+
* 10Fh 320x200x16M
310+
* 110h 640x480x32K
311+
* 111h 640x480x64K
312+
* 112h 640x480x16M
313+
* 113h 800x600x32K
314+
* 114h 800x600x64K
315+
* 115h 800x600x16M
316+
* 116h 1024x768x32K
317+
* 117h 1024x768x64K
318+
* 118h 1024x768x16M
319+
* 119h 1280x1024x32K (1:5:5:5)
320+
* 11Ah 1280x1024x64K (5:6:5)
321+
* 11Bh 1280x1024x16M
322+
* ---VBE 2.0+ ---
323+
* 120h 1600x1200x256
324+
* 121h 1600x1200x32K
325+
* 122h 1600x1200x64K
326+
* 81FFh special full-memory access mode
327+
*
328+
* Notes: The special mode 81FFh preserves the contents of the video memory and gives
329+
* access to all of the memory; VESA recommends that the special mode be a packed-pixel
330+
* mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
331+
* in the list of available modes (mode information for this mode can be queried
332+
* directly, however). As of VBE 2.0, VESA will no longer define video mode numbers.
333+
*/
334+
Regs.w.ax = 0x4F02;
335+
Regs.w.bx = Mode;
336+
Int386(0x10, &Regs, &Regs);
337+
return (Regs.w.ax == 0x004F);
338+
}
339+
204340
static VOID
205341
PcVideoSetBiosMode(UCHAR VideoMode)
206342
{
@@ -440,142 +576,6 @@ PcVideoSetDisplayEnd(VOID)
440576
WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
441577
}
442578

443-
static BOOLEAN
444-
PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
445-
{
446-
REGS Regs;
447-
448-
RtlZeroMemory((PVOID)BIOSCALLBUFFER, 256);
449-
450-
/* VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
451-
* AX = 4F01h
452-
* CX = SuperVGA video mode (see #04082 for bitfields)
453-
* ES:DI -> 256-byte buffer for mode information (see #00079)
454-
* Return:
455-
* AL = 4Fh if function supported
456-
* AH = status
457-
* 00h successful
458-
* ES:DI buffer filled
459-
* 01h failed
460-
*
461-
* Desc: Determine the attributes of the specified video mode.
462-
*
463-
* Note: While VBE 1.1 and higher will zero out all unused bytes
464-
* of the buffer, v1.0 did not, so applications that want to be
465-
* backward compatible should clear the buffer before calling.
466-
*/
467-
Regs.w.ax = 0x4F01;
468-
Regs.w.cx = Mode;
469-
Regs.w.es = BIOSCALLBUFSEGMENT;
470-
Regs.w.di = BIOSCALLBUFOFFSET;
471-
Int386(0x10, &Regs, &Regs);
472-
473-
if (Regs.w.ax != 0x004F)
474-
return FALSE;
475-
476-
RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(SVGA_MODE_INFORMATION));
477-
478-
TRACE("\n");
479-
TRACE("BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
480-
TRACE("ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
481-
TRACE("WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
482-
TRACE("WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
483-
TRACE("WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
484-
TRACE("WindowSize = %dKB\n", ModeInformation->WindowSize);
485-
TRACE("WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
486-
TRACE("WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
487-
TRACE("WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
488-
TRACE("BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
489-
TRACE("WidthInPixels = %d\n", ModeInformation->WidthInPixels);
490-
TRACE("HeightInPixels = %d\n", ModeInformation->HeightInPixels);
491-
TRACE("CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
492-
TRACE("CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
493-
TRACE("NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
494-
TRACE("BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
495-
TRACE("NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
496-
TRACE("MemoryModel = %d\n", ModeInformation->MemoryModel);
497-
TRACE("BankSize = %d\n", ModeInformation->BankSize);
498-
TRACE("NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
499-
TRACE("---VBE v1.2+ ---\n");
500-
TRACE("RedMaskSize = %d\n", ModeInformation->RedMaskSize);
501-
TRACE("RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
502-
TRACE("GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
503-
TRACE("GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
504-
TRACE("BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
505-
TRACE("BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
506-
TRACE("ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
507-
TRACE("ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
508-
TRACE("\n");
509-
510-
return TRUE;
511-
}
512-
513-
static BOOLEAN
514-
PcVideoSetBiosVesaMode(USHORT Mode)
515-
{
516-
REGS Regs;
517-
518-
/* Int 10h AX=4F02h
519-
* VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
520-
*
521-
* AX = 4F02h
522-
* BX = new video mode
523-
* ES:DI -> (VBE 3.0+) CRTC information block, bit mode bit 11 set
524-
* Return:
525-
* AL = 4Fh if function supported
526-
* AH = status
527-
* 00h successful
528-
* 01h failed
529-
*
530-
* Values for VESA video mode:
531-
* 00h-FFh OEM video modes (see #00010 at AH=00h)
532-
* 100h 640x400x256
533-
* 101h 640x480x256
534-
* 102h 800x600x16
535-
* 103h 800x600x256
536-
* 104h 1024x768x16
537-
* 105h 1024x768x256
538-
* 106h 1280x1024x16
539-
* 107h 1280x1024x256
540-
* 108h 80x60 text
541-
* 109h 132x25 text
542-
* 10Ah 132x43 text
543-
* 10Bh 132x50 text
544-
* 10Ch 132x60 text
545-
* ---VBE v1.2+ ---
546-
* 10Dh 320x200x32K
547-
* 10Eh 320x200x64K
548-
* 10Fh 320x200x16M
549-
* 110h 640x480x32K
550-
* 111h 640x480x64K
551-
* 112h 640x480x16M
552-
* 113h 800x600x32K
553-
* 114h 800x600x64K
554-
* 115h 800x600x16M
555-
* 116h 1024x768x32K
556-
* 117h 1024x768x64K
557-
* 118h 1024x768x16M
558-
* 119h 1280x1024x32K (1:5:5:5)
559-
* 11Ah 1280x1024x64K (5:6:5)
560-
* 11Bh 1280x1024x16M
561-
* ---VBE 2.0+ ---
562-
* 120h 1600x1200x256
563-
* 121h 1600x1200x32K
564-
* 122h 1600x1200x64K
565-
* 81FFh special full-memory access mode
566-
*
567-
* Notes: The special mode 81FFh preserves the contents of the video memory and gives
568-
* access to all of the memory; VESA recommends that the special mode be a packed-pixel
569-
* mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
570-
* in the list of available modes (mode information for this mode can be queried
571-
* directly, however). As of VBE 2.0, VESA will no longer define video mode numbers.
572-
*/
573-
Regs.w.ax = 0x4F02;
574-
Regs.w.bx = Mode;
575-
Int386(0x10, &Regs, &Regs);
576-
return (Regs.w.ax == 0x004F);
577-
}
578-
579579
static BOOLEAN
580580
PcVideoSetMode80x25(VOID)
581581
{

0 commit comments

Comments
 (0)