flat assembler
Message board for the users of flat assembler.

Index > OS Construction > How does Linux set it's high res text mode?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 05 May 2010, 04:59
I'm looking for something a little more high res than 80x25, I've tried VBE modes 108h-10ch, they didn't work(I'm debugging with VMware).
Post 05 May 2010, 04:59
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 05 May 2010, 09:28
Tyler,

Can you set up VBE mode under VMware (e.g. from custom boot sector) without Linux?
Post 05 May 2010, 09:28
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 05 May 2010, 20:52
No, that's the point of asking how to. I've tried VBE modes 108h-10ch in my boot sector and none of them work. I've checked for errors(carry flag) and everything but my "kernel" always finds itself in mode 3 of int 10h, ah=0.
Post 05 May 2010, 20:52
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 06 May 2010, 00:25
Does VMware even support VESA, I get an error from DexOS?
DexOS wrote:

Vesa mode not supported
Press any key to exit.

I don't see how it can run modern OSes w/o supporting VESA. Just a note but, WinXP(in VMware) runs fine at my monitors native resolution of 1366x768. That would require VESA wouldn't it? Are there any good alternatives to VESA that are more likely to work, all I want is a text mode bigger than 80x25?
I wrote:

No, that's the point of asking how to.

Sorry, I just reread that and noticed how arrogant it sounds, it was completely unintended.
Post 06 May 2010, 00:25
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 06 May 2010, 00:47
Tyler,

I've tried VMware Workstation 7.0.1, it appears to support only graphic modes (I've used X-VESA tool from INFOVBE, VBEMP x86 Project and cross-checked with ASTRA from Sysinfo Lab).

The same picture under Bochs: only graphic modes. Bad luck.

Real firmware (ATI Radeon 9550) tells that it supports three text modes (109h 132*25, 10Ah 132*43 and 130h 132*44!?).

By the way, since VBE 2.0 mode numbers aren't fixed (though standard highly recommends to continue old mode numbers' support for compatibility with legacy software).
Post 06 May 2010, 00:47
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 06 May 2010, 02:57
Tyler wrote:
I don't see how it can run modern OSes w/o supporting VESA.

Modern OS'es only use VESA during BIOS-BOOT.
Once OS is loaded, it then loads the appropriate driver for your card.
Modern OS'es have a big collection of vidcard drivers.
If a driver is not found the OS might use VGA/VESA as last resort...

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 06 May 2010, 02:57
View user's profile Send private message Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman 06 May 2010, 03:06
Tyler wrote:
I'm looking for something a little more high res than 80x25, I've tried VBE modes 108h-10ch, they didn't work(I'm debugging with VMware)Does VMware even support VESA, I get an error from DexOS?


since you brought up DexOS, the standard text mode it runs in is 80x50. You start the 80x25 mode then reset the text from 16 bits high to 8. You might want to have the 8 bit char's in memory, since some video cards may not have an 8 bit high char set. DexOS seems a reasonably good example of how that is done. Only about half my video cards support the vesa text modes, that's the main reason for my loss of interest in cleaning up the vesa ide for dexos
Post 06 May 2010, 03:06
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 06 May 2010, 18:14
Tyler wrote:
Does VMware even support VESA, I get an error from DexOS?
DexOS wrote:

Vesa mode not supported
Press any key to exit.

I don't see how it can run modern OSes w/o supporting VESA. Just a note but, WinXP(in VMware) runs fine at my monitors native resolution of 1366x768. That would require VESA wouldn't it? Are there any good alternatives to VESA that are more likely to work, all I want is a text mode bigger than 80x25?
I wrote:

No, that's the point of asking how to.

Sorry, I just reread that and noticed how arrogant it sounds, it was completely unintended.


This is because emulator have started not to support vesa mode 640x480 32bpp
And thats what the default gui menu is set to in DexOS, if you type win in the command line you will get the xp like GUI that is set to 800x600 32bpp which is now the lowest these emulators go (for vesa graphic mode).

In the new ver the default is set to 800x600 so will not be a problem in emulaors.
Post 06 May 2010, 18:14
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 09 May 2010, 17:32
Here is how to set a higher res text mode using VGA.
http://files.osdev.org/mirrors/geezer/software/90x60.asm
It sets higher (90x60) this method should work in real
and p-mode... Of course you could use the BIOS, but this
would work with p-mode and more resiusions.

Is this is what your looking for? It is probably about how
linux does it.

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 09 May 2010, 17:32
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 09 May 2010, 19:10
Coddy41 wrote:

Is this is what your looking for?

You act like I know what I'm doing, Very Happy. But yeah, if that isn't how Linux does it, I don't care, it's good enough for me.

