Page 2 of 2

Posted: Mon May 05, 2008 1:06 am
by Stevo14
jal wrote:
Stevo14 wrote:
jal wrote:I should look at the Bochs BIOS, since Qemu uses that as well.
That is a good idea. I will try to look at the Bochs Bios when I get back around to solving this video problem.
Well, if you do I'd be interested to hearing what causes it, as (as I described above) I experienced the same problem.


JAL
Yea, I'll be sure to write about it somewhere if I find the answer.

Posted: Mon May 05, 2008 2:24 am
by jal
Stevo14 wrote:Yea, I'll be sure to write about it somewhere if I find the answer.
This is what Bochs BIOS does (annotated by me, see e.g. FreeVGA for details):

Code: Select all

static void get_font_access()
{
ASM_START
 mov dx, # VGAREG_SEQU_ADDRESS
 mov ax, #0x0100			; reset: AR
 out dx, ax
 mov ax, #0x0402			; map mask: plane 2
 out dx, ax
 mov ax, #0x0704			; mem mode: odd/even disable, ext. mem, ????
 out dx, ax
 mov ax, #0x0300			; reset: AR, SR
 out dx, ax
 mov dx, # VGAREG_GRDC_ADDRESS
 mov ax, #0x0204			; read map select: 2
 out dx, ax
 mov ax, #0x0005			; gfx mode: read mode 0, write mode 0
 out dx, ax
 mov ax, #0x0406			; misc gfx: mem map = 1 (a0000-affff)
 out dx, ax
ASM_END
}


static void release_font_access()
{
ASM_START
 mov dx, # VGAREG_SEQU_ADDRESS
 mov ax, #0x0100			; reset: AR
 out dx, ax
 mov ax, #0x0302			; map mas: plane 0, 1
 out dx, ax
 mov ax, #0x0304			; mem mode: odd/even enable, ext.mem, ????
 out dx, ax
 mov ax, #0x0300			; reset: AR, SR
 out dx, ax
 mov dx, # VGAREG_READ_MISC_OUTPUT
 in  al, dx
 and al, #0x01				; misc. outp: input/output address select (mono or colour)
 shl al, 2
 or  al, #0x0a
 mov ah, al
 mov al, #0x06
 mov dx, # VGAREG_GRDC_ADDRESS
 out dx, ax				; misc. gfx: mem map = 10 (mono) or 11 (colour)
 mov ax, #0x0004			; read map select: 0
 out dx, ax
 mov ax, #0x1005			; gfx mode: host odd/even
 out dx, ax
ASM_END
}
The only reason I can think of my routine goes awry is that I don't select the VGA address space, so I'm writing to a0000h which may not be selected (as we are in text mode). Some (or all?) real VGA cards (and Bochs VGA?) may have mirrored text mode addresses to a0000h making it work. I haven't tried updating my routine and see what VMware does. I'll keep you posted...


JAL

Posted: Mon May 05, 2008 3:12 am
by jal
Ok, ignore previous comment about the memory area - I did set it, to a0000-bffff (more or less by accident, I admit). I used the entry/exit code from the Bochs BIOS, and it works fine on VMware. I don't have the time right now to find out exactly what caused my own routines to fail, but using the Bochs ones should work, at least.


JAL

Posted: Mon May 05, 2008 9:32 am
by lukem95
looks cool, but on my Qemu build (windows binary - on vista) all the text was cut in half (just the top half was showing)

Posted: Mon May 05, 2008 12:26 pm
by jal
lukem95 wrote:looks cool, but on my Qemu build (windows binary - on vista) all the text was cut in half (just the top half was showing)
Hey, also read the other posts, there have been about 289374182793 about that :).


JAL

Posted: Mon May 05, 2008 2:52 pm
by lukem95
oh were there?

sorry. i read the forum, downloaded the image and then tested it the next day. i didnt reread the topic =\

Posted: Tue May 06, 2008 3:49 am
by jal
lukem95 wrote:oh were there? sorry. i read the forum, downloaded the image and then tested it the next day. i didnt reread the topic =\
Well, there was a discussion between me and the OP, as I have the same problem with my video routine. I haven't nailed it down yet, but the Bochs BIOS (vgabios) routine works.


JAL

Posted: Tue May 06, 2008 5:41 am
by Stevo14
jal wrote: I haven't nailed it down yet, but the Bochs BIOS (vgabios) routine works.
JAL
Comparing my code to the Bochs code, the most obvious difference seems to be that the Bochs code is sprinkled with reset and resume commands. Other than that they do almost exactly the same thing.

Posted: Tue May 06, 2008 8:52 am
by jal
Stevo14 wrote:Comparing my code to the Bochs code, the most obvious difference seems to be that the Bochs code is sprinkled with reset and resume commands. Other than that they do almost exactly the same thing.
Same with my code. Perhaps the VMware gfx device needs those, while real hardware (or at least modern hardware) doesn't.


JAL

Posted: Tue May 06, 2008 4:54 pm
by Stevo14
Two major bug fixes in as many days! This feels good. 8)

Version 0.2.5 should fix the font problem, the shutdown problem, and the problem with the mis-sized image file. Get it from the same place: http://code.google.com/p/secretion/

About the font, apparently it is important to properly select the graphics read map as well as inserting the reset commands.

Posted: Wed May 07, 2008 2:19 am
by ucosty
Looking good. I found a bug, though, regarding the console input. The console doesnt accept any commands that have been edited (using backspace and retyped) even though the console shows the correct command.

Also when the console starts scrolling, and the line is at the bottom of the window, neither the text or the prompt are visible until you press enter (moving it up a line).

Image

Posted: Wed May 07, 2008 3:03 am
by Stevo14
ucosty wrote:Looking good. I found a bug, though, regarding the console input. The console doesnt accept any commands that have been edited (using backspace and retyped) even though the console shows the correct command.

Also when the console starts scrolling, and the line is at the bottom of the window, neither the text or the prompt are visible until you press enter (moving it up a line).

[...image...]
Both are confirmed. Thanks for the bug reports. The first is obviously a problem with how I handle backspaces. The second seems to be a problem with how I calculate the new "dirty area" for a window when text is written to it. Probably an off-by-one error. I'll work on them as soon as possible.