Page 1 of 1
Pmode VGA switch help
Posted: Thu May 12, 2005 5:37 am
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
Re:Pmode VGA switch help
Posted: Thu May 12, 2005 1:41 pm
by Warrior
Outpw afaik writes a word to the given port
outp afaik writes a byte to the given port
Same with in*
Re:Pmode VGA switch help
Posted: Fri May 13, 2005 1:12 am
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
Re:Pmode VGA switch help
Posted: Fri May 13, 2005 1:44 am
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
Re:Pmode VGA switch help
Posted: Fri May 13, 2005 3:27 am
by Pype.Clicker
the 'pause' thing is something that is introduced by programmers. There's no such thing like "outp*" in the instruction set...
Re:Pmode VGA switch help
Posted: Fri May 13, 2005 3:34 am
by srg_13
So how would you implement them? Do you have any code samples?
Stephen
Re:Pmode VGA switch help
Posted: Fri May 13, 2005 4:13 am
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