Portabl E examples

If you have any programming questions, then please ask on the official Portabl E forum.

This page contains examples for the r6 release of Portabl E, which is now aimed at beginners & those new to the E language.

Please note that examples with music need the ptplay.library installed.  You can get it from here:
https://aminet.net/package/util/libs/ptplaylib_os4 (AmigaOS4)
https://aminet.net/package/mus/play/PTPlayLibrary (AmigaOS3 & MOS)

Please note that examples with GUIs (especially lists) may need the NList or TextEditor add-on for MUI:
https://sourceforge.net/projects/nlist-classes/
https://sourceforge.net/projects/texteditor-mcc/

WARNING: To prevent bots from using all my bandwidth, when downloading you may be asked to enter a username & password:
PLEASE TYPE user FOR THE USERNAME AND password FOR THE PASSWORD.
If this causes you problems then please email me.

Example 1: ShootEmUp.e

This is "the big one".  It is a complete (albiet simple) shoot-em'up in only 1150 lines of E code.  It is not intended to show how easy Portabl E is, but rather what Portabl E is capable of, and what you might hope to achieve (particularly if you set your mind to).  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here are some screen shots:

(click to enlarge, then press the Back button to return here)

Example 2: SimpleModPlayer.e

Since the first example is probably a bit big for beginners to digest, this is a nice small example.  It shows how to make a simple GUI, as well as handle music playback, in just 68 lines of E code!  You can download it here, and it comes with executables for Amiga OS4, OS3, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

Example 3: ToySpaceshipSprite1.e

This example shows how to smoothly move (and animate) a player sprite, in 117 lines of E code.  It should provide a good starting point for a game, and also gives beginners something to experiment with.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

(click to enlarge, then press the Back button to return here)

Example 4: ToySpaceshipSprite2.e

Since the previous example may still be a bit big for complete beginners, I'm also providing this example.  It shows how to move (a little jerkily!) a player sprite, in just 56 lines of E code.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

(click to enlarge, then press the Back button to return here)

Example 5: SOTB.e

This is a pretty Shadow Of The Beast like scroller, called "Shadow Of The Blitz".  It is based upon a BlitzBasic demo by aNa|0Gue (who kindly gave his blessing), but has been enhanced by adding music, a running main character, and 'background' trees.  The resolution has been doubled from 288x200 to 576*400, and then a black border added to bring it up to a monitor-friendly 640x480 resolution.  A couple of glitches in two bitmaps were corrected (the bitmaps were also converted to IFF so that it worked correctly on AROS).  I also converted it from using manually-drawn bitmaps to automatically-drawn sprites, which was easy thanks to Portabl E's "tiled sprites".  Tiled sprites make parallax scrolling (& scrolling backgrounds in general) very easy to do.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  The archive also includes the original BlitzBasic demo "sotb.bb", and "sotb_orig.e" which was my initial direct conversion to E.  You can also view the source code here.

To give you an idea what to expect, here are some screen shots:

(click to enlarge, then press the Back button to return here)

Example 6: SimpleCalculator.e

As more GUI examples have been requested, here is a simple calculator, in 112 lines of E code.  So that you could see the GUI code without too much klutter, I cheated a little:  The calculator only does integer maths (no floating point), which means that 3 divided by 2 equals 1 not 1.5 !  But it's not too much extra work if you want to add floating-point support...  You can download it here, and it comes with executables for Amiga OS4, OS3, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

Example 7: ToySketch.e

Someone wanted to know how to handle mouse input, so this example is a very simple drawing program, in 79 lines of E code.  (It could have been even smaller, but I got carried away adding features!)  I think you could have great fun expanding this into a fairly fully-featured drawing program...  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

(click to enlarge, then press the Back button to return here)

Example 8: StarsXY.e

This is the first of several pretty "stars" examples.  They are not so much examples of the graphics module as they are examples of  general Portabl E code, and what can be achieved with a little bit of clever maths.

This example shows stars moving across the screen (in the X/Y plane), with depth parallax, in 87 lines of E code.  Although it is fairly well optimised, I have avoided a few obvious optimisations to keep the code clearer.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 9: StarsZ.e

After writing the first "stars" example, I got to wondering how a lowly A500 could manage to "zoom into" stars...  After some fiddling I came-up with an algorithm which has low memory & CPU usage, and only uses integer maths.  So it could quite plausibly be the same algorithm as used by some A500 demos (albiet in E not 68k assembler, and the benefit of being resolution independant).

This example shows stars moving out of the screen (in the Z plane), in 92 lines of code.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 10: StarsZYX.e

