"Hello world" bootstrap works only on 2 of 3 PCs

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.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: "Hello world" bootstrap works only on 2 of 3 PCs

Post by SpyderTL »

Octocontrabass wrote:If you follow linuxyne's advice, you'll discover that the corruption occurs where the disk geometry would go if you had a BPB.
You can quickly test this by moving all of your code to the end of the block, and putting a relative jump to the start of your code at the beginning of the block.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: "Hello world" bootstrap works only on 2 of 3 PCs

Post by DavidCooper »

I can't see anything wrong with the machine code. I'd try restoring the original partition table as that might make the BIOS think it's dealing with an MBR rather than a VBR - that way it should run the code without interfering with it.

If it continues to behave oddly, Spyder's suggestion is a good one - jump past the bytes that the BIOS might interfere with and then you can write some code to investigate what the BIOS has done, printing the bytes to the screen. To simplify code while debugging at this stage, it can be easier to write directly to screen memory without using the BIOS - just use ES:DI (set ES to B000h [* correction: use B800h]) and send AX to the screen using stosw, colour value in AH (e.g. 0Eh for yellow) and char in AL.
Last edited by DavidCooper on Fri Jul 29, 2016 10:11 am, edited 1 time in total.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: "Hello world" bootstrap works only on 2 of 3 PCs

Post by onlyonemac »

Another thing that might be worth considering is how this BIOS responds to other bootable media. For example, will a DOS floppy boot on it? A Linux floppy with GRUB, LILO, SYSLINUX, etc.? How about a linux USB stick? Remember that some BIOSes don't treat USB sticks well, and there are many different modes that they might emulate them in, so maybe try a real floppy if you can, or even a hard drive if you've got a spare.
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
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: "Hello world" bootstrap works only on 2 of 3 PCs

Post by DavidCooper »

DavidCooper wrote:To simplify code while debugging at this stage, it can be easier to write directly to screen memory without using the BIOS - just use ES:DI (set ES to B000h) and send AX to the screen using stosw, colour value in AH (e.g. 0Eh for yellow) and char in AL.
Correction: use B800h for ES.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Kolodez
Posts: 9
Joined: Wed Jul 27, 2016 5:37 am

Re: "Hello world" bootstrap works only on 2 of 3 PCs

Post by Kolodez »

Thank you all very much for the answers. After I had put an active partition entry there, as Octocontrabass had suggested, everything started working as expected. Meanwhile; I also started using an assembler instead of writing binary by hand. :P
Post Reply