print function

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
DarylD

Re:print function

Post by DarylD »

Basically you need to change the start address of memory that the video controller reads from. Each 80x25 screen takes up (80*25*2) = 4000 bytes. You need to change the Start Address High/Low registers under the CRTC registers to reflect the start of memory you want displayed, fairly simple really.

http://web.inter.nl.net/hcc/S.Weijgers/FreeVGA/home.htm

If you *read* the tutorials on there carefully its obvious what you need to do.

Daryl.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:print function

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:09 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:print function

Post by Pype.Clicker »

stop being such a lazy boy. Use the power of the search features!
here comes the registers being involved and you can find an example in the "_show" function of SOS (in clicker/init/sos32.asm ... can't give a link: the CVS seems down for now)
DarylD

Re:print function

Post by DarylD »

Perica, get off your proverbial @$$ and do the research yourself.

I didn't just spend 10 mins finding you the link and writing out the comment for you to come back and say "I can't be arsed doing this for myself, you do it for me and then I will be happy".

Sheesh, why do I bother.

I wouldn't mind so much if you seemed to be helping others out more often, but you dont.

You have a brain...engage it.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:print function

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:09 pm, edited 1 time in total.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:print function

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:10 pm, edited 1 time in total.
Schol-R-LEA

Re:print function

Post by Schol-R-LEA »

sigh

I'll answer the second question first: no, you cannot use general system memory for video paging, despite the fact that video memory is mapped into the general memory address space. Video memory really is separate from conventional memory, and usually is on the video card itself, but the memory bus automagically maps the memory accesses to the video card. Furthermore, video memory has to be mapped through very specific areas in the system memory: A0000-AFFFF for VGA graphics memory, B0000-B7FFF for MDA monochrome text, and B8000-BFFFF for EGA/VGA color text.

As an aside, you will note that this means that the video memory - 256K in the earliest VGA cards, going up to 256M in the high end cards today - has to be accessed in banks of 64K, an awkward system to be sure.

In the various text modes, the number of pages available is a function of the number of rows and columns, with the limiting factor being the 32K total video memory allocated for color text (MDA text, a holdover from the earliest days of the PC, has it's own 32K video space) and the design constraints of the PC video system. In the case of mode 3 (80x25 character density, 4K video page size), there are four pages available, with 8k of the remaining memory set aside for programmably-defined character shape tables and the last 8K reserved for future expansion.

Note that I'm just glossing this; the actual physical layout is somewhat more complicated, but from the programmer's point of view this is how it works.

as for working code, I'll get back to you on that, if I ever get the chance to work on it mysef...
Tim

Re:print function

Post by Tim »

Schol-R-LEA wrote:As an aside, you will note that this means that the video memory - 256K in the earliest VGA cards, going up to 256M in the high end cards today - has to be accessed in banks of 64K, an awkward system to be sure.
If you're willing to write card-specific drivers, or you go through the VESA interfaces and you find your card supports a linear frame buffer, you can get access to the full memory on your PCI video card as a single chunk. It's the same as if it were mapped at A0000, except that there's a lot more of it and it's mapped a lot higher (usually just below 4GB).
Schol-R-LEA

Re:print function

Post by Schol-R-LEA »

Thank you for pointing that out.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:print function

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:10 pm, edited 1 time in total.
Tim

Re:print function

Post by Tim »

Perica Senjak wrote:Tim: How can i find out if my card (Or the Card of the Computer i am running my OS on) supports it?
Nothing you're doing so far will need that. Ultimately you'll want to use the full capabilities of your graphics card (modes higher than 640x480x16 or 320x200x256) and for that you'll need to use the VESA BIOS extensions.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:print function

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:10 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:print function

Post by Pype.Clicker »

Perica Senjak wrote: Hey,

I want to use all of the Video Memory for extra Text Mode pages, Do you know any documentation that explains how this can be done?

Also, Video Memory mapping starts at 0xA0000 (Absoloute Address), So could i use the Memory from there for (Colour) Text Mode 3?

Cya & Thanx for the Help :D
You must be kidding, aren't you ?

Code: Select all

video_page 1=(char*) 0xb8000
video_page 2=(char*) 0xb9000
video_page 3=(char*) 0xba000
video_page 4=(char*) 0xbb000

void show(int page)
{
     int offset=page<<11;
     outw(0x3d4,256*(offset%256)+0x0c);
     outw(0x3d4,256*(offset/256)+0x0d);
}
and you'd better not ask what that d**mn code is doing or i think i'm g0774 b3 0u7 0f n3rv3z ...
It hasn't been tested
It hasn't been debugged.
That's a quick translation of sos32.asm code.
Post Reply