I'm looking at http://www.osdever.net/documents/vga_po ... ?the_id=26, and I've also looked at Ralph Brown's List, but neither give me much clarity on the subject. I'm sure it is rather simple, once you know it.
My question is this: in the link above, what's the difference between a port and a port-index. And when I'm looking to, for example, change the chain4 plane modes, how do I know the actual port to write to.
Thanks for any help,
smbogan
VGA port-index
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
This is a more elaborate reference of the vga registers, including how to write to them - you may want to try this instead:
http://www.osdever.net/FreeVGA/vga/vga.htm
Beware that several sets of vga registers are programmed differently. only one such set is written through one port.
You can also have a look at some of my own code snippets
http://www.osdever.net/FreeVGA/vga/vga.htm
Beware that several sets of vga registers are programmed differently. only one such set is written through one port.
You can also have a look at some of my own code snippets
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
so i wasn't remembering that bad. The BASIC code makes it even more obvious, indeed.
One thing that has never been clear to me with that approach is how one can be sure he's sending out the index, and not the data. In odd situation after the boot, i can remind of some S3 video cards that were messing up the two for some of their IO ports (which was annoying as hell)
One thing that has never been clear to me with that approach is how one can be sure he's sending out the index, and not the data. In odd situation after the boot, i can remind of some S3 video cards that were messing up the two for some of their IO ports (which was annoying as hell)
Well unless your talking about a specific VGA port that I don't know of that is "flipped flopped", they have a index port with a differnt data port number pair.
If it helps, heres an assembly sample making use of the VGA registers but was only tested under my VGA card.
If it helps, heres an assembly sample making use of the VGA registers but was only tested under my VGA card.
Code: Select all
;// Initialize Video
;// ------------------------------------------------
mov ax, 0003h
int 10h
mov dx, 3CCh
in al, dx ;//Miscellaneous Output Register (Read at 3CCh, Write at 3C2h)
or al, 2h ;//we want to enable cpu access to video memory also
;//select I/OAS -- Input/Output Address Select to 3Dx
mov dx, 3C2h
out dx, al ;//write to register
;-------------------
mov dx, 3D4h ;//CRT registers
mov al, 0Ah ;//Cursor Start Register (Index 0Ah)
out dx, al
mov dx, 3D5h
in al, dx ;//
or al, 10h ;//disable cursor
out dx, al
mov dx, 3D4h
mov al, 0Ah
out dx, al
;---------------------
mov dx, 3CEh ;// address port to VGA Graphic Registers
mov al, 06h ;// index to 06h = misc register
out dx, al ;// write to address register
mov dx, 3CFh ;// data port to VGA Graphic Register
in al, dx ;// read register
and al, 0F3h ;// bits 3:2 = 00b == A0000h-BFFFFh (128K region)
out dx, al ;// save to register
mov dx, 3CEh ;// address port to VGA Graphic Registers
mov al, 06h ;// index to 06h = misc register
out dx, al ;// close the port
;---------------------