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'm not quite sure why you use a pointer with PrintChar rather than just having a char parameter. It's an extra complication which makes it difficult for my poor brain to follow at this time of the morning.
But this has got to be a trivial bug to trap with a debugger. Just single-step through the code in a debugger - either at source-code level or assembler level if necessary - and the answer will surely be obvious. You are going to face far more difficult bugs than this when programming an OS so you might as well practise your debugging skills on this simple problem.
Also, please fix your signature, it breaks forum rules.
"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 ]
Alternatively you can use an emulator with debugging built in (SimNow from AMD is my favourite - http://developer.amd.com/tools/cpu-deve ... simulator/ ). Whatever you decide on, I would advise you take a little time off from coding and learn how to use a debugging environment. You are going to need it.
Not as far as I know. One of the many reasons why I don't use Visual C++ as my development environment for OS programming. It's a brilliant tool, but I don't find it suitable for OS work. Same goes (IMO) for XCode on OS X. I use a Linux development environment as I find it far more suited to this sort of work. (I know some people use the native tools of Windows or OS X, but it just seems like too much hard work to me when so much documentation is built around the GNU toolset.)
If Visual C++ is your choice then I'm afraid that you're going to have to find your own way of debugging with qemu. But if you want to get serious about OS development then you're going to need debugging at some stage (and you seem to have reached that stage). You could always debug at an assembler level using SimNow. Alternatively, just look at the code generated by your functions, work through it manually and you should be able to spot the error. The problem with that approach is that you have to be intimately familiar with what each instruction does and what effect it has on registers and flags. It's very easy to make false assumptions and miss simple errors.
Basically what I'm getting at here is that you have a very simple problem. (I'm not saying I know what the error is because I don't have the time or the inclination to debug other people's code.) It's up to you to learn how to track down the bug. If you can't do that then reconsider whether OS development is your thing. You are going to run in to lots of little problems like this and people will very quickly lose patience with you if you post each and every one on this forum. I don't mean to sound harsh, though I realize it may come across that way, but that's just the way it is. These forums aren't really set up to act as tutorials or to provide hand-holding tuition.
iansjack wrote:Not as far as I know. One of the many reasons why I don't use Visual C++ as my development environment for OS programming. It's a brilliant tool, but I don't find it suitable for OS work. Same goes (IMO) for XCode on OS X. I use a Linux development environment as I find it far more suited to this sort of work. (I know some people use the native tools of Windows or OS X, but it just seems like too much hard work to me when so much documentation is built around the GNU toolset.)
If Visual C++ is your choice then I'm afraid that you're going to have to find your own way of debugging with qemu. But if you want to get serious about OS development then you're going to need debugging at some stage (and you seem to have reached that stage). You could always debug at an assembler level using SimNow. Alternatively, just look at the code generated by your functions, work through it manually and you should be able to spot the error. The problem with that approach is that you have to be intimately familiar with what each instruction does and what effect it has on registers and flags. It's very easy to make false assumptions and miss simple errors.
Basically what I'm getting at here is that you have a very simple problem. (I'm not saying I know what the error is because I don't have the time or the inclination to debug other people's code.) It's up to you to learn how to track down the bug. If you can't do that then reconsider whether OS development is your thing. You are going to run in to lots of little problems like this and people will very quickly lose patience with you if you post each and every one on this forum. I don't mean to sound harsh, though I realize it may come across that way, but that's just the way it is. These forums aren't really set up to act as tutorials or to provide hand-holding tuition.
Thank you so much for your time, brilliant answer thanks!
Ok, I will probably switch to the GNU compilers.
I couldn't seem to find a download link for SimNow for Windows????????