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.
I am trying to create my own bootloader and when I print str1 is prints it correctly but when i print str2 it prints both strings.But if swap the location of str1 and str2 in my file the reverse happens (it prints str2 correctly but when i print str1 it prints both strings).
Here is my code.
You haven't run this through a debugger, this much is obvious. Seriously, run it through a debugger, single step the code checking all the registers that are set up before the BIOS call, compare the register contents with the BIOS call specification, then come back and tell us what's wrong. I can see an obvious problem which would lead to the behaviour you're seeing (and I don't have all the BIOS calls details in my head, I look them up when I need to which isn't often).
If you don't have a debugger, then you're not really doing the programming thing. Learning to use a debugger effectively, or even writing your own as people used to do, is part and parcel of being a programmer.
Every universe of discourse has its logical structure --- S. K. Langer.
predator5047 wrote:
it should move the length of str2 is 2 not 6 why would it generate that?
I don't understand that sentence --- it's not grammatically correct. If the length is wrong, then maybe you should look at how the length is calculated? Remember, the assembler will only generate the code you instruct it to. I think you've almost fixed your problem.
Every universe of discourse has its logical structure --- S. K. Langer.
Noob error. The amount of bytes between the set directive and string2 is both strings.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
A simple length error, as everyone found...
But you should have a function for printing strings that would print each single character until a zero is found, and use .asciz instead of .ascii