OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 28, 2024 12:46 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Wiki pascal code doesn't compile
PostPosted: Fri May 02, 2008 9:11 am 
Offline
Member
Member
User avatar

Joined: Thu Sep 28, 2006 10:32 am
Posts: 1309
Location: Slovakia
Compiling the example code in this:
http://www.osdev.org/wiki/Pascal

will result in "Cant find unit SYSTEM". Anybody know what is wrong?

I'm using the latest version of FPC.

_________________
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 02, 2008 10:05 am 
Offline
Member
Member
User avatar

Joined: Thu Sep 28, 2006 10:32 am
Posts: 1309
Location: Slovakia
OK, I found that you need the system.pas in the attachment.

This is my COMPILE.BAT contents which works, please note I stripped off the multiboot routines from the sources and my kernel starts from real mode, the resulting application will be in a MZ (DOS-EXE) format. Anyways, it looks pretty stoopid but works like a charm. ;)

Code:
del *.o *.s *.ppu
nasm -f obj stub.asm -o stub.obj
fpc -a -Atasm -n -O3 -Op3 -Si -Sc -Sg -Xd -Tlinux -Rintel kernel.pas
tasm console.s console.o
ren *.o *.obj
valx /32 stub.obj kernel.obj system.obj console.obj,KERNEL.BIN,,,
del *.obj *.o *.map *.s *.ppu


//EDIT 2: This now works correctly. :)

I hope this helps somebody. :)

Regards
inflater


Attachments:
system.zip [651 Bytes]
Downloaded 95 times

_________________
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Top
 Profile  
 
 Post subject:
PostPosted: Mon May 26, 2008 12:26 am 
Offline
Member
Member

Joined: Wed Apr 23, 2008 8:46 pm
Posts: 103
I've made it compiled without system.zip you provided, but by adding libpsystem.a from i386-linux units directory to ld. I'll try your system unit. My question is: How can I boot it? I'm using Qemu and it won't boot either by supplying it as diskette (-fda) or cd (-cdrom).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 8:55 am 
Offline
Member
Member
User avatar

Joined: Thu Sep 28, 2006 10:32 am
Posts: 1309
Location: Slovakia
Well, did you switch to protected mode?

_________________
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 9:58 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 5:49 am
Posts: 200
It's a Multiboot kernel, which means you need to use GRUB to boot it. If you need any help setting that up, just ask.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 12:39 am 
Offline
Member
Member

Joined: Wed Apr 23, 2008 8:46 pm
Posts: 103
Quote:
Well, did you switch to protected mode?

How?
Quote:
If you need any help setting that up, just ask.

I'm asking it then, what do I do first? I really have no idea that it has something todo with GRUB as the wiki doesn't mention it (although I think it's right, how can a bare hardware run elf32 executable?).


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 5:20 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
leledumbo wrote:
Quote:
Well, did you switch to protected mode?

How?
Quote:
If you need any help setting that up, just ask.

I'm asking it then, what do I do first? I really have no idea that it has something todo with GRUB as the wiki doesn't mention it (although I think it's right, how can a bare hardware run elf32 executable?).


First, you type the word "GRUB" into the wiki search box.

Second, you press "enter".

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 6:13 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 5:49 am
Posts: 200
You can download a floppy disk image with GRUB on it from here. You'll need to copy the kernel onto the disk image using e.g. mtools or WinImage. Then create a file called menu.lst in the boot/grub directory of the image with the contents
Code:
title OS
kernel /the-file-name-of-the-kernel

Now qemu should be able to boot the image.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 02, 2008 12:36 am 
Offline
Member
Member

Joined: Wed Apr 23, 2008 8:46 pm
Posts: 103
Yippie! Thank you, it boots correctly now. Though there's some weirdness in wiki instruction here:
Quote:
Important: first check the size of your kernel.bin in blocks. This is the length in bytes, divided by 512 and rounded up to the next integer.

My kernel is 21.4 KB (21,999 Bytes), so it should have Round(21,999 / 512) = 43 blocks. But qemu hangs if I tell kernel 200+43. Crazily, I tried 18 (as an ASSUMPTION written there) and voila! It works, even though qemu says there're some bad blocks, but who cares?!

One last question, can anyone point me where to go from here (doesn't matter if it's in C or others, converting between languages is my daily life)?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group