Well, I see that you wrote a bootloader there, the 0x7C00 and the 0xAA55 kind of give it away. ^^
In general I would recommend to write "Real Mode Assembly" instead of 16 Bit Assembly, because those have a different implication immo.
Anyways, regarding your code there are a few things I'd like to point out.
First you might want to reset the CPU instead of putting it into halt state. To do that simply jump to the 0xAA55 part.
Also I am not sure about the jumping convention on x86, but you might want to use unique label names.
And the issue you asked about with the strange characters happens because in your memory there is only one byte for your buffer. But you seem to be reading 5, so what I think happens is, that your printk function walks past the Buffer byte and prints the Counter one as well, since Counter is not zero when you are printing. So you might want to change your buffers size to something bigger and append 0 to your buffer, you could just do this:
Code: Select all
main:
mov [Counter], 5
mov [Buffer+1], 0
call readKeys
[...]
Prompt db '> ', 0
Buffer resb 2
Counter resb 1
That should resolve your issue with strange characters.