How can I set the font and mode 3(80x25) in pmode? I'd do it in my real mode boot loader, but I'm trying to replace my boot loader with Grub2 to make my OS multiboot compliant.
Post 09 May 2010, 19:10
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 10 May 2010, 00:25
I think you will find what you need here: http://wiki.osdev.org/VGA_Hardware
It explains how to operate the VGA decently...
Post 10 May 2010, 00:25
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 13 May 2010, 16:23
The VESA info function (0x4F00) returns a structure at di with a pointer (seg:off) to a list of the available video modes until you reach 0xFFFF. If you then do a get info on them (0x4F01) you can determine the type (text/graphic) and sizes using another structure at di to automatically find the highest supported mode.
Post 13 May 2010, 16:23
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 14 May 2010, 09:34
Before I spent the time to do that, I tried setting all the Vesa test modes I was interested in(one at a time, of coarse), and this thread was started because every one I tried didn't work. I tried every "standard" Vesa text mode(I used the list at http://davmac.org/davpage/vesa.html#detect).
Post 14 May 2010, 09:34
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 14 May 2010, 09:45
http://www.japheth.de/
Look for SETMXX
Quote:

Some small tools which set "unusual" text mode resolutions:
SETM34: 80x34 with 14 pixel font on any VGA compatible card
SETM60: 80x60 with 8 pixel font on any VGA compatible card
SETM37: 100x37 with 16 pixel font on all VESA VGA cards supporting VESA mode 0x102 (800x600x4)
SETM48: 128x48 with 16 pixel font on all VESA VGA cards supporting VESA mode 0x104 (1024x768x4)

Tested booting from a floppy into dos5 on my 8800GT, no worries.
The only one that looked strange was 80x60, too squashed.
All modes were pretty slow though (using dos) but the bios handled everything ok.
Post 14 May 2010, 09:45
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 14 May 2010, 10:00
Aren't those graphics modes(except for the 80x60, I think that's part of setting the 90x60 Coddy41 mentioned, and the 80x34 has 14 pixel font, not much better than 16)? I need a text mode so I can print text in pmode. I REALLY want to avoid writing a font driver to use in a graphics mode for now.

I think y'all have figured out all Linux's commonly used modes, when installing it allows you to choose between 8, 14(80x34 sinsi listed), and 16 pixel font, all of which have been mentioned. Thanks for your help.
Post 14 May 2010, 10:00
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4332
Location: Now
edfed 14 May 2010, 10:21
at least, did you really test to set theses modes and use them?
cause, we can speak about setting vesa text modes a very long time before to do anything....

not only setting mode is needed, you need:

1/ set vesa mode
2/ get vesa mode datas
3/ switch protected mode
4/ set a segment descriptor to vesa frame buffer
5/ use this segment to write in the frame buffer
6/ test and fix bugs

otherwise, you can use a still existing font driver for vesa graphix modes.


for the mode 3, you don't have to set it in pmode, because at boot time, it is already set. and if you want to set it, use real mode, or VGA I/O ports...
Post 14 May 2010, 10:21
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 15 May 2010, 01:47
edfed wrote:

4/ set a segment descriptor to vesa frame buffer
5/ use this segment to write in the frame buffer

Huh? Why do all that, can't I just print to the screen w/o all that, it seems to be working fine. Framebuffer... sounds scary.
Post 15 May 2010, 01:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4332
Location: Now
edfed 15 May 2010, 08:57
of course not, it is not scary.
i explain why use a segment desciptor for the frame buffer:

use a different segment than flat linear one, let you play with pixel position from 0 to maximum.
no need to add frame buffer offset to every pixel operations.
it is like mov es,[0A000h], and write pixel with mov byte[es:di],color

limit will be set to the maximum bytes in frame buffer > memory protection.

let you play transparently with a different memory than frame buffer, and then, redirect pixels writes to another routine...
Post 15 May 2010, 08:57
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 15 May 2010, 09:41
The different segment thing makes sense now, I just never thought of doing that, I've been adding 0xb8000 to everything while writing text to the screen. What is the frame buffer?
Post 15 May 2010, 09:41
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4332
Location: Now
edfed 15 May 2010, 09:47
the frame buffer can be:

VGA memory at 0A0000h linear
CGA memory at 0B8000h linear
vesa memory at vesainfo.ModeInfo_PhysBasePtr linear

video buffer where you want (will avoid flikers for graphics modes), to write on, and at vertical retrace, update the frame buffer from it.

in fact, frame buffer is not video memory, then, two kinds of things:

frame buffer : the memory buffer used to play with.

video memory : the memory to update at vertical retrace.


Code:
;-------------------------------- FASM VESA INFORMATION BLOCK -----------------------------------

