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.
Maybe something weird happens at the function call, maybe because of the flags used for the compilation or linking (telling the way how the function call ABI is done). Just a rough guess, because your code looks correct, at least to me.
And is the function in the same object or source-code file as the code calling it?
EDIT: I found the link to your OS and looked at the linker script: You don't link the data!!!
This is definitely a FAQ. I actually had to check the date to be sure that this was a new thread and not someone committing thread necromancy.
The Wiki does cover this, and even has a redirect of the phrase 'Strings do not work' which brings up the page on Bran's Tutorial's known bugs. It seems that it isn't the easiest answer for newcomers to find despite this. This may need to be addressed, as it will keep happening otherwise, though I am not certain how we could go about it. Any thoughts?
In this case, the focus on the for() loop rather than the string data seems to have been a stumbling block. XY problems happen, I guess.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Schol-R-LEA wrote:This is definitely a FAQ. I actually had to check the date to be sure that this was a new thread and not someone committing thread necromancy.
The Wiki does cover this, and even has a redirect of the phrase 'Strings do not work' which brings up the page on Bran's Tutorial's known bugs. It seems that it isn't the easiest answer for newcomers to find despite this. This may need to be addressed, as it will keep happening otherwise, though I am not certain how we could go about it. Any thoughts?
In this case, the focus on the for() loop rather than the string data seems to have been a stumbling block. XY problems happen, I guess.
1.) Sorry that I didn't point the asking person to the FAQ. In the future I'll try to (mentally and reading) check first if a question can be answered by the FAQ or maybe the Wiki in general or old forum threads.
2.) And yes, it was an XY problem, a linking problem "in disguise" as a loop problem.
3.) Someone already made a redirection for the string-page to the page with the tutorial-error-page. That looks good.
4.) I think the FAQ should be linked in big, fat letters from the forum's top (like the Wiki in general is done). And I don't mean the forum FAQ but the Wiki FAQ!
PeterX wrote:EDIT: I found the link to your OS and looked at the linker script: You don't link the data!!!
Unless the linker script explicitly DISCARDs the sections or he uses some tool like objcopy to remove sections then the `.rodata` section will be emitted but not necessarily in a place they might expect. In this case though the data is in the executable. The problem is as Octocontrabass points out - they are running 64-bit code in 32-bit protected mode and the instructions being run aren't producing the desired results for obvious reasons. Most people often see this issue when displaying to the console (often characters get displayed but not correctly) but this person is seeing it as a result of a function that displays a string to the serial port.
catOS needs to put the processor in 64-bit long mode for this code to work.
MichaelPetch wrote:Unless the linker script explicitly DISCARDs the sections or he uses some tool like objcopy to remove sections then the `.rodata` section will be emitted but not necessarily in a place they might expect. In this case though the data is in the executable..