Hi, i got some problems where I can't find a solution for.
Let's say I wrote something like this:
mov ax, 0xb800
mov ds, ax
mov ax, 0
mov si, ax
mov al, 'x'
mov byte [ds:si], al
loop1: jmp loop1[/code]
This put the letter 'x' directly in the video memory.
So if I assemble it in a flat binary, put it on a floppy and boot from it, it works perfectly.
Now the problem is, if I want to combine my assembly object file with a object file from let's say a 'c' program, I can't use the flat binary format.
So i have to use the elf format.
So if I use "nasm kernel.asm -f elf -o kernel.o"
and dissasmble the file and check the specific code it looks like this:
[code]00000000 66B800B88ED8 mov eax,0xd88eb800
00000006 66B800006689 mov eax,0x89660000
0000000C C6 db 0xC6
0000000D B078 mov al,0x78
0000000F 3E678804C3 mov [dword ds:ebx+rax*8],al
00000014 EBFE jmp short 0x14
You see that my "[code]mov ds, ax
mov si, ax[/code]
aren't there anymore. And as you could think the code doesn't work anymore.
So is it possible to link assembly with other files using a flat binary?
Or is it possible to fix the problem of my disapearing code?
btw: if I use inline assembly in gcc and write the same code and compile it, the exact code dissapears.
So its not only the problem of nasm, also of gcc.
I hope someone understands me? And knows an answer?
If you want more info, just tell me