Pascal programming in MorphOS?
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    matt3
    Posts: 690 from 2004/2/10
    Hi Everyone:

    I'm going to start working on an old game I wrote for the Amiga years ago. The only language I have used that is available on MorphOS is Pascal. Before starting back into my hobby, I was hoping someone could answer the following questions:

    1. Is the MorphOS version of pascal mature enough to program a stategy game including graphics, sound, and disk i/o?

    2. Will the current version of pascal run in MorphOS 2?

    If your curious at what the game will look/play like, it will be extremely similar to Ralph Reed's Mecforce game from the 80's. That game was an excellent piece of work. My game was based upon StarTrek not BattleTech, both board games create by FASA.

    Thanks for your Help!

    Matt

    p.s. What ever happened to Ralph Reed?
  • »15.12.07 - 21:11
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Quote:

    1. Is the MorphOS version of pascal mature enough to program a stategy game including graphics, sound, and disk i/o?


    What Pascal you mean? Free Pascal? Should be. If you find bugs, i'll fix them. If you have feature request, i'll implement them, when i have time. Be sure you use the latest version available, which is 2.0.4, ATM. There's no public IDE yet tho'. I started working on it, but it's not released yet. You can use Cubic IDE or any other editor, in the meanwhile, with the command line compiler. If you need help setting up a 3rd party IDE, just drop a note. There are various configs out there on the net tho'.

    Quote:

    Will the current version of pascal run in MorphOS 2?


    Again, if you mean Free Pascal Compiler then sure, it will work. There's nothing inside the compiler, or the surrounding libs which stops it working on MOS 2.0, and even if there would be, i'd fix it. :)
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »15.12.07 - 21:40
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    matt3
    Posts: 690 from 2004/2/10
    Hi Chain-Q:

    Nice work btw on the Free Pascal. Yes, that is what I was version that I thinking of.

    All the logic I can easily port over. I'm a bit more concerned with the graphics. Where would I find the information for graphics handling?

    I will begin work, as time permits, this week. I'm going to port over all the logic and I/O first and have a text version of the game first.

    I will keep you posted and if I find bugs I will notify you. This is going to be fun! I haven't programmed in over 15 years and I miss the relaxation of it.

    I compiled some simple stuff a few months back to get the hang of it and so far so good.

    Thanks again Chain-Q, your allowing me to have fun programming again.

    Kind regards,

    Matt
  • »15.12.07 - 23:41
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Quote:

    Where would I find the information for graphics handling?

    You have various choices. Free Pascal doesn't really have a "Graph" unit, like Turbo Pascal had back then, but instead, you can use the underlying OS' calls. For example MorphOS' built-in graphics.library, or OpenGL (TinyGL on MOS), or even SDL (PowerSDL on MOS). Tho', SDL support is not in the 2.0.4 release, but if you need it, i can give you a version, which have it. There are tons of examples of using OpenGL or SDL on the net, so i'd recommend these. Even if they're C-written examples, they're kinda easy to convert them to Pascal. But there are Pascal examples too. Most of them are useable on MorphOS.
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »16.12.07 - 01:25
    Profile Visit Website
  • MorphOS Developer
    zukow
    Posts: 645 from 2005/2/9
    From: Poland
    http://charlie.amigaspirit.hu/screenshots/pegasos/Pega2-MUIDC-Beta.png

    what is it ?
    dc++ client for mos ?
  • »16.12.07 - 12:22
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Yes. It was developed by scf, not me, and reached very limited level of functionality. I got an early beta to show it at some Am*ga show, or something. It was never finished or released. Feel free to bash scf for it, on #morphos/freenode. ;-) But again, it's practically non-functional in its current state.
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »16.12.07 - 17:17
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Lets resurrect this topic... Last night, nearly 2.5 years after the last stable build, and nearly after 1.5 years i last touched the sources, i found 1.5 hours, and mood to fix some stuff, then compile and package a recent build (version 2.3.1, r11868) of Free Pascal Compiler for MorphOS. Download here.

    Some OpenGL fixup, very basic SDL support, more MUI support with example apps, bugfixed smartlinking (was broken since 2.1.x times), and some more stuff i already forgot. Please note that this build is beta quality software, built from a development snapshot of the sources. Got problems? Report in this topic.
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »08.10.08 - 13:14
    Profile Visit Website
  • Leo
  • Order of the Butterfly
    Order of the Butterfly
    Leo
    Posts: 419 from 2003/8/18
    Quote:


    '. I started working on it,


    Nice :)
    Any chance I can test it even if it's not finished ?
    Nothing hurts a project more than developers not taking the time to let their community know what is going on.
  • »08.10.08 - 15:00
    Profile Visit Website
  • Butterfly
    Butterfly
    samo79
    Posts: 87 from 2003/7/26
    From: Italy
    Cool :-)

    Hope for an OS4 porting too :-)
    BACK FOR THE FUTURE

    http://www.betatesting.it/backforthefuture
  • »08.10.08 - 15:08
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Quote:

    Any chance I can test it even if it's not finished ?

    No chance, really. It doesn't even support full keyboard yet. Hotkeys with modifiers (ctrl/shift/alt) doesn't work, files can't load and save properly in the editor, Amiga-style paths not supported properly, config files are saved at bogus place, etcetc... And besides, it doesn't even compile from current sources, because Free Vision (the Turbo Vision clone used by the textmode IDE of FPC) got an overhaul and a restructuring in the meanwhile, and it means the very limited Am*gaOS/MorphOS patch-set i have for it doesn't apply to the current sources.

    So it needs a re-port. Which needs time, which i don't have. So sorry, no. (Well, never say never, but no promises, really.)
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »08.10.08 - 17:55
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Quote:

    Hope for an OS4 porting too

    There was a very very VERY early (but working) AmigaOS4 port by me, still available on Aminet and OS4Depot. That version should be able to compile a 2.2.2 release compiler, which should be able to compile current 2.3.1 sources. But OS4 support is even more limited than MOS support. Basically nothing works, except what's really needed to run the compiler itself.

    I started to add OS4 and MOS support to fd2pragma, to ease the conversion of header files from the C SDK, but that support never got fully finished, again, due to lack of time. (However, for example SDL support was done with it, on MOS.)
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »08.10.08 - 18:01
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    TheMagicM
    Posts: 1218 from 2003/6/17
    are there any sample apps (real apps, not calculator etc) that one can download to study?
  • »09.10.08 - 03:07
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    What apps? MorphOS specific with MUI & etc? None i know. But, there are plenty of other apps out there in Pascal, if you want to study the language. The main examples being the compiler itself (yes, FPC is written in FPC, sources here) and Lazarus, which is a Delphi-alike RAD environment based on and written in FPC, and also open source. MorphOS-specific sources of FPC runtime libs are here and also contain a good batch of information.

    Or you think about something else?
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »09.10.08 - 08:47
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Frostwork
    Posts: 302 from 2003/4/18
    just curious. is it possible to crosscompile on a linuxmachine
    for morphos with fpc?

    edit: ultrastar-deluxe!!!!!!!11111111111 :)

    [ Edited by Frostwork on 2008/10/9 9:03 ]
  • »09.10.08 - 09:01
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Quote:

    just curious. is it possible to crosscompile on a linuxmachine for morphos with fpc?

    Not out of the box in its current state, but in theory, it is possible. When MorphOS port was started, it was crosscompiled from Linux/PPC (and even from Linux/x86) in early times. But that was a manual crosscompile process, which means i compiled every single .pas file in the compiler and in the runtime libs to assembly files, copied to the MOS machine, then assembled and linked it by hand. And repeated this a couple of dozen times while debugging, and implementing stuff. :) That's how the first functional MOS and OS4 compilers were made.

    In the years passed since, Free Pascal got a much more comfortable cross-compilation infrastructure. There are official crosscompilers released now, for example for various embedded (ARM based) architectures. But MorphOS port currently (due to lack of time) doesn't really support this cross-compilation architecture.

    To cross compile with FPC you'd need:
    * gnu assembler running on the host platform (eg. Linux), capable of compiling MorphOS objects
    * vlink or GNU ld running on the host platform (eg. Linux), and capable of linking MorphOS executables
    * some poking into the MorphOS platform support (compiler/systems/t_morph.pas, IIRC), to support assembling and linking on non-MorphOS systems.
    * some Makefile regeneration mess, to support the above changes

    Basically, that's it. ;-) Easy, huh? :-P

    Anyway, why would you need to crosscompile to compile Ultrastar Deluxe? If the required APIs would be there, MOS compiler just could compile it happily. But the required APIs are not there (at least not all of them i guess), and crosscompiling won't change this...

    [ Edited by Chain-Q on 2008/10/9 10:43 ]
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »09.10.08 - 10:42
    Profile Visit Website
  • Leo
  • Order of the Butterfly
    Order of the Butterfly
    Leo
    Posts: 419 from 2003/8/18
    @Chain-Q: ok.. that's too bad :)

    @Frostwork: according to the Ultrastar Deluxe wiki, these libs are necessary:

    SDL, SDL-image, SDL-ttf, OpenGL, Portaudio, SQLite, FFmpeg

    I'm afraid some are missing...
    Nothing hurts a project more than developers not taking the time to let their community know what is going on.
  • »09.10.08 - 11:54
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Frostwork
    Posts: 302 from 2003/4/18
    cheers!
    thx for explanation - yeah sounds damn easy ;)
    the reason i asked for crosscompile is that i simply wiped out my old
    morphos installation with gg: and didn't have the time to set it up back again.
    last time i checked the usdx sources at least the libc unit
    was missing for ppc systems in fpc - no idea if usdx still requires it.
    and yes, portaudio would be a problem indeed :)
    ffmpeg should be optional though i think.
  • »09.10.08 - 12:54
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    You do not need gg: to use FPC. It comes with every tool you need. It's handly to have GG:, especially if you want to recompile the compiler itself, but for basic use, you don't need it.

    About that libc unit thing, i already had some pain with it, while fixing some code for PPC. It's some x86 only unit, for Delphi/Kylix compatibility, and never will be available on systems other than x86, IIRC. But it's not that hard to port code to use FPC equivalent calls, or to make a wrapper libc unit for these calls.
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »09.10.08 - 18:48
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    TheMagicM
    Posts: 1218 from 2003/6/17
    Quote:

    What apps? MorphOS specific with MUI & etc?


    yea.. those kinda apps.. lol
  • »10.10.08 - 04:12
    Profile Visit Website