flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
BAiC 29 Jan 2014, 23:43
Dex is still active in OS development. you should talk to him. it sounds like a bug report he should be informed of rather than a public request for help.
|
|||
![]() |
|
sid123 30 Jan 2014, 06:46
Um, the BIOS loads !ONLY! the first 512 bytes into memory, means that the VESA information block which is after padding is !NOT! loaded in memory and the place you're storing the VESA Information Block is rubbish. You may need to load sectors using int 0x13.
|
|||
![]() |
|
edfed 30 Jan 2014, 09:59
vesa block will not appear at all in the binary cause it is memory reservation at the end of the source code.
vesa mode info block will be generated at run time by int 10h at the position stated in the source code. it misses another structure about vesa, the VESA_Info Code: ;-------------------------------- FASM VESA INFORMATION BLOCK ----------------------------------- VESA_Info: .Signature rb 4 ; VBE Signature .Version rw 1 ; VBE Version .OEMStringPtr rd 1 ; VbeFarPtr to OEM String .capabilities rb 4 ; Capabilities of graphics controller .VideoModePtr rd 1 ; VbeFarPtr to VideoModeList .TotalMemory rw 1 ; Number of 64kb memory blocks .OEMSoftwareRev rw 1 ; VBE implementation Software revision .OEMVendorNamePtr rd 1 ; VbeFarPtr to Vendor Name String .OEMProductNamePtr rd 1 ; VbeFarPtr to Product Name String .OEMProductRevPtr rd 1 ; VbeFarPtr to Product Revision String .Reserved rb 222 ; Reserved for VBE implementation scratch area .OEMData rb 256 ; Data Area for OEM Strings ;============================== VESA MODE INFORMATION =========================================== Mode_Info: .ModeAttributes rw 1 ; mode attributes .WinAAttributes rb 1 ; window A attributes .WinBAttributes rb 1 ; window B attributes .WinGranularity rw 1 ; window granularity .WinSize rw 1 ; window size .WinASegment rw 1 ; window A start segment .WinBSegment rw 1 ; window B start segment .WinFuncPtr rd 1 ; real mode pointer to window function .BytesPerScanLine rw 1 ; bytes per scan line .XResolution rw 1 ; horizontal resolution in pixels or characters .YResolution rw 1 ; vertical resolution in pixels or characters .XCharSize rb 1 ; character cell width in pixels .YCharSize rb 1 ; character cell height in pixels .NumberOfPlanes rb 1 ; number of memory planes .BitsPerPixel rb 1 ; bits per pixel .NumberOfBanks rb 1 ; number of banks .MemoryModel rb 1 ; memory model type .BankSize rb 1 ; bank size in KB .NumberOfImagePages rb 1 ; number of images .Reserved_page rb 1 ; reserved for page function .RedMaskSize rb 1 ; size of direct color red mask in bits .RedMaskPos rb 1 ; bit position of lsb of red mask .GreenMaskSize rb 1 ; size of direct color green mask in bits .GreenMaskPos rb 1 ; bit position of lsb of green mask .BlueMaskSize rb 1 ; size of direct color blue mask in bits .BlueMaskPos rb 1 ; bit position of lsb of blue mask .ReservedMaskSize rb 1 ; size of direct color reserved mask in bits .ReservedMaskPos rb 1 ; bit position of lsb of reserved mask .DirectColorModeInfo rb 1 ; direct color mode attributes ; VBE 2.0 extensions .PhysBasePtr rd 1 ; *physical address for flat memory frame buffer* .OffScreenMemOffset rd 1 ; Reserved - always set to 0 .OffScreenMemSize rw 1 ; Reserved - always set to 0 ; VBE 3.0 extensions .LinBytesPerScanLine rw 1 ; bytes per scan line for linear modes .BnkNumberOfPages rb 1 ; number of images for banked modes .LinNumberOfPages rb 1 ; number of images for linear modes .LinRedMaskSize rb 1 ; size of direct color red mask (linear modes) .LinRedFieldPos rb 1 ; bit position of lsb of red mask (linear modes) .LinGreenMaskSize rb 1 ; size of direct color green mask (linear modes) .LinGreenFieldPos rb 1 ; bit position of lsb of green mask (linear modes) .LinBlueMaskSize rb 1 ; size of direct color blue mask (linear modes) .LinBlueFieldPos rb 1 ; bit position of lsb of blue mask (linear modes) .LinRsvdMaskSize rb 1 ; size of direct color reserved mask (linear modes) .LinRsvdFieldPos rb 1 ; bit position of lsb of reserved mask (linear modes) .MaxPixelClock rd 1 ; maximum pixel clock (in Hz) for graphics mode ;Reserved .Reserved rb 190 ; remainder of ModeInfoBlock ;======================================= START OF PROGRAM ====================================== the init should go like this Code: Vesa: ;------------------------------------------------------------ ; Purpose: Checks to see if VESA is available and if the desired mode is ; available. ; Inputs: None ; Outputs: VESAInfo and VESA_Info structures filled (if successful) ;------------------------------------------------------------ mov dword [VESAInfo_Signature],'VBE2' mov ax,4f00h ; Is Vesa installed ? mov di,VESA_Info ; This is the address of how info block. int 10h cmp ax,004Fh ; Is vesa installed ?, jne near NoVesa2 ; If not print a mesage & quit. mov ax,4f01h ; Get Vesa Mode information. mov di,Mode_Info ; This is the address of how info block. mov cx,0x4000+vesamode ; 4112h = 32/24bit ; 0x4101 = 256bit ;4111h = 65535bit (640*480) and cx,0xfff int 10h cmp dword [VESAInfo_Signature], 'VESA' jne near NoVesa2 cmp byte [VESAInfo_Version+1], 2 jb NoVesa2 ; VESA version below 2.0 ret ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''; ; Error No Vesa2 ; ;..............................................................................................; NoVesa2: mov si,NoVesa2Msg call Print NoVesa2End: hlt jmp NoVesa2End NoVesa2Msg: db " You need vesa2 for this demo! ",0 and only in REAL MODE as you made ![]() http://board.flatassembler.net/topic.php?p=82651#82651 |
|||
![]() |
|
baldr 30 Jan 2014, 10:19
superos,
You're set VESA mode 0x112 (640×480, 24bpp) and surprisingly expected [ModeInfo_BitsPerPixel]==32?! |
|||
![]() |
|
BAiC 30 Jan 2014, 15:54
sid123 wrote: Um, the BIOS loads !ONLY! the first 512 bytes into memory, means that the VESA information block which is after padding is !NOT! loaded in memory and the place you're storing the VESA Information Block is rubbish. You may need to load sectors using int 0x13. that section is equivalent to "virtual" memory. the meory is written by the VGA BIOS function. _________________ byte me. |
|||
![]() |
|
cod3b453 30 Jan 2014, 21:44
The last time I tried VESA on VirtualPC it didn't work (the mode switch occured but I think LFB didn't work) but I believe both only support 24bit colour.
|
|||
![]() |
|
freecrac 06 Mar 2014, 12:10
baldr wrote: superos, Some VBE-Bios provide only 32 bpp and some VBE-Bios provide only 24 bpp and some other provide both bpp with different numbers like my Powercolor ATI 9800 PRO: 24 bpp with number 0x112 and 32 pbb with number 0x121. My Sapphire 7950 does not support the VBE-modenumber 0x112, but it support the resolution of 640x480x32 together with the modenumber 0x121. Dirk |
|||
![]() |
|
baldr 06 Mar 2014, 12:59
freecrac,
You shouldn't assume when there're methods to get it right. Query VBE about that mode (IIRC you may get unusual pitch too). |
|||
![]() |
|
freecrac 08 Mar 2014, 09:22
baldr wrote: freecrac, I do not really understand what you said, but i have no problems for to use the VBE, most of the VBE3-bios-functions i properly used on real hardware without an emulation. Only a stereoscopic mode i never used, because i have no shutterglasses. With a CRTC-monitor i like to get the EDID and using a refreshrate controlled mode together with the hardware triple buffering for a screenwide movement of large objects across the screen without a flickering and a tearing. But for a simplest access to the LFB and for to continue using the bios i like to use the big real mode. .. I think it is a good practice for to compare the "ModeInfo_PhysBasePtr" if it is not zero. But i never compare if the "VESAInfo_Signature" is 'VESA' and i never write 'VBE2' to the "VESAInfo_Signature". Inside of the "vbe3.pdf" i can not find the part that we have to write 'VBE2' to the "VESAInfo_Signature" inside of our reserved buffer before we can use function 0x4F00. So i do not believe that we have to write to it. I think it is enough if we check the returncode of function 0x4F00 if it is 0x4F and to compare the VBE major number if it is 2 or 3 for to make it clear that we have a VBE 2 or VBE 3 bios. But it make more sense in the beginning before we get a mode specific information and not after. For the address calculation of a screen position (and also for to calculate the start address of the second and third buffer for double and triple buffering) we have to use the scanline (LinBytesPerScanLine for LFB) and not the horizontal resolution, because the scanline is maybe longer with a part outside of the visible view. Example the scanline for a resolution of 640x480x8 is maybe 1024 bytes with a part from 640 to 1024 pixels of each line outside of the visible view. ... For a startup-code we can check the memory map and using a free memory for the VBE-information buffer and for the mode information buffer. http://wiki.osdev.org/Detecting_Memory_%28x86%29 Dirk |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.