Problem on real hardware
Re: Problem on real hardware
If your BIOS supports HDD booting, Boot your system. Goto BIOS. Change the settings that says USB EMULATION TYPE/MODE. Of course it depends on BIOS. And also beware of the USB stick (LBA).
Even the smallest person could change the course of the future - Lord Of The Rings.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
What are the odds against the first of the 50 sectors failing to load every time he tries it on real hardware if the only problem is that he's trying to load 50 sectors in one go? If it fails at the second sector or later, the first one will already be in memory, but it seems that that isn't happening. I've never had any trouble getting BIOSes to load 18 sectors at a time from floppy disks, so I can't see why you'd need to drop down to one-at-a-time for a hard drive (which is likely to be more reliable).guyfawkes wrote:But he's trying to read more than one sector at a timeDavidCooper wrote:There's no need to go that far, and at the moment it only needs to load one for the kernel to respond when jumped to. It isn't doing that, so it looks as if none of it's being loaded.guyfawkes wrote:One thing to NOTE do not try and read a number of sectors at a time, its buggy, read one sector at a time, but do it in a loop.
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
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
Surely you shouldn't need to do anything so radical? If it's booting the boot sector, it should already be set up to do the rest. If it is a USB device that Romfox is trying to boot from, this may be relevant:-HardCoder wrote:If your BIOS supports HDD booting, Boot your system. Goto BIOS. Change the settings that says USB EMULATION TYPE/MODE. Of course it depends on BIOS. And also beware of the USB stick (LBA).
http://board.flatassembler.net/topic.php?t=12389
Is the bootsector the first sector of a partition, or has it been written over the MBR? If the latter, it will act like a floppy disk. If the former, it will act like a hard disk. Either way, it should have a BPB.
Edit: switched round "latter" and "former".
Last edited by DavidCooper on Wed Dec 07, 2011 2:20 pm, edited 2 times 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
Re: Problem on real hardware
I switched to HDD (it was auto) and it didnt work. After I tried in floppy mode and got an invalid partition error. =(
Edit : gonna try with a BPB.
Edit : gonna try with a BPB.
Re: Problem on real hardware
I also had auto in there. Did you check whether your USB stick shows LBA(0x0C) while fat32 formated in Ubuntu Disk utility. If it is then I really cant help you. Maybe my Bios implementation is different.
Even the smallest person could change the course of the future - Lord Of The Rings.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
Re: Problem on real hardware
I have windows 7 and I format in auto (ntfs) cause I overwrite the 1st sector no ?
Where can I see LBA ?
Where can I see LBA ?
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
Make sure your assembler uses a single-byte jump instruction at the start so that the table's correctly aligned. In the hex it should show up as EB.romfox wrote:gonna try with a BPB.
Edit:-
I've only ever booted from floppy drive, so I can't make any further suggestions. It would however be a good idea if you explain what tools you're using to write to the device you're booting from and spell out where abouts you're putting your code on it. Also, if you're formatting it in ntfs, that's going to make things difficult for you later.romfox wrote:I have windows 7 and I format in auto (ntfs) cause I overwrite the 1st sector no ?
Where can I see LBA ?
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: Problem on real hardware
Done (using the BOS's BPB). But still the same problem.
Edit : I use copy /b boot.bin+kernel.bin OS32.img
And dd if=OS32.img of=\\.\g: (cause Windows)
I've tried protecting the ds and es value but Still the same, blocking at the jump kernel time.
Edit : I use copy /b boot.bin+kernel.bin OS32.img
And dd if=OS32.img of=\\.\g: (cause Windows)
I've tried protecting the ds and es value but Still the same, blocking at the jump kernel time.
Last edited by romfox on Wed Dec 07, 2011 3:17 pm, edited 1 time in total.
Re: Problem on real hardware
Well if you only have part of your code loaded and you jump to it, do you not think it will crash ?DavidCooper wrote: What are the odds against the first of the 50 sectors failing to load every time he tries it on real hardware if the only problem is that he's trying to load 50 sectors in one go? If it fails at the second sector or later, the first one will already be in memory, but it seems that that isn't happening. I've never had any trouble getting BIOSes to load 18 sectors at a time from floppy disks, so I can't see why you'd need to drop down to one-at-a-time for a hard drive (which is likely to be more reliable).
And you may be luck with your 18 sector, but then you have not been coding a OS for long.
You need a BPB for fdd emulation, not needed for hdd emulation.romfox wrote: Edit : gonna try with a BPB.
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
Have you got the right values in your BPB?
Provide more information: are you putting your bootsector into the first sector on the disk? If so, it will most likely pretend to be a floppy disk, and that will mean you need to put floppy disk values in the BPB and make sure you load sectors as if from a floppy disk (17 sectors the first time, then 18 for the next lot, and so on).
If you're not overwriting the MBR (first sector) on the disk but are putting your bootsector into the first sector of a partition, it will behave as a hard disk, in which case you need someone other than me to help you.
Provide more information: are you putting your bootsector into the first sector on the disk? If so, it will most likely pretend to be a floppy disk, and that will mean you need to put floppy disk values in the BPB and make sure you load sectors as if from a floppy disk (17 sectors the first time, then 18 for the next lot, and so on).
If you're not overwriting the MBR (first sector) on the disk but are putting your bootsector into the first sector of a partition, it will behave as a hard disk, in which case you need someone other than me to help you.
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: Problem on real hardware
I dont know how to check it in windows 7 directly.
In the dirty way you could format the usb stick with fat32 and just get the mbr of the usb stick into a file. There are some apps for that though I dont remember. Then with a hex editor check if the 450th byte contains 0x0C.
or
If you have an ubuntu live CD, then you might have a quick look in the Disk Utility. It basically tells the addressing mode used in the USB stick. If it is 0x0B then it means it contains CHS addressing. 0x0C means LBA addressing.
EDIT: you could use cygwins dd for it.
In the dirty way you could format the usb stick with fat32 and just get the mbr of the usb stick into a file. There are some apps for that though I dont remember. Then with a hex editor check if the 450th byte contains 0x0C.
or
If you have an ubuntu live CD, then you might have a quick look in the Disk Utility. It basically tells the addressing mode used in the USB stick. If it is 0x0B then it means it contains CHS addressing. 0x0C means LBA addressing.
EDIT: you could use cygwins dd for it.
Even the smallest person could change the course of the future - Lord Of The Rings.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
In the end all that matters is what you have done - Alexander.
Even after a decade oh god those still gives me the shivers.
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
There's test code at the start of the kernel which should run if the first sector of it loads. I assume that Romfox has put enough of a delay after that to ensure that this would show up if the sector was loaded successfully, so it wouldn't matter if it crashed further on due to later sectors not loading.guyfawkes wrote:Well if you only have part of your code loaded and you jump to it, do you not think it will crash ?
Quite long enough: I've got half a disk's-worth of data all loading and saving without errors on multiple machines - I have an indication on the screen which shows whenever a track has to be read twice, and it's only ever signalled errors with one new set of disks (though they have also worked without any errors after I cleaned them with lens cleaning tissues - there were patches on them in places where something had deposited disk-material-coloured smudges on the disk surface).And you may be luck with your 18 sector, but then you have not been coding a OS for long.
I did have a machine in which a failing fdc chip lost the ability to handle multiple sector loads/saves and I had to rewrite my OS to load/save one sector at a time to get round that. Later on (on a different machine) I had to change back to loading multiple sectors because I was no longer using interleaved sectors - loading one sector at a time with an interleaved disk meant it took four rotations to load a whole track (both sides), but with disks using non-interleaved sectors it was having to rotate 36 times to load a track because the BIOS wasn't quick enough to get ready in time for the next sector coming up. That was on a 486, so the problem might not happen on newer machines. There may also have been a rotation speed issue as some drives go faster than others, with slower ones giving bigger gaps between sectors (unless they were formated on that same drive).
Last edited by DavidCooper on Wed Dec 07, 2011 10:02 pm, edited 2 times 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
Re: Problem on real hardware
My BPB seems to work cause I can use my disk whenever overwritting its FAT. But I can only format it to NTFS or exFAT using Windows =/.
And emulating HDD or FDD do the same result : Reboot =(.
Edit : Formatting to FAT32, I will try using its BPB.
And emulating HDD or FDD do the same result : Reboot =(.
Edit : Formatting to FAT32, I will try using its BPB.
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Problem on real hardware
HardCoder recommended:-
You still haven't made it clear where you're putting your bootsector on the disk.
I think that's the usual tool (many people only-half-jokingly say "dd" stands for "disk destroyer", and that's why I've never dared to use it and am still using floppies).HardCoder wrote:you could use cygwins dd for it.
You still haven't made it clear where you're putting your bootsector on the disk.
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: Problem on real hardware
@romfox, is your bootsector 512bytes ?
When assembled
As this does not look right
Should that not be
But than again, i use fasm.
When assembled
As this does not look right
Code: Select all
times 510-($-$$) db 144
dw 0xAA55
Code: Select all
TIMES 510-($-$$) DB 0
DW 0xAA55
Last edited by guyfawkes on Wed Dec 07, 2011 4:09 pm, edited 1 time in total.