Pmode VGA switch help

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.
Post Reply
srg_13

Pmode VGA switch help

Post by srg_13 »

Hi!
I've got this (C) code to change to 320x200 graphics mode form pmode (attached). The problem is that it uses two ASM commands that I have not yet implemented: outpw and outp.

I have code for outb from the osfaq, and if I changed the outb to outw or outpw, would that work?

Thanks,

Stephen
:)
Warrior

Re:Pmode VGA switch help

Post by Warrior »

Outpw afaik writes a word to the given port

outp afaik writes a byte to the given port

Same with in*
srg_13

Re:Pmode VGA switch help

Post by srg_13 »

I have this code:

Code: Select all

static __inline__ void outb(unsigned short port, unsigned char val)
{
   asm volatile("outb %0,%1"::"a"(val), "Nd" (port));
}
If I change it to

Code: Select all

static __inline__ void outp(unsigned short port, unsigned char val)
{
   asm volatile("outp %0,%1"::"a"(val), "Nd" (port));
}
will that work?
Also, will it work with outpw?

Thanks,

Stephen
:)
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Re:Pmode VGA switch help

Post by durand »

From my experience, an out with a "p" indicates that a pause is present after the IO operation.

So you get the straight ones: outb, outw
And the ones with pauses: outpb, outpw
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:Pmode VGA switch help

Post by Pype.Clicker »

the 'pause' thing is something that is introduced by programmers. There's no such thing like "outp*" in the instruction set...
srg_13

Re:Pmode VGA switch help

Post by srg_13 »

So how would you implement them? Do you have any code samples?

Stephen :)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Pmode VGA switch help

Post by Brendan »

Hi,
Stephen wrote:So how would you implement them? Do you have any code samples?
I'd implement them with something like this:

Code: Select all

    out dx,al
    jmp .l1
.l1:
   jmp .l2
.l2:
But some people read from a dummy IO port instead..

To be honest, I wouldn't actually implement them at all - they aren't needed on 80486 or above computers....


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply