Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: AMAL reimplementation in Java  (Read 16236 times)

0 Members and 1 Guest are viewing this topic.

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
AMAL reimplementation in Java
« on: November 13, 2010, 01:22:37 PM »

I see the AMOS Animation Language hasn't gotten much love, even here.  :(

I have created an almost-complete implementation of AMAL in Clickteam's (now defunct) Jamagic language. It used an interpreter (running on an interpreter) and was somewhat slow, especially when parsing the AMAL strings.

I am currently in the process of developing a reimplementation of the AMOS Animation Language in Java.
My goal is to enable AMAL scripts to be created using standard Java Swing text editing, and ran from a Java applet via an interpreter, on both PCs and mobile devices.
It should also be possible to compile AMAL scripts directly to Java classes in Java code, which would be compilable into Java bytecode and runnable cross-platform via JIT compilation.

For the graphical engine I will use an open-source Java game engine such as JGame. This will also enable graphical effects far exceeding the Amiga, such as transparency effects via OpenGL enabling multiple parallax across various "screens", directly controllable via AMAL scripts. "Bobs" and "Sprites" would be implemented appropriately alongside "screens".

If I complete this project, I hope to release it under a BSD-style licence.

Due to various commitments, I am unlikely to have this project completed before Summer 2011.
However, if I ever get it working, I would look to do a C++ rewrite. Perhaps even an ANSI C rewrite if this would be useful for the Mattathias BASIC project.
« Last Edit: November 13, 2010, 01:38:01 PM by Mequa »
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: AMAL reimplementation in Java
« Reply #1 on: November 13, 2010, 04:52:47 PM »

I voted "UGH! Forget it already!" because it was essentially just a kludge to get animations to compile to faster machine language than the AmosPro compiler.  Also, Mattathias is on indefinite hold because it was taking too long to implement and Sidewinder and I ran into financial hardship as a result.  If Mattathias was still being actively developed, I would have said to go for it, but I'm just involved in portions of the project that I think will yield results quickly enough and broadly enough to be applied to other projects if at all possible.  AMAL would have been the last part of the project to be implemented anyway.   :P
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: AMAL reimplementation in Java
« Reply #2 on: November 13, 2010, 05:49:45 PM »


I voted "It may have some historical interest."

It was a great idea, and some people did manage to make some great use of it. But for me the 2 letter instructions were just too hard to remember and I prefer using normal commands (or assembler) for my software.


Regards,
Lonewolf10

PS. Sorry to hear about Mattathias. I hope the project gets completed someday, perhaps when the economy picks up (solar flares allowing).

Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: AMAL reimplementation in Java
« Reply #3 on: November 13, 2010, 06:57:15 PM »

PS. Sorry to hear about Mattathias. I hope the project gets completed someday, perhaps when the economy picks up (solar flares allowing).

Considering the next Blood Moon (lunar eclipse) is on the Winter Solstice, 2010, it looks like the Dreadful Day of the Lord is at hand.  ;)  Reference:  Joel 2:31-32.

In the meantime, I'm going to see about working on a shared-library collection of container classes with Chris Handley, the author of PortablE.  This could potentially be used with another object-oriented language.  Toward the end, we looked at making Mattathias into two projects: one AmosPro clone and one OOP language.  Perhaps PortablE will be that OOP language.

Maybe, if we are still around after the Second Coming and the Mattathias project makes sense in a few years, Sidewinder and I'll restart the Amos-clone aspect of Mattathias.  It's possible that Freddix will continue his DarkBasic clone though so we can look into helping with that instead.
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #4 on: November 13, 2010, 09:30:07 PM »

I voted "UGH! Forget it already!" because it was essentially just a kludge to get animations to compile to faster machine language than the AmosPro compiler

AMAL's compiler pre-dates the AMOSPro compiler.

AMAL added to AMOS the means to develop sprite scripts which run concurrently, effectively a primitive form of multi-threading. Without AMAL, managing multiple animated sprites in a procedural BASIC such as AMOS is cumbersome at best. AMAL effectively allowed each sprite to have its own unique program flow. This was an impressive trick which allowed a more concurrent programming style than otherwise permitted by AMOS (as well as being faster).
In allowing AMAL "channels" to be re-used for different sprites, AMAL also introduced a primitive form of object orientation.

AMAL was straightforward enough for me to become more-or-less fluent at the age of 10.
(This cannot be said for the AMOSPro Interface language, however, which I never bothered with.)

My Java reimplementation of AMAL is for my own interest, although I am happy to put the source out there (once it's completed) for anyone to re-use.
François Lionet has also expressed an interest in this project. ;)
« Last Edit: November 13, 2010, 09:31:53 PM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #5 on: November 13, 2010, 09:57:10 PM »

Just a quick mock-up (not final) of my proposed name and logo for this project: "jAMAL"



I have also obtained permission from François to use the names AMOS and AMAL.
« Last Edit: November 13, 2010, 10:01:19 PM by Mequa »
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: AMAL reimplementation in Java
« Reply #6 on: November 16, 2010, 09:16:56 PM »


AMAL was straightforward enough for me to become more-or-less fluent at the age of 10.
(This cannot be said for the AMOSPro Interface language, however, which I never bothered with.)


You got lucky, because the Interface examples in the manual don't seem to work. I did try it a few years back, but didn't get anyway. I did find code within the AMOS Pro executable which suggests that Francois used it for the bit that pops up after loading.


