Difference between revisions of "AmigaOS"

From Lazarus wiki
Jump to navigationJump to search
(AmigaOS/PPC porting guide)
 
Line 7: Line 7:
 
*Q: '''Is it possible to port Free Pascal Compiler to AmigaOS4, with simple recompilation?'''<br>A: No. A lot of additional steps needed. [[#Steps_needed_to_port_Free_Pascal_to_PowerPC_AmigaOS|See below]].
 
*Q: '''Is it possible to port Free Pascal Compiler to AmigaOS4, with simple recompilation?'''<br>A: No. A lot of additional steps needed. [[#Steps_needed_to_port_Free_Pascal_to_PowerPC_AmigaOS|See below]].
  
*Q: '''Don't you want to do the port?'''<br>A: I'd like to create the port, but I don't have any hardware capable of running AmigaOS4. If you want me to do the port, send me hardware to run OS4 on. Currently this can be an AmigaOne mainboard, or also a phase5/DCE CyberstormPPC accelerator for Commodore Amiga 3000/4000 computers, with valid OS4 license. The other option is to convince Hyperion to port AmigaOS4 to bPlan's Pegasos PowerPC mainboards.
+
*Q: '''Don't you want to do the port?'''<br>A: I'd like to create the port, but I don't have any hardware capable of running AmigaOS4. If you want me to do the port, send me hardware to run OS4 on. Currently this can be an AmigaOne mainboard, or also a phase5/DCE CyberstormPPC accelerator for Commodore Amiga 3000/4000 computers, with valid OS4 license. [mailto:charlie@NOSPAM.scenergy.dfmk.hu Contact me] if you're interrested. The other option is to convince Hyperion to port AmigaOS4 to bPlan's Pegasos PowerPC mainboards.
  
*Q: '''What if I'd like to do the port?'''<br>A: Great! Welcome in the team. Start with reading the the steps required to do it [[#Steps_needed_to_port_Free_Pascal_to_PowerPC_AmigaOS|below]]. If you've more questions, feel free to ask me in private e-mail, or on any Free Pascal Mailing List.
+
*Q: '''What if I'd like to do the port?'''<br>A: Great! Welcome in the team. Start with reading the the steps required to do it [[#Steps_needed_to_port_Free_Pascal_to_PowerPC_AmigaOS|below]]. If you've more questions, feel free to [mailto:charlie@NOSPAM.scenergy.dfmk.hu ask me in private e-mail], or on any Free Pascal Mailing List.
  
 
*Q: '''Can i do the AmigaOS4 port using Free Pascal 2.0.0 for MorphOS?'''<br>A: Yes. Any version of 2.0.0 will do for whatever platform you like, on x86 or PowerPC processors.
 
*Q: '''Can i do the AmigaOS4 port using Free Pascal 2.0.0 for MorphOS?'''<br>A: Yes. Any version of 2.0.0 will do for whatever platform you like, on x86 or PowerPC processors.
Line 16: Line 16:
  
 
*Q: '''MorphOS sucks and it's dead. You should concentrate on OS4!'''<br>A: You seriously need to get a life.
 
*Q: '''MorphOS sucks and it's dead. You should concentrate on OS4!'''<br>A: You seriously need to get a life.
 
  
 
==Equipment and knowledge needed==
 
==Equipment and knowledge needed==

Revision as of 14:49, 4 June 2005

This page is about how to realize a recent Free Pascal port to Hyperion's AmigaOS4 and possibly also to classic Amiga computers.

Frequently Asked Questions

  • Q: Is it possible to port Free Pascal Compiler to AmigaOS4?
    A: Yes.
  • Q: Is it possible to port Free Pascal Compiler to AmigaOS4, with simple recompilation?
    A: No. A lot of additional steps needed. See below.
  • Q: Don't you want to do the port?
    A: I'd like to create the port, but I don't have any hardware capable of running AmigaOS4. If you want me to do the port, send me hardware to run OS4 on. Currently this can be an AmigaOne mainboard, or also a phase5/DCE CyberstormPPC accelerator for Commodore Amiga 3000/4000 computers, with valid OS4 license. Contact me if you're interrested. The other option is to convince Hyperion to port AmigaOS4 to bPlan's Pegasos PowerPC mainboards.
  • Q: What if I'd like to do the port?
    A: Great! Welcome in the team. Start with reading the the steps required to do it below. If you've more questions, feel free to ask me in private e-mail, or on any Free Pascal Mailing List.
  • Q: Can i do the AmigaOS4 port using Free Pascal 2.0.0 for MorphOS?
    A: Yes. Any version of 2.0.0 will do for whatever platform you like, on x86 or PowerPC processors.
  • Q: Can i do the AmigaOS4 port using Free Pascal 1.0.10a for AmigaOS/m68k?
    A: No. And again: NO. That compiler is very old, and doesn't support quite a lot of things needed to compile the recent compiler sources, having PowerPC support. Simply forget about it.
  • Q: MorphOS sucks and it's dead. You should concentrate on OS4!
    A: You seriously need to get a life.

Equipment and knowledge needed

  • Any computer capable of running AmigaOS4. Basic OS4 compiler port might be possible on MorphOS, using OS4Emu, but this is only recommended for sado-mazochists.
  • Any computer capable of running 2.0.0 version of Free Pascal Compiler. Linux/i386 or Linux/PPC recommended. This will be our host platform, while OS4 will be referred as target platform.
  • Recent GNU LD/AS for AmigaOS4, or any linker capable of creating ELF32-Amiga executables. An example is the great vlink by Frank Wille. Of course, you also need to know how to use such tools. OS4 targetted cross-AS and cross-LD would be nice as well, and makes life easier, but not required.
  • Knowledge about compiler internals, since you'll probably need to modify the very internals of the compiler.
  • PowerPC assembly knowledge, and understanding of SysV ABI. You need to know how arguments passed between OS functions and the application programs. You need to know how libraries and devices work on the very low level, and you also need some PowerPC assembly knowledge, because at least when starting, you'll do quite a lot of manual hacks into the generated assembler files.
  • Understanding of C language. Since most software for AmigaOS-like systems are written using C language, you'll only find examples in C. It's nice if you understand C language quite well, because in other case you will not be able to rewrite such code to Pascal.
  • Read the FPC/MorphOS wiki page, hopefully it will make a lot of things more clear.


Steps needed to port Free Pascal to PowerPC AmigaOS

  1. First you need to add AmigaOS4 target support to the compiler. This can be done by creating i_aos4.pas and t_aos4.pas units, or extending i_amiga.pas and t_amiga.pas units to support PowerPC. The units are in /compiler/systems directory.
  2. The hardest part is to provide API support for OS4. The current function declaration syntax is heavily tied to MorphOS, and it will generate calls to dynamic libraries using MorphOS ABI. (Check /rtl/morphos/execf.inc for an example.) To modify this, you need to add support code into /compiler/pdecsub.pas, pd_syscall function, /compiler/powerpc/nppccal.pas tppccallnode.do_syscall function, and /compiler/powerpc/cpupara.pas tppcparamanager.parseparaloc function. Be prepared to repeat this step a few times, since others may modify parts of compiler which may broke your code.
  3. Create startup code for AmigaOS4. This is a short stub, written in assembly language, which allocates stack, boots the RTL (runtime-libraries), then the program itself. A trivial solution would be to modify MorphOS version, which is available in /rtl/morphos/prt0.as. It's currently using MorphOS API to allocate stack, but it's not that hard to solve this problem.
  4. Bootstrap a simple System unit. System unit skeletons are available, but it's possible to modify existing System units as well. Try to make a simple hello world! running. Use host platform to build units and executables, while test them on OS4.
  5. Extend System, DOS and Sysutils unit until you're able to compile the compiler itself. When doing MorphOS port, this was the hardest step, because the old 68k version was in really bad shape, had a huge amount of 68k assembly hacks, and it was really a nightmare to clean up and port. In case of OS4 port, your job is easy, simply reuse most of the MorphOS version, while extend it with AmigaOS4-specific functions and optimzations.
  6. Build an OS4 hosted compiler. If you did everything right, you will be able to compile the compiler then on OS4, and voila', you got Free Pascal Compiler on AmigaOS4.
  7. Extend the RTL to have more system-specific parts, and also to support more of the standard Pascal constructs like on other systems. This is more or less an endless step, since FPC is a moving target, and it's recommended to keep up with the developments.


Steps needed to port Free Pascal to Motorola 680x0-based AmigaOS

  1. Implement and finish the currently broken 68k code-generator for 2.0.0 series. It can be found in /compiler/m68k directory.
  2. Once you've finished, you need to follow steps very similar to AmigaOS/PowerPC port.