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.
Explanation of code. At each stage success is indicated by printing the next letter in the alphabet. I can get ABCD no problem. Problem is to print out E which would indicate that not only has second sector been successfully loaded (D) but transfer of control to loaded code is successful (E). See MOV AL, 69 after boot signature DW 0xAA55
Assuming that I've got the CHS right the problem seems to be getting the JMP right so that execution proceeds at the right place in memory.
Tried that. Didn't work. Tried using labels. That didn't work either. Tried playing with the CHS in case that was wrong. No luck there either. I'm starting to wonder if this is an emulator issue. Can anyone get the code to run correctly on their setup.
BTW, I'm running this as an emulated floppy with aqemu frontend for KVM.
I tried a JMP label version and a JMP 0x7E00 version. Dissassembly gives JMP WORD 0x7E00 for both versions. I've found two different versions online with conflicting CHS values. I've found one that claims CHS should be 1 0 2 and I've found another that claims CHS should be 0 0 2. I've tried both. Neither seem to work.
0b00000000 wrote:Tried playing with the CHS in case that was wrong. No luck there either. I'm starting to wonder if this is an emulator issue.
It is absolutely not an emulator issue. There is little point in "playing" with values. If you understand what you are doing then you will know whether they are correct or not.
More reading about the BIOS functions is required. And jumping to 0x7E00 when you have loaded the code at 0x7E000 (if your load was successful) is definitely not going to work.
This is pretty basic stuff and, as I said in your previous thread, there are hundreds of tutorials about it on the Internet.
OK, I think I'm getting a little closer to identifying the problem. The above version loops and I get ABCDABCDABCD repeatedly printed out. So now I know the JMP 0x7C00 works and so a JMP 0x7E00 should also work if the load worked right and put the right instructions in memory at 0x7E00.
0b00000000 wrote:Tried playing with the CHS in case that was wrong. No luck there either. I'm starting to wonder if this is an emulator issue.
It is absolutely not an emulator issue. There is little point in "playing" with values. If you understand what you are doing then you will know whether they are correct or not.
More reading about the BIOS functions is required. And jumping to 0x7E00 when you have loaded the code at 0x7E000 (if your load was successful) is definitely not going to work.
This is pretty basic stuff and, as I said in your previous thread, there are hundreds of tutorials about it on the Internet.
Why wouldn't a JMP do it? How else would the IP get to be in the right place? I've seen references to far JMP but I'm not sure that's necessary or even desirable. Surely we haven't hit the boundaries of the present segment yet.
Roflo wrote:Also keep in mind some bios set cs to 0x7E0 and ip to 0 and that other thing I mentioned. Are you furthermore sure the bootdrive has an id of 0?
I have no idea what a floppy image boot drive should be set to. Nor can I find any documentation on this.
0b00000000 wrote:Tried playing with the CHS in case that was wrong. No luck there either. I'm starting to wonder if this is an emulator issue.
It is absolutely not an emulator issue. There is little point in "playing" with values. If you understand what you are doing then you will know whether they are correct or not.
More reading about the BIOS functions is required. And jumping to 0x7E00 when you have loaded the code at 0x7E000 (if your load was successful) is definitely not going to work.
This is pretty basic stuff and, as I said in your previous thread, there are hundreds of tutorials about it on the Internet.
Why wouldn't a JMP do it? How else would the IP get to be in the right place? I've seen references to far JMP but I'm not sure that's necessary or even desirable. Surely we haven't hit the boundaries of the present segment yet.
0x00
Simply because you are not jumping to the location that you loaded the code to. The location that you jump to could contain anything - one thing that you can be certain of is that it's not your code.