Beginner's Questions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
nitinjavakid
Member
Member
Posts: 65
Joined: Sat Oct 21, 2006 11:28 am
Location: Exams over!
Contact:

Beginner's Questions

Post by nitinjavakid »

I tried one of the examples from
http://www.osdev.org/osfaq2/index.php/AsmExample


.code16
.text

mov $0x07C0, %ax
mov %ax, %ds

mov $msg, %si
1: lodsb
or %al,%al # zero=end of str
jz 2f # get out
mov $0x0E, %ah
int $0x10
jmp 1b

2:
jmp 2b

msg: .asciz "Welcome to Macintosh\n"
.org 510
.word 0xAA55

ld --oformat binary --Ttext 0x7C00 -o temp.bin temp.o
it shows me the following error while linking it using the above ld command:(

ld: cannot perform PE operations on non PE output file
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hello,

I have had this problem before with the version of LD distributed with DJGPP (I use a WinXP development machine), when I was creating my kernel.

LD did not like trying to link flat binaries (which I suppose, makes sense :oops: ). I fixed it by assembling in to A.OUT and then letting the linker create the flat binaries - maybe that will help.

Just one thing - I have never had to manually link my boot sector. I guess it must be because you are using different tool chain?

Adam
User avatar
nitinjavakid
Member
Member
Posts: 65
Joined: Sat Oct 21, 2006 11:28 am
Location: Exams over!
Contact:

Post by nitinjavakid »

As you can see I am a begineer in this field and would like to make a small program which would print hello world while booting. Also, I would like it to be written in GAS(GNU assembler). Can you please explain me the exact procedure from compiling to making bootable binaries please...
Post Reply