Wrong position to plot things.
Wrong position to plot things.
Hi all,
I have try to follow this tutorial http://www.osdever.net/tutorials/view/mixing-assembly-c and is working well however in vmware he print not in the upper left corner but somewhere on the screen how is this possible?
I get this http://imageshack.us/photo/my-images/65 ... boven.jpg/
How can help me? thanks a lot.
I have try to follow this tutorial http://www.osdever.net/tutorials/view/mixing-assembly-c and is working well however in vmware he print not in the upper left corner but somewhere on the screen how is this possible?
I get this http://imageshack.us/photo/my-images/65 ... boven.jpg/
How can help me? thanks a lot.
Re: Wrong position to plot things.
How the bloody hell are we supposed to know? You haven't provided any code.
Note, that is NOT a prompt to code-dump your entire source. Have you tried debugging it at all? What have you discovered so far?
Note, that is NOT a prompt to code-dump your entire source. Have you tried debugging it at all? What have you discovered so far?
Re: Wrong position to plot things.
My crystal ball says you have bug in the offset calculation or cursor positioning.
- 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:
Re: Wrong position to plot things.
Nice catch, it is the tutorial from hell . The entire thing is not supposed to work at all.JamesM wrote:How the bloody hell are we supposed to know?
@Bert: Use one of the Tutorials on the wiki.
Re: Wrong position to plot things.
there is one function out which can write in to a register to set the cursor position on the right place.
I have searching a lot but ever where I find the same
you should first
out(0x3D4,14)
then set the cursor position with
out(0x3D5,0)
and again
out(0x3D4,15)
out(0x3D5,0)
of course you should define out in assembly but because I am able to move the cursor forward I think this should be correct only the start position is wrong.
however ever where I look same thing is doing. i have also try to debug and initialise the variables by hand but nothing work at all.
Greets.
I have searching a lot but ever where I find the same
you should first
out(0x3D4,14)
then set the cursor position with
out(0x3D5,0)
and again
out(0x3D4,15)
out(0x3D5,0)
of course you should define out in assembly but because I am able to move the cursor forward I think this should be correct only the start position is wrong.
however ever where I look same thing is doing. i have also try to debug and initialise the variables by hand but nothing work at all.
Greets.
Re: Wrong position to plot things.
The tutorial is broken, unclear in goal, and mixed in unrelated features (why on Earth you need to set/get cursor? for hello-world it's just fine to stosb the text and focus the reader on how video memory work).
Take Combuster's advice.
Take Combuster's advice.
Re: Wrong position to plot things.
The cursor setting only changes where the blinky-cursor-glyph shows up. It does not set an insert point, unlike most graphical drawing environments.Bert wrote:there is one function out which can write in to a register to set the cursor position on the right place.
I have searching a lot but ever where I find the same
you should first
out(0x3D4,14)
then set the cursor position with
out(0x3D5,0)
and again
out(0x3D4,15)
out(0x3D5,0)
of course you should define out in assembly but because I am able to move the cursor forward I think this should be correct only the start position is wrong.
however ever where I look same thing is doing. i have also try to debug and initialise the variables by hand but nothing work at all.
Greets.
- Kazinsal
- Member
- Posts: 559
- Joined: Wed Jul 13, 2011 7:38 pm
- Libera.chat IRC: Kazinsal
- Location: Vancouver
- Contact:
Re: Wrong position to plot things.
However, the tutorial thinks it's a brilliant idea to rely on the position of said blinky-cursor-glyph to determine where on the screen one places characters.JamesM wrote:The cursor setting only changes where the blinky-cursor-glyph shows up. It does not set an insert point, unlike most graphical drawing environments.
This appears to be one of many things that are horribly, horribly wrong with it. Take this sentence for example:
The tutorial's a lot better if you read it in an astonished/amazed/wowwed/Slap Chop infomercial/etc. voice. It's still not a good tutorial though.Because of my lack of knowledge of the linker, I don't know how to do that.
Re: Wrong position to plot things.
Thanks for you advice.
Re: Wrong position to plot things.
Hi,
Cheers,
Brendan
It also assumes the video card is VGA compatible at the hardware level. The BIOS provides an abstraction to shield you from unnecessary (and potentially wrong) assumptions like this, and if you're using the BIOS (during boot, before you've setup drivers of your own) to print characters on the screen you should also use the BIOS to set the cursor.JamesM wrote:The cursor setting only changes where the blinky-cursor-glyph shows up. It does not set an insert point, unlike most graphical drawing environments.Bert wrote:out(0x3D4,14)
then set the cursor position with
out(0x3D5,0)
and again
out(0x3D4,15)
out(0x3D5,0)
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.
Re: Wrong position to plot things.
I find it pretty unlikely that cursor positioning could be done at boot-time. If you support console mode applications, you also need cursor movement long after boot. For a lack of better methods, using the VGA compatible way gives the best (average) result. If hardware doesn't support it, typically nothing bad happens. And calling BIOS from protected mode is not so easy, unless you have a good V86 environment.Brendan wrote:It also assumes the video card is VGA compatible at the hardware level. The BIOS provides an abstraction to shield you from unnecessary (and potentially wrong) assumptions like this, and if you're using the BIOS (during boot, before you've setup drivers of your own) to print characters on the screen you should also use the BIOS to set the cursor.
Re: Wrong position to plot things.
At that time you could have fully detected if there is VGA compatible hardware.rdos wrote:If you support console mode applications, you also need cursor movement long after boot.
What Brendan said it is potentially dangerous to assume it exists, especially at boot time which you don't detect anything yourself yet.
Re: Wrong position to plot things.
Hi,
I'd also say that a sane OS should switch to a graphics video mode during boot (and that the "VGA hardware cursor" won't work in graphics video modes); and that unless an OS is sitting there waiting for user input (which is unlikely during boot) the "VGA hardware cursor" (which is like a flashing "I'm waiting for you" indicator) should be disabled.
Cheers,
Brendan
Yes.bluemoon wrote:At that time you could have fully detected if there is VGA compatible hardware.rdos wrote:If you support console mode applications, you also need cursor movement long after boot.
What Brendan said it is potentially dangerous to assume it exists, especially at boot time which you don't detect anything yourself yet.
I'd also say that a sane OS should switch to a graphics video mode during boot (and that the "VGA hardware cursor" won't work in graphics video modes); and that unless an OS is sitting there waiting for user input (which is unlikely during boot) the "VGA hardware cursor" (which is like a flashing "I'm waiting for you" indicator) should be disabled.
Code: Select all
mov ah,0x01 ;ah = BIOS function number (Set Text Mode Cursor Shape)
mov cx,0x2D0E ;VGA cursor settings, bits 5 and 6 of CH disables cursor
int 0x10 ;Call BIOS function (Set Text Mode Cursor Shape)
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.