Ok, I had attached these files in relation to a less specific question in a different thread already, but I'll attach them yet again so you see exactly what I mean. the code does the following:
-loads 512 byte boot sector (512.asm) (well thats done by the bios)
-the 512 bytes then relocate to 0500h
-then the gdt (gdt.asm) is read from disk into 010700h (gdt-reserved space til 0126ffh)
-012700h-0146ffh shall be used for the idt
-then the c-code shall eventually be loaded at 014700h, but the jump to it is was taken out (because i don get it compiled properly)
there is also a makefile which i cant attach:
Code: Select all
all: Makefile
make bootdisk.bin
bootdisk.bin: 512.bin gdt.bin boot.bin Makefile
-rm bootdisk.bin
touch bootdisk.bin
dd if=512.bin of=bootdisk.bin count=1 seek=0
dd if=gdt.bin of=bootdisk.bin count=1 seek=1
dd if=boot.bin of=bootdisk.bin count=1 seek=3
512.bin: 512.asm Makefile
-rm 512.bin
nasm -f bin 512.asm -o 512.bin
gdt.bin: gdt.asm Makefile
-rm gdt.bin
nasm -f bin gdt.asm -o gdt.bin
boot.bin: boot.o Makefile
-rm boot.bin
ld -o boot.bin -Ttext 0x0 -e main --oformat binary boot.o
boot.o: boot.c Makefile
-rm boot.o
gcc -ffreestanding -c boot.c -o boot.o
If you compile all this and boot from bootdisk.bin, the code will hang (as intended) with a blank screen (unintended)
But if you leave out the line that says "BITS 32" (i.e. just the single line BEFORE enter_32: in "512.asm"), compile again and boot, then the code will hang (as expected) AND you'll still see the output from when the code was still in real mode...just have alook at the code, its very heavily commented and pretty self-explanatory,,i'm really stuck here! it really seems the compiler produces different output for this single near-jump instruction..and funnily, it seems to produce the right output when youre actually using the wrong compiler option!