OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:27 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Printing new line on boot
PostPosted: Mon Oct 02, 2017 12:22 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Since you are using USB per your answer, is it using USB Floppy emulation in the BIOS? If so - many BIOSes will clobber bytes in memory after loading your bootloader into memory since it may blindly assume you have a BIOS Parameter block at the beginning of your bootloader. If your BIOS is booting with USB floppy emulation - then do you have a BIOS Parameter block in your code? The overwriting of your code after being loaded can possibly lead to your code not working as expected.


Top
 Profile  
 
 Post subject: Re: Printing new line on boot
PostPosted: Mon Oct 02, 2017 12:39 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
I still think using a BIOS function that relies on the value in BX without first setting BX is at least part of the problem.


Top
 Profile  
 
 Post subject: Re: Printing new line on boot
PostPosted: Wed Oct 04, 2017 3:11 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
mondelob wrote:
onlyonemac wrote:
Try pushing everything to the stack before calling the BIOS function and then popping it afterwards. If this works then I'm guessing that the BIOS function is corrupting a register that you aren't expecting it to. Check the documentation for the function that you're using and see what registers are supposed to be preserved, if you're expecting it to preserve registers that it isn't supposed to preserve then it's possible that it might work on some BIOSes that happen to preserve those registers but not on others that don't, otherwise your BIOS is evidently corrupting a register that it's supposed to preserve.

Im a bit new in ASM, you push every register before calling the function, and then once I entered in for example printc or newline; pop all the registers?
Yes.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Printing new line on boot
PostPosted: Wed Oct 04, 2017 3:13 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Octocontrabass wrote:
I still think using a BIOS function that relies on the value in BX without first setting BX is at least part of the problem.
That's not going to cause this issue. Whatever (uninitialised) value is in BX is obviously fine for printing other characters and won't cause newlines specifically to fail. So yes this is a problem but it's not relevant here.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Printing new line on boot
PostPosted: Thu Oct 05, 2017 11:30 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Printing characters to the screen is separate from the special case handling for carriage return and line feed. There's no reason to assume the code for these two separate functions will behave the same way with an out-of-range value in BX.


Top
 Profile  
 
 Post subject: Re: Printing new line on boot
PostPosted: Thu Oct 05, 2017 2:05 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Octocontrabass wrote:
Printing characters to the screen is separate from the special case handling for carriage return and line feed. There's no reason to assume the code for these two separate functions will behave the same way with an out-of-range value in BX.
BX does only two things: control the colour of the characters displayed, and control which text page the characters appear on. BX presumably contains a value that causes characters to appear in a visible colour and on the currently-visible page. If the values were "out of range", the characters would either be in an invisible colour or off the screen.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group