this programm here works exactly how it should
it puts a X on the upperleftcorner of the screen
char *video=(char*)0xb8000;
void main()
{
char a='X';
__asm__("
cli
movw $0x8, %ax
movw %ax, %ds
movw %ax, %es
movw $0x18, %ax
movw %ax, %ss
");
video[0]=a;
}
__________________________________
but this programm doesn´t work
#include "video.c"
void main()
{
char a='X';
__asm__("
cli
movw $0x8, %ax
movw %ax, %ds
movw %ax, %es
movw $0x18, %ax
movw %ax, %ss
");
write(a);
to: goto to;
}
______________________
video.c:
char *video=(char*)0xb8000;
void write(char zeichen)
{
video[0]=zeichen;
}
*********************************
selektor 0x8 is a hugedataselector within the 0xb8000
and 0x18 is a stackframe which i moved into the ss
this programm does only reboot
i think the stack didn´t work probably or so
plz help
Thomas Sendelbach
...
the programm runs in realmode and has the following
gdt table
gdt_table:
null_desc:
dw 0
dw 0
db 0
db 00000000b
db 00000000b
db 0
huge_desc_data:
dw 0xFFFF
dw 0000h
db 00h
db 10010010b
db 11001111b
db 00h
huge_desc_code:
dw 0xFFFF
dw 0000h
db 00h
db 10011010b
db 11000000b
db 00h
stack_desc:
dw 0xFFFF
dw 0x0000
db 09h
db 10010010b
db 11000000b
db 00h
gdt table
gdt_table:
null_desc:
dw 0
dw 0
db 0
db 00000000b
db 00000000b
db 0
huge_desc_data:
dw 0xFFFF
dw 0000h
db 00h
db 10010010b
db 11001111b
db 00h
huge_desc_code:
dw 0xFFFF
dw 0000h
db 00h
db 10011010b
db 11000000b
db 00h
stack_desc:
dw 0xFFFF
dw 0x0000
db 09h
db 10010010b
db 11000000b
db 00h