suthers wrote:Can anybody see why this output function doesnt work?:
It would indeed be a good idea to learn how to program in x86 assembly before actually trying to make a working function, as others have mentioned. As you have already noticed you are using eax for the screen position, which is wrong. Some other comments:
Since you are writing to the screen (i.e. it is the destination), I'd advise using the edi register (instead of e.g. ebx).
This instruction loads a byte from ds:[esi], then increments esi by 1. I can't see you setting esi anywhere, so I assume you set esi before calling this function? Check its value, most likely it's bogus, causing the random characters to display.
A mov instruction by default already uses the ds segment, so no need to specify it. Alternatively, if you set up ds and es the same (which I'd do in protected mode), you could use the stosb instructing if you are using edi as I suggested.
If using the stosb instruction as I suggested above, this would then read 'mov al, 1bh', 'stosb'.
I see you don't check for an overflow of screen_pos, so be prepared that after writing 80x25 characters, you're writing off-screen.
JAL