Wiki pascal code doesn't compile
Wiki pascal code doesn't compile
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.
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 )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
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.
//EDIT 2: This now works correctly.
I hope this helps somebody.
Regards
inflater
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: Select all
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
I hope this helps somebody.
Regards
inflater
- Attachments
-
- system.zip
- (651 Bytes) Downloaded 139 times
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
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 )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
How?Well, did you switch to protected mode?
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?).If you need any help setting that up, just ask.
First, you type the word "GRUB" into the wiki search box.leledumbo wrote:How?Well, did you switch to protected mode?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?).If you need any help setting that up, just ask.
Second, you press "enter".
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
Now qemu should be able to boot the image.
Code: Select all
title OS
kernel /the-file-name-of-the-kernel
Yippie! Thank you, it boots correctly now. Though there's some weirdness in wiki instruction here:
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)?
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?!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.
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)?