Regards,
Lonewolf10

Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #7 on: November 17, 2010, 04:19:57 PM »

Just to announce that my Java-based AMAL Lexer is well underway.
This will form the basis of an AMAL interpreter runnable from a Java applet.

At the moment, the Java-based lexer can understand and parse all AMAL instructions (including differentiating between PLR0=X and P LR0=X, for instance).
I have attached an output module which currently generates Java-style pseudo-code. My aim for this module is to output ready-to-compile Java code.

I have attached two AMAL scripts loadable via one standard ASCII text file, a stripped version of both scripts auto-generated by the lexer (which also works), and the output code. The output is not yet buildable, but gives a rough look at how both my AMAL compiler and interpreter will handle the code.

This output module will form the basis for an AMAL compiler, allowing generated Java code to be compiled with a Java compiler to Java bytecode (runnable via JIT compilation). However, it is likely that interpreted mode will be fast enough anyway (and most likely the only option in an applet).


Still to do for jAMAL Lexer:
- Allow numeric values (including hex $ABC) to be entered
- Allow complex expressions such as X*Y+A (evaluated strictly left-to-right)
- Allow functions such as XS(XM) and Z(256)
- Optimise data structures, split code to more classes, more testing

Once this is working, I'll be on to writing an interpreter and integrating it with something like JGame to simulate AMOS screens, bobs, sprites and rainbows.
« Last Edit: November 17, 2010, 04:32:46 PM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #8 on: November 17, 2010, 04:21:57 PM »

Approximate release date: July 2011
« Last Edit: November 17, 2010, 04:35:06 PM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #9 on: November 17, 2010, 11:49:23 PM »

Update: The jAMAL lexer now understands a considerable subset of AMAL, some major fixes have already been implemented.

I include the same kind of output as before, this time with input of 3 AMAL scripts.

I lifted some AMAL code directly from an AMOS game to illustrate - only Move and Anim are missing from this example (commas are still a WIP).

- Mequa

P.S. Correction to earlier - the correct AMAL code is XS(0,XM) for screen 0. This is also still being worked on.
« Last Edit: November 17, 2010, 11:59:52 PM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #10 on: December 05, 2010, 12:23:42 AM »

We have action!
The jAMAL interpreter (and lexer) is now working - in both Java application and applet mode - in conjunction with a basic jGame sprite.
The sprite's position is now directly controllable via an AMAL script. In Java. :D

AMAL scripts are loadable from an ASCII file either from disk or as an applet-friendly resource file.
(Most of AMAL is implemented already, there are just a few complex expressions/functions to debug.)

I'll likely beef up the AMOS simulation module over Christmas, and debug the lexer and interpreter some more.
A demo will follow shortly. (Source to be released next summer)
« Last Edit: December 05, 2010, 12:32:46 AM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #11 on: December 05, 2010, 01:49:12 AM »

Update: Make that 32 sprites controlled by 32 separate AMAL scripts (duplicated) on 32 channels. I believe I've surpassed AMOS? ;)
Running smooth (well as smooth as possible without JOGL). Much faster than my Jamagic prototype.

The script I tested was the third one from earlier (with the Autotest), it works fine. :D
It can also dynamically load AMAL scripts from Java strings, just like in AMOS.
« Last Edit: December 05, 2010, 01:59:02 AM by Mequa »
Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
jAMAL alpha demo 0.1
« Reply #12 on: December 10, 2010, 01:13:04 AM »

I present my first public release: jAMAL alpha demo 0.1.

jAMAL.jar and readme.txt files enclosed in a zip file (members only).
This is still somewhat buggy, but as a proof of concept this alpha works well.

I'll be sending a copy to François. (edit: done)
« Last Edit: December 10, 2010, 01:23:50 AM by Mequa »
Logged

Aghnar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
Re: AMAL reimplementation in Java
« Reply #13 on: December 10, 2010, 01:05:29 PM »

Hello,

Very interesting.

You probably think already about this but don't forget integration with IDE like eclipse or netbeans.

Good luck.

Bye


Logged

Mequa

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: AMAL reimplementation in Java
« Reply #14 on: December 10, 2010, 04:47:53 PM »

Hi,

This is already integrated in Eclipse :) I haven't used NetBeans though.

AMAL banks can be loaded from ASCII plain text files, either from disk (not in the demo) or a resource file.
Currently all examples I added in the demo (each containing one or multiple AMAL scripts) are stored as ASCII plain text files with the extension ".amal" as an Eclipse resource file.

The AMAL scripts (as resource files) are directly editable in Eclipse as plain text. Edit the AMAL and press "run" in Eclipse - it will update it just as naturally as editing Java source. (You'll have to wait for the jAMAL sources to be released first though - coming soon ;))

In case you wondered, this demo WILL allow you to modify and run your own AMAL scripts. Delete the content of a channel's program to write your own. It's currently a bit buggy though (I need to iron out some concurrency issues in the editor I cobbled together). Select Start -> Run from its menu to run. If it fails, try it again. It usually works perfectly eventually. (Unless your code has syntax errors, or currently unsupported syntax [see readme.txt], which may cause the alpha version to hang.)
« Last Edit: December 10, 2010, 04:58:46 PM by Mequa »
Logged
Pages: [1] 2   Go Up
 

TinyPortal 2.2.2 © 2005-2022