StupidOS/boot/loader/video.inc

89 lines
1.8 KiB
PHP
Raw Normal View History

2024-04-14 05:35:43 +00:00
struc VesaInfo
{
.Signature dd ?
.Version dw ?
.OEMNamePtr dd ?
.Capabilities dd ?
.VideoModesOffset dw ?
.VideoModesSegment dw ?
.CountOf64KBlocks dw ?
.OEMSoftwareRevision dw ?
.OEMVendorNamePtr dd ?
.OEMProductNamePtr dd ?
.OEMProductRevisionPtr dd ?
.Reserved db 222 dup(?)
.OEMData db 256 dup(?)
}
2024-04-28 06:41:36 +00:00
defn VesaInfo
2024-04-14 05:35:43 +00:00
struc VesaModeInfo
{
.ModeAttributes dw ?
.WindowAAttributes db ?
.WindowBAttributes db ?
.WindowGranularity dw ?
.WindowSize dw ?
.SegmentWindowA dw ?
.SegmentWindowB dw ?
.WindowPositioning dd ?
.BytesPerScanLine dw ?
; --
.Width dw ?
.Height dw ?
.WidthChar db ?
.HeightChar db ?
.PlanesCount db ?
.BitsPerPixel db ?
.BanksCount db ?
.MemoryModel db ?
.BankSize db ?
.ImagePagesCount db ?
.Reserved db ?
.RedMaskSize db ?
.RedFieldPosition db ?
.GreenMaskSize db ?
.GreenFieldPosition db ?
.BlueMaskSize db ?
.BlueFieldPosition db ?
.ReservedMaskSize db ?
.ReservedMaskPosition db ?
.DirectColorModeInfo db ?
; -- VBE v1.2+
.Framebuffer dd ?
.OffScreenMemoryOffset dd ?
.OffScreenMemorySize dd ?
.Reserved2 db 206 dup(?)
}
defn VesaModeInfo
video_setup:
2024-04-28 06:41:36 +00:00
clc
mov di, [vesa_block_buffer]
mov ax, 0x4F00
int 0x10
cmp ax, 0x004F
jne .err
push word [vesa_block_buffer + VesaInfo.VideoModesSegment]
pop es
mov di, vesa_info_block_buffer
mov bx, [vesa_block_buffer + VesaInfo.VideoModesOffset]
mov cx, [bx]
cmp cx, 0xFFFF
je .err
mov ax, 0x4F01
int 0x10
cmp ax, 0x004F
jne .err
ret
2024-04-28 06:41:36 +00:00
.err:
stc
ret
vesa_block_buffer VesaInfo
vesa_info_block_buffer VesaModeInfo