Jordan3 wrote:
what about trying to use only C
Well, I have code in the assembly before the stuff I pasted which does output stuff to the screen, and stuff after it which outputs stuff to the screen... but those two places use immediate values instead of memory values for printing characters out.
Sample:
Code: Select all
mov al, 'Z'
mov ah, 0x0E
int 0x10
I had a hard time getting the stuff you provided to assemble, but finally got it. It does, in fact, put a bright white 'h' in the corner, but I wouldn't expect otherwise. This doesn't tell me that there is or isn't anything wrong with my assember, since it's not using its own DS at all, just another one.
By the way, this is how your code looks to get it to work:
Code: Select all
unsigned char *video_memory;
__asm(".intel_syntax noprefix\n"
"push ds\n" //preserve ds
"push ax\n" // and ax
"mov ax,0xB800\n"
"mov ds,ax\n" //sets ds to video memory
"mov [byte ptr ds:0], 'h'\n" //that might cause an error but you know what i mean
"mov [byte ptr ds:1], 0x0F\n" //just incase color was 00
"pop ax\n"
"pop ds\n"
".att_syntax\n" //needed because gcc makes att asm code
)
So... I'm still in the same place I was. Setting DS to 0000 and addressing 0x7E00 doesn't seem to get me stuff at 0x00007E00.