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.
Did you add an error message when the 0xaa55 signature wasn't found? Did it actually find the disk signature of the VBR? Hanging doesn't tell me anything but it is important to know that the sector read actually contains the VBR before jumping to the VBR. If you read garbage into memory (all zeroes or whatever) and jump to it then who knows what it will do.
I don't know anything about RUFUS. Is it writing things as an ISO image? I really don't know. On Windows if I have to write directly to a USB stick I use Chrysocome DD that can be found here http://www.chrysocome.net/dd and in particular this version http://www.chrysocome.net/downloads/dd-0.6beta3.zip which supports an `od=` parameter.
where disk.img is the name of your disk image and x: is the actual drive letter you want to write to (make sure you write to the correct drive!). You will have to have admin privileges in Windows for this to work correctly.
cmp WORD [0x7DFE], 0xAA55 ; Check Boot Signature
jne error.noBootSignature ; Error if not Boot Signature
...
.noBootSignature:
mov si, Message.Error.NoBootSignature
call BiosPrint
jmp hang
MichaelPetch wrote:Did it actually find the disk signature of the VBR?
Yes it does not print the error so I think it jumps.
MichaelPetch wrote:I don't know anything about RUFUS. Is it writing things as an ISO image?
I used it only for burning ISOs and Floppy images so it could be.
Regarding the USB writing problem, I have seen that before as well. You may have to wipe out what is on the USB stick when it comes to existing partitioning info. Follow this guide: https://www.howtogeek.com/235824/how-to ... -problems/ and when finished the `clean` command in the diskpart tool you are finished and you can type `exit` to return back to the command prompt. Try DD after that.
As for it finding the signature but not doing anything after jumping I really don't know. That makes very little sense. If that was the case then I almost wonder if you have the right code in the VBR. The only other thing I can think of is that the original bootloader at 0x7c00 was still present and never replaced by the disk read.
Last edited by MichaelPetch on Tue Nov 03, 2020 1:14 pm, edited 1 time in total.
If "dd" doesn't work for you (it should), give a try to USBImager. Portable executable, no installation required, about 300K only. But it's a GUI app, so unlike "dd" you can't use it from a Makefile.
About the "dd", instead of "od=i:" does "of=\\.\PhysicalDrive1" work? Just a guess, I'm not a Win expert. Use 0 for the first disk, 1 for the second etc. So if you have three fixed disks, then the USB stick going to be "\\.\PhysicalDrive3".
Same problem as rufus, the image is written but the bootloader does not work.
MichaelPetch wrote:You may have to wipe out what is on the USB stick when it comes to existing partitioning info
Following the guide and cleaning the USB stick, change a bit the result, before it failed instantly, (In the previous screenshot 1M) now it advance to a higher number but still stops at some point.
MichaelPetch wrote:I almost wonder if you have the right code in the VBR
The code is in ./boot/boot.asm in the github repo. But if works in QEMU and is just a print it should work.
MichaelPetch wrote:
The only other thing I can think of is that the original bootloader at 0x7c00 was still present and never replaced by the disk read.
If this was the case (and has been due to some bugs that I've fixed) it should loop the successful read message since it jumps to itself.
I'm asking a friend to test in his own hardware I'll let you know if it works
LBA_Packet:
.packet_size db 0x10 ; use_transfer_64 ? 10h : 18h
.reserved db 0x00 ; always zero
.block_cout dw 0x01 ; number of sectors to read
.transfer_buffer dd 0x7C00 ; address to load in ram
.lba_value dq 0x0 ; LBA addres value
align 4
LBA_Packet:
.packet_size db 0x10 ; use_transfer_64 ? 10h : 18h
.reserved db 0x00 ; always zero
.block_cout dw 0x01 ; number of sectors to read
.transfer_buffer dd 0x7C00 ; address to load in ram
.lba_value dq 0x0 ; LBA addres value
Can you do me a favor. Take your disk image that you burned and add it to your Github project (zip it if you like to save space). I'd like to take a look at the actual disk image that isn't working for you.
Just the code that you posted does not work, moving the cli to the first line of boot, in QEMU it works as you sayed but in the real hardware doesn't work.