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.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.
"Hello world" bootstrap works only on 2 of 3 PCs
Re: "Hello world" bootstrap works only on 2 of 3 PCs
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
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
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: "Hello world" bootstrap works only on 2 of 3 PCs
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.
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
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: "Hello world" bootstrap works only on 2 of 3 PCs
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
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: "Hello world" bootstrap works only on 2 of 3 PCs
Correction: use B800h for ES.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.
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
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Re: "Hello world" bootstrap works only on 2 of 3 PCs
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.