Page 1 of 1
Borland Pascal FLat Binary
Posted: Fri Jul 11, 2008 3:01 am
by System123
Is there a way to compile Borland Pascal into a flat binary file so it can be loaded by a boot loader? Or do I need to code exe support to load the .exe kernel that is created?
Re: Borland Pascal FLat Binary
Posted: Fri Jul 11, 2008 4:57 am
by JackScott
Try compiling the Pascal into object files, and then using LD to link the executable proper.
http://wiki.osdev.org/Pascal has more information (though the linking command is missed, it should be a fairly simple matter to convert the one in the other barebones... they are all *.o after all).
Re: Borland Pascal FLat Binary
Posted: Fri Jul 11, 2008 8:07 am
by inflater
Don't you dare to read that, it'll confuse you more. It's designed for Free Pascal, which is 32-bit.
There's no way of compiling that object files to .COM. Borland Pascal is proprietary, dated and it's designed to make programs for MS-DOS - the object files are 16-bit Microsoft OMF, which I
really doubt LD supports (not to mention widely used 32bit versions, which LD lacks.. I think.).
If you desperately need to compile to COM, you need Pascal 1.0, but it's from 1980 or so. (Nothing like Object Pascal, USES, etc in P1.0.).
But it's relatively easy to run your EXE kernel - I've told you that in my e-mail. Just download Alexei frounze's Bootprog sector, again it's here:
http://alexfru.chat.ru/epm.html
Everything you need is to change the "LOADER BIN" to the file name of your compiled kernel and do NASM BOOT12.ASM and then BOOTABLE BOOT12.BIN A: or PARTCOPY. If you find that hard to understand, I suggest quit OSdeving and reading manuals.
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 12:22 am
by System123
Thanks I couldn't remember what that boot loader was called. I will give it a try. Do you have assembly code to call your kernel after the boot loader?
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 2:54 am
by inflater
The boot loader can load EXE's and binary files BTW.
If you're using Borland Pascal, you're good to go and you can start using WriteLn, ReadLn, ReadKey etc, without all that hard work programming your own video and keyb driver. Also you don't need any weird ASM stubs. The EXE header tells the boot sector where to load to.
Just don't forget to add CRT into your USES clausule and before that, download the patched CRT unit!
Again, the CRT unit is for transforming WriteLn, ReadLn, TextMode etc. to BIOS, which in real mode you can freely use. If you don't add CRT into the USES section, WriteLn and ReadLn need MS-DOS (INT 21h) to operate.
You need the patched CRT unit against the "runtime error 200", which occurs at machines faster than 200MHz.
If you're planning to do your kernel in Free Pascal,
DISREGARD THIS ALL. Firstly, FP is 32-bit and you can't use BIOS functions there. You have to program everything from scratch, and you need to switch to protected mode by the boot sector/second stage boot loader, or in the ASM stub of your kernel
BEFORE THE FUNCTION MAIN()
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 10:15 am
by System123
Thanks. I am using Borland Pascal. So I don't need a keyboard driver or video driver? I have Patched CRT and I know how uses and things work. Do I still need the Boot loader to load protected mode and Interupts??
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 10:28 am
by inflater
Borland pascal is 16-bit. REAL MODE, no protected mode. Max. 640 kB of RAM to address. All segments divided to 64K parts.
PortixOS 0.4 with a second stage bootloader: Borland pascal. Unreal mode. Max. 4 GB RAM to address. CS and SS are 16-bit (64K limit like in real mode), everything else 4 GB limit.
The version I gave you is just the kernel, not the second stage b-loader.
'Nuff said. You seem to have a great magyar gulyash at OSdeving.
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 10:38 am
by suthers
What does 'magyar gulyash' mean?
Jules
Re: Borland Pascal FLat Binary
Posted: Sun Jul 13, 2008 11:05 am
by inflater
A mess, but in it's original meaning it's a Hungarian spicy dish.
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 4:48 am
by jal
inflater wrote:Borland pascal is 16-bit. REAL MODE, no protected mode.
You are confusing Borland pascal with Turbo pascal. Borland pascal actually offered protected mode with a proprietary extender, but I think it was still 16-bit protected mode, not 32-bit.
JAL
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 9:03 am
by inflater
jal wrote:inflater wrote:Borland pascal is 16-bit. REAL MODE, no protected mode.
You are confusing Borland pascal with Turbo pascal. Borland pascal actually offered protected mode with a proprietary extender, but I think it was still 16-bit protected mode, not 32-bit.
JAL
Yes, you're right, I've omitted that on purpose because - for the protected mode to work, you need "DPMI16BI.OVL", "RTM.EXE" and God knows what else. Plus it's an 16-bit pmode , you're right, but I didn't want to confuse System123 and other readers.
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 11:41 am
by System123
I never got a version of Portix from you. I have started my kernel. Already boots fine and has a simple VESA mode which I added. Going to start Drivers soon. please mail me Portix.
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 11:54 am
by inflater
Hmm, I apologize then for my posts above.
Must've been a email server error or something, I don't know. (I've sent it to hughes etc etc at gmail).
Anyways I'll PM you with the source.
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 12:07 pm
by System123
Thanks. I am going to set up a second stage loader to boot in pmode and setup gdt and idt's
Re: Borland Pascal FLat Binary
Posted: Mon Jul 14, 2008 12:10 pm
by inflater
Okay, but don't forget: BP is 16-bit, doesn't run in pmode (except with a dos extender)