Recent

Author Topic: I plan to use Pascal and assembly to write the operating system.  (Read 2744 times)

Akiko_Official

  • Newbie
  • Posts: 4
I plan to use Pascal and assembly to write the operating system.
« on: September 05, 2023, 03:08:58 pm »
How can I compile pas code so that it does not rely on the runtime of the system but only on the runtime interrupts provided by the BIOS?

Fibonacci

  • Hero Member
  • *****
  • Posts: 643
  • Internal Error Hunter

Akiko_Official

  • Newbie
  • Posts: 4
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #2 on: September 05, 2023, 03:19:51 pm »
Thank you, but the example it provides is -Tlinux, and I need to compile it into binary format - I need it on the boot block of my customized file system, which is why I cannot use any other Bootloader

ccrause

  • Hero Member
  • *****
  • Posts: 984
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #3 on: September 05, 2023, 04:43:52 pm »
Take a look at here
https://forum.lazarus.freepascal.org/index.php?topic=57787.0

Please note the following comment in the above discussion by PascalDragon:
That article essentially abuses the Linux target for this. However for barebones development FPC has the Embedded target (most might associate it with micro controllers, but in essence it means “without an OS”).
There is an i386 embedded target that sets up a multiboot header then jumps to PASCALMAIN.  This may be a feasible starting point, basically all other functionality you have to provide yourself.

Akiko_Official

  • Newbie
  • Posts: 4
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #4 on: September 05, 2023, 04:47:14 pm »
I'm sorry, it cannot use multiboot. Beacuse the bootloader(using assembly and pascal) is combined into the FS's boot block, it must compiled in binary format

Laksen

  • Hero Member
  • *****
  • Posts: 786
    • J-Software
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #5 on: September 05, 2023, 04:57:32 pm »
Read up on how to use objcopy. It can do what you need after compiling with -Tembedded

Laksen

  • Hero Member
  • *****
  • Posts: 786
    • J-Software
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #6 on: September 05, 2023, 05:16:37 pm »
Ah and missed that you wrote about interrupts.. For those you need to be in realmode where you'll need a 16 bit compiler.
I guess it might be possible theoretically to do with FPC but never tried it.

Akiko_Official

  • Newbie
  • Posts: 4
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #7 on: September 06, 2023, 02:33:57 am »
Thanks, could you tell me how it works?
Read up on how to use objcopy. It can do what you need after compiling with -Tembedded

Leledumbo

  • Hero Member
  • *****
  • Posts: 8783
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #8 on: September 06, 2023, 06:01:41 am »
For those you need to be in realmode where you'll need a 16 bit compiler.
There's a 16-bit DOS (8086) cross compiler, I've tested in the past and it worked OK. You even have multiple memory models to choose.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5796
  • Compiler Developer
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #9 on: September 07, 2023, 10:52:39 pm »
Ah and missed that you wrote about interrupts.. For those you need to be in realmode where you'll need a 16 bit compiler.
I guess it might be possible theoretically to do with FPC but never tried it.

It's possible with the i8086-embedded target however one needs to write custom startup code for it. I have done that once for something at work, but I have not yet found the time to document it.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8082
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #10 on: September 08, 2023, 09:25:26 am »
In any event, if doing something like this you have to be 100% confident that the start of the binary is in a format that the loader can handle. It's very common for this operation to be handled by the linker (which is OS-specific, or at least has command-line options to tailor it to a particular OS), and it's very common for it to derive from RTL initialisation code handcrafted in assembler: hence somebody's mention of objcopy to tune this.

When I was doing this sort of thing I had a custom binder program which put descriptor tables at the start of the binary. Input syntax was based on Intel documents, the implementation was my own.

I'd mention here that there used to be a mainframe range which was very heavily promoted as having all system software (i.e. including the OS) written in ALGOL. However when one scratched the surface one found that the OS had a special compiler distinct from that used for application code, and that the initial loader was a carefully-constructed binary: whether there was, in fact, an internal-use assembler is lost in the mists of time.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

coradi

  • Full Member
  • ***
  • Posts: 167
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #11 on: October 04, 2023, 07:33:03 pm »
nice,  can you provide some information and the progress?

For which CPU?

Why not Z80? :-) There is only CP/M at this moment
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5796
  • Compiler Developer
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #12 on: October 05, 2023, 09:07:57 pm »
Why not Z80? :-) There is only CP/M at this moment

So you don't know MSX-DOS, whatever the ZX Spectrum uses or SymbOS? ;)

coradi

  • Full Member
  • ***
  • Posts: 167
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #13 on: October 05, 2023, 09:49:13 pm »
OK, yes. I forget the Others.
But now WE can have one in Pascal🤗 with Sourcecode.
Maybe there is a bigger Community für this diy z80 PCs
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11980
  • FPC developer.
Re: I plan to use Pascal and assembly to write the operating system.
« Reply #14 on: October 06, 2023, 09:05:07 am »
So you don't know MSX-DOS, whatever the ZX Spectrum uses or SymbOS? ;)

C=128 in native mode ? :-)

 

TinyPortal © 2005-2018