Some A500 demos & bootblock loaders did more than just zooming straight into stars, they actually moved around inside them (in 3 dimensions).  After some thinking, I realised I could use a trick from StarsXY.e to do this with my StarsZ.e code.

This example shows stars moving out of the screen, while also moving across the screen, in 108 lines of E code.  It could however do any movement within the star field, by just changing how x/y/zOrigin are updated.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 11: StarsDemo.e

After doing the rather demo-like StarsZYX.e example, I realised it wouldn't take much more to make it feel like a real demo or bootblock loader.  So what I did was add some demo-like music (very easy!), and a wavy text scroller (less easy but it was fun to work out how to do it).  It comes to 234 lines of E code.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 12: Clock.e

This example shows a resizable graphics window, which contains a basic analogue clock.  It is a port of an old AmigaE program by Horst Schumann, and is 210 lines of E code (plus 39 lines of comments at the start).  Shows how to handle a resizable window, and how to use a timer.  There is also quite a bit of maths to get the lines to go around in a circle, which you should probably ignore!  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:


Example 13: Mandel.e

This example is a simple program to draw a Mandelbrot fractal.  It is a port of an old YAEC program by Leif., and is just 57 lines of E code.  The small size makes it a nice example of drawing directly into a graphics window (without anything fancy like vblank synchronisation).  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:


Example 14: Pythagoras.e

This example is a small program to draw a Tree of Pythagoras fractal.  It is also a port of an old YAEC program by Leif, and is just 58 lines of E code.  It is another nice example of drawing directly into a graphics window.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

(click to enlarge, then press the Back button to return here)

Example 15: StarsXY_ToySpaceshipSprite1.e

This example is more advanced, as it takes ToySpaceshipSprite1.e & replaces the purpley background with the moving stars from StarsXY.e .  This required turning the StarsXY example into a cGfxDrawable object, and is a good example of how to have anything as a background behinds sprites.  I made the stars movement match the spaceship movement, so it feels like you are moving through the stars yourself, but I could have made the stars move on their own.  It comes to 295 lines of E code.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 16: StarsZYX_ToySpaceshipSprite1.e

This is similar to the previous example, as it takes ToySpaceshipSprite1.e & replaces the purpley background with the moving stars from StarsZYX.e .  Again, it required turning the StarsZYX example into a cGfxDrawable object.  I made the stars move on their own, but I could have made the stars movement match the spaceship movement.  It comes to 337 lines of E code.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

An unmoving screen shot doesn't really give you much idea what to expect, but here is one anyway:

(click to enlarge, then press the Back button to return here)

Example 17: IfsFern.e

This example program uses some clever maths to draw fractal fern.  It is a port of an old YAEC program by Leif., and is just 60 lines of E code.  It isn't a particularly good example of drawing in a window (it merely draws lots of dots!), but it's pretty enough that I wanted to include it anyway.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

(click to enlarge, then press the Back button to return here)

Example 18: cosmic_deluxe.e

This example program uses a clever combination of fractal maths & randomness to create a random sequence of pretty "cosmic flames", which is hard to explain so just try the demo!  It's code has passed through many hands (see the source code header), going as far back as 1988.  Again, it's not a particularly good example of drawing in a window (it merely draws lots of dots!), but it's pretty enough that I wanted to include it anyway.  You can download it here, and it comes with executables for Amiga OS4, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here are two screen shots:

(click to enlarge, then press the Back button to return here)

Example 19: Stacker.e

This example program is a real utility for listing & examining all running tasks & processes, in 436 lines of E code.  It is intended to be an advanced example of the GUI's (newly added) dynamic list.  There is also a lot of Amiga-specific code for safely retrieving information about all the running tasks & processes.  You can download it here, and it comes with executables for Amiga OS4, OS3, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:


Example 20: SimpleGameLauncher.e

This example is a simple but useful program for storing & launching a list of games (or other programs!), in 212 lines of E code.  It is intended to be an intermediate example of the GUI's (newly added) dynamic list.  This code is really just a very early version of eGame, and so shows how a simple program can grow into an advanced one (that users were actually willing to pay for!).  You can download it here, and it comes with executables for Amiga OS4, OS3, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:


Example 21: DirList.e

This example program shows how to create a GUI listing the contents of a folder & see what files the user has selected, in just 85 lines of E code.  It is intended to be an easy example of the GUI's (newly added) dynamic list.  You can download it here, and it comes with executables for Amiga OS4, OS3, AROS & MorphOS.  You can also view the source code here.

To give you an idea what to expect, here is a screen shot:

.