VESA_Info:              
VESAInfo_Signature              rb      4      ; VBE Signature
VESAInfo_Version                rw      1      ; VBE Version
VESAInfo_OEMStringPtr           rd      1      ; VbeFarPtr to OEM String
VESAInfo_Capabilities           rb      4      ; Capabilities of graphics controller
VESAInfo_VideoModePtr           rd      1      ; VbeFarPtr to VideoModeList
VESAInfo_TotalMemory            rw      1      ; Number of 64kb memory blocks
VESAInfo_OEMSoftwareRev         rw      1      ; VBE implementation Software revision
VESAInfo_OEMVendorNamePtr       rd      1      ; VbeFarPtr to Vendor Name String
VESAInfo_OEMProductNamePtr      rd      1      ; VbeFarPtr to Product Name String
VESAInfo_OEMProductRevPtr       rd      1      ; VbeFarPtr to Product Revision String
VESAInfo_Reserved               rb      222    ; Reserved for VBE implementation scratch area
VESAInfo_OEMData                rb      256    ; Data Area for OEM Strings

;============================== VESA MODE INFORMATION ===========================================

Mode_Info:              
ModeInfo_ModeAttributes         rw      1      ; mode attributes
ModeInfo_WinAAttributes         rb      1      ; window A attributes
ModeInfo_WinBAttributes         rb      1      ; window B attributes
ModeInfo_WinGranularity         rw      1      ; window granularity
ModeInfo_WinSize                rw      1      ; window size
ModeInfo_WinASegment            rw      1      ; window A start segment
ModeInfo_WinBSegment            rw      1      ; window B start segment
ModeInfo_WinFuncPtr             rd      1      ; real mode pointer to window function
ModeInfo_BytesPerScanLine       rw      1      ; bytes per scan line
ModeInfo_XResolution            rw      1      ; horizontal resolution in pixels or characters
ModeInfo_YResolution            rw      1      ; vertical resolution in pixels or characters
ModeInfo_XCharSize              rb      1      ; character cell width in pixels
ModeInfo_YCharSize              rb      1      ; character cell height in pixels
ModeInfo_NumberOfPlanes         rb      1      ; number of memory planes
ModeInfo_BitsPerPixel           rb      1      ; bits per pixel
ModeInfo_NumberOfBanks          rb      1      ; number of banks
ModeInfo_MemoryModel            rb      1      ; memory model type
ModeInfo_BankSize               rb      1      ; bank size in KB
ModeInfo_NumberOfImagePages     rb      1      ; number of images
ModeInfo_Reserved_page          rb      1      ; reserved for page function
ModeInfo_RedMaskSize            rb      1      ; size of direct color red mask in bits
ModeInfo_RedMaskPos             rb      1      ; bit position of lsb of red mask
ModeInfo_GreenMaskSize          rb      1      ; size of direct color green mask in bits
ModeInfo_GreenMaskPos           rb      1      ; bit position of lsb of green mask
ModeInfo_BlueMaskSize           rb      1      ; size of direct color blue mask in bits
ModeInfo_BlueMaskPos            rb      1      ; bit position of lsb of blue mask
ModeInfo_ReservedMaskSize       rb      1      ; size of direct color reserved mask in bits
ModeInfo_ReservedMaskPos        rb      1      ; bit position of lsb of reserved mask
ModeInfo_DirectColorModeInfo    rb      1      ; direct color mode attributes
; VBE 2.0 extensions
ModeInfo_PhysBasePtr            rd      1      ; *physical address for flat memory frame buffer*
ModeInfo_OffScreenMemOffset     rd      1      ; Reserved - always set to 0
ModeInfo_OffScreenMemSize       rw      1      ; Reserved - always set to 0
; VBE 3.0 extensions
ModeInfo_LinBytesPerScanLine    rw      1      ; bytes per scan line for linear modes
ModeInfo_BnkNumberOfPages       rb      1      ; number of images for banked modes
ModeInfo_LinNumberOfPages       rb      1      ; number of images for linear modes
ModeInfo_LinRedMaskSize         rb      1      ; size of direct color red mask (linear modes)
ModeInfo_LinRedFieldPos         rb      1      ; bit position of lsb of red mask (linear modes)
ModeInfo_LinGreenMaskSize       rb      1      ; size of direct color green mask (linear modes)
ModeInfo_LinGreenFieldPos       rb      1      ; bit position of lsb of green mask (linear modes)
ModeInfo_LinBlueMaskSize        rb      1      ; size of direct color blue mask (linear modes)
ModeInfo_LinBlueFieldPos        rb      1      ; bit position of lsb of blue mask (linear modes)
ModeInfo_LinRsvdMaskSize        rb      1      ; size of direct color reserved mask (linear modes)
ModeInfo_LinRsvdFieldPos        rb      1      ; bit position of lsb of reserved mask (linear modes)
ModeInfo_MaxPixelClock          rd      1      ; maximum pixel clock (in Hz) for graphics mode
; Reserved
ModeInfo_Reserved               rb      190    ; remainder of ModeInfoBlock
    
Post 15 May 2010, 09:47
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.