Java on the Commodore Amiga with Java Grinder, joystick routine, part 3

14 May

In this third episode I’ll create a joystick routine that reads out the joystick / gamepad directions and the fire button.

You’ll need a recent version of java grinder as the initial source base for the Amiga didn’t support reading out memory locations. I contacted the author of grinder and the next day these functions were implemented by Michael Kohn into the memory class, thanks Michael.

I took me a while to figure out how the Amiga reads the joy ports, a bit of trail an error I came to this AmigaJoystick class:

import net.mikekohn.java_grinder.Memory;

public class AmigaJoystick {

	static public final int JOY0 = 0;
	static public final int JOY1 = 1;
	static final int JOY0DAT = 0xDFF00A;
	static final int JOY1DAT = 0xDFF00C;
	static final int CIAAPRA = 0xBFE001; // 8bit
	static public final int FIRE0 = 0x40;
	static public final int FIRE1 = 0x80;
	static public final int JOYLEFT = 0x0200;
	static public final int JOYRIGHT = 0x0002;
	static public final int JOYUP = 0x0100;
	static public final int JOYDOWN = 0x0001;



	public static int getDir(int joy) {
		int dir = 0;
		if (joy == 0) {
			dir = Memory.read16(JOY0DAT);
		} else {
			dir = Memory.read16(JOY1DAT);
		}

		if (((dir >> 1 ^ dir) & JOYDOWN) == JOYDOWN) {
			return JOYDOWN;
		} else if (((dir >> 1 ^ dir) & JOYUP) == JOYUP) {
			return JOYUP;
		} else if ((dir & JOYLEFT) == JOYLEFT) {
			return JOYLEFT;
		} else if ((dir & JOYRIGHT) == JOYRIGHT) {
			return JOYRIGHT;
		} else {
			return 0;
		}
	}

	public static boolean getFire(int joy) {
		byte fire = 0;
		fire = Memory.read8(CIAAPRA);
		if (joy == 0) {
			if ((fire & FIRE0) == 0x00) {
				return true;
			}
		} else {
			if ((fire & FIRE1) == 0x00) {
				return true;
			}
		}
		return false;
	}

}

Here’s a little example how to use it

    int direction = AmigaJoystick.getDir(AmigaJoystick.JOY1);
    if(direction == JOYDOWN) {
    	...;
    } else if(direction == JOYUP) {
    	...;
    } else if(direction == JOYLEFT) {
    	...;
    } else if(direction == JOYRIGHT) {
    	...;
    }
    
    if(AmigaJoystick.getFire(AmigaJoystick.JOY1) == true) {
    	...;
    }

Please notice that in the emulator the joystick is usually bound to JOY1 port and mouse to JOY0.

In the next episode I’ll tackle the use of text in Amiga grinder, which is quite difficult as no String class is implemented, so watch this space end enjoy coding.

Java on the Commodore Amiga with Java Grinder, part 2

12 Apr

In this second episode I’ll setup the linux Amiga emulater fs-uae as a basic Commodore Amiga 500 system with 512kb of chip ram. I also configure a harddrive so we can easy copy the generated amiga_demo binary to the Amiga emulation.

So let’s start.

Not necessary but I prefer to have the workbench disk on my local drive, you could read it from the mounted iso as showed in part 1.

The files are located on the cd AmigaForever: Amiga files -> Shared -> adf

I’ve copied them to a local folder ‘Amiga’ on my laptop. (/home/luc/amiga/Shared/adf)

In the same ‘amiga’ folder I created a new folder ‘driveA’ which I’ll use as an emulated harddrive later on. (/home/luc/amiga/driveA)

Open fs-uae and create a new profile.

Give a name to the configuration, ex. ‘Amiga 500 chip’, press the button next to the text input to save your configuration later on when we have configured everything.

Before you can select your Amiga model as in the picture above you need to import the kickstart roms.

Click the Amiga checkflag logo button in the upper left corner (see arrow in picture), in the menu that pops up select ‘import kickstarts’. In the dialog you can choose the source on how to import the kickstart roms (files).

If you have the cloanta iso cd you can import it from there, which I did. Once imported you can select the Amiga model (See picture above). For our java grinder test I created a basic A500 model with kickstart 1.3 ROM.

Next you’ll need the workbench disk for v1.3,go to the ‘Floppy drives’ section in the home tab.

Select workbench 1.3 (amiga-os-1.3.4-workbench.adf) from the iso cd Amiga files -> Shared -> adf or from the local copy I made earlier on in the Amiga folder.

Next move to the ‘Harddrives’ tab.

You can assign 4 harddrives to the emulation (DH0:, DH1:, DH2:, DH3:).

For our example we’ll need 1 drive, click the yellow folder button to select a folder on your linux box. Mine was at /home/luc/amiga/driveA.

Next move to the ‘ROM and RAM’ tab.

Just enable ‘Chip RAM 512kb’ all the remaining option shouldn’t be enabled see picture.

The current version of Java Grinder doesn’t place the gfx data explicit in chip ram, so if you enable fast ram the demo will only work partialy and could crash.

Go back to the ‘home’ tab (main configuration options) and finaly click the button to save the configuration.

Before we can fire up the emulator, we’ll need to do one thing, copy the ‘amiga_demo’ binary created in part 1. Have a look at your samples/amiga folder in the java grinder project it’s around 140,7kb in size.

Copy the binary to the harddrive folder configured earlier on. (/home/luc/amiga/driveA)

Start the emulator by clicking on the ‘Start’ button, lower right.

Once workbench disk has stopped loading double click the Workbench1.3 icon.

Double click in the Workbench1.3 folder the Shell icon.

In the shell type:

cd DHO:

amiga_demo

Enjoy the demo and see you back in part 3.

Added a 4th cabinet with vintage gaming consoles

9 Apr

Today added a new cabinet to my museum wall.

Found some time to cleanup and install some of my collection in the cabinet.

Present today:

  • Atari 2600
  • Atari 7800
  • Atari Lynx
  • Nintendo NES
  • Nintendo SNES
  • Nintendo 64
  • Nintendo Gameboy color
  • Nintendo DS
  • Sega master system II
  • Sega mega drive
  • Sega mega drive II

Proud of the mint condition 7800, I bought it new in 2001 with the 2600 from a dealer who sold his old stock.

The games for the 7800 were also bought brand new from a dealer in the USA and yes I opend up the package to play the games. But I’m not collecting for money, it’s for fun.

I’ve limited the collection to cartridge based systems, one day I add another cabinet with the cd consoles if I find some place 😉

PS: Spot the odd system in the photo below, hint it ends with pi…

Java on the Commodore Amiga with Java Grinder, part 1

7 Apr

Okay those who know java are now scratching their heads a java VM on the Amiga ? Not exactly I’ll be using a java byte code to native compiler chain called Java Grinder.

Java Grinder is not limited to the Amiga alone, it supports a lot of older computer systems like the C64, Apple II, Playstation2, Nintendo64, Sega genesis etc…

For more detail about java grinder visit Michael Kohn’s website: http://www.mikekohn.net/micro/amiga_java.php

Before you can use java ginder you need to install naken_asm.

Install naken_asm

Download the naken assembler package from git@github.com:mikeakohn/naken_asm.git, I used Eclipse to download and create a generic project.

The naked_asm also need the libreadline-dev on your linux machine.

sudo apt-get install libreadline-dev

Go to the naken_asm installation directory and type the next commands

cd naken_asm
./configure
make

Install Java grinder

Download the java_grinder project from github git@github.com:mikeakohn/java_grinder.git, again I created an eclipse project.

Build the make files

cd java_grinder
make

cd java_grinder/samples/amiga
make

Install Amiga emulator

Before you can test any code you need an Amiga emulator and some kickstart roms and floppy/hd images.

The emulator for linux

sudo apt-add-repository ppa:fengestad/stable
sudo apt-get update
sudo apt-get install fs-uae fs-uae-launcher fs-use-arcade

This should put some start icon in the ubuntu show application, FS-UAE Launcher and FS-UAE Arcade respectively.

The kickstart files

  • Buy and download these from https://www.amigaforever.com/ (I opted for the plus edition as it comes with all the kickstart rom etc…)
  • Unzip the downloaded file (AmigaForever9Plus.zip)
  • In the zip you’ll find an iso cd image you can mount in ubuntu with right clicking on the file af-dvd.iso then ‘open with disk image mounter’. (If not shown use the ‘open with other application’ and select the disk image mounter from there.)
  • This should put an AmigaForever CD icon on your desktop, double click it to open the cd.
  • The roms files can be found in the path ‘Amiga Files -> Shared -> rom’.

That’s it for part 1, in the next episode I’ll setup the emulator, so I can test the binary demo.

Happy retro coding, with a modern twist.

Moving retro computer collection to new showcase cabinets

11 Nov

Wow seems my last post dated from almost 6 years ago.

Well I didn’t stop collecting or designing new (old) stuff but more of that in a later post.

Recently I had the opportunity to buy 3 new showcase cabinets before we went in lockdown again. So last week I had a bit of time to move most of my collection to the new cabinets.

My game consoles are still in storage, probably need some extra 2 cabinets.

Girlfriend pointed out that I should make a museum of it, maybe something for later. The room already served as a shop before, so it would not take that much investment.

Still want some British classics as the BBC, Electron, Acorn stuff or the Jupiter ACE ($$$) and maybe a Commodore PET ($$$) but again I don’t want to spend a fortune on it. I like those classics as I new those from my childhood, reading lots of early British, Dutch en German computer magazines.

Also playing with the taught of creating a vintage computer/games club as way back in the 80/90ties. I was first secretary and later president at that time of a local Commodore Amiga Club (Bornem). Have fond memories of that time and still bunch of friends that I got to know there.

Retro computer museum in a cabinet

31 May

I finally found some time to get my collection out of the boxes, they still need a clean up or a retro bright treatment to make them a bit whiter again.

DSCF0739

I try to collect the early eighties 8-bit microcomputers, still missing some essential hardware of that time:

– Apple II

– BBC

– Acorn ..

– Oric Atmos

– Dragon

– Jupiter ACE

That last one, recently had the whole brand on sale at ebay for 10000 pound, if I had the money, … euromillions please !!! See http://www.thejupiterace.co.uk/

If I find some place in another cabinet I can display my collection of early 8/16 bit cartrdige based consoles, for the time being they are still in the boxes…

I’m becoming like my wife using closet space for retro stuff and she collects… dresses, shoes…. 🙂

 

Hello again VIC or should I say VC-20 ?

9 Feb

I recently purchased a Commodore VIC-20 again, yes again, my first one I bought one here in Belgium in a local photo shop, must have been 1984 I realise now.

DSC_0113

I think it was just a year later after I had bought a Sinclair ZX81, the VIC  was all what the ZX was not, lots of colour, sound chip, more memory (5K) and the price over here was just a little more than the ZX, I must have paid 7500 BEF for it.

Back to the future, luckily I won the bidding over a VIC-20 on a secondhand website. The VIC-20 was in it’s original box and all orginal included accessories were in mint condition. But I remarked some differences with my original VIC which was probably a Japanese model while this one was certainly destined for the German marked. Power supply was marked as VC-20, this is the name that the VIC was marketed in Germany as Volks Computer.

So in mint condition, but does it works, yes, the red power light flashed on and the VIC welcome screen was shown on screen….

For more technical info about the Commodore VIC-20, visit the wikipedia site http://en.wikipedia.org/wiki/Vic-20 it has extensive section on the VIC.

And welcome back VIC to my collection.

Mitsubishi MSX ML-F80

23 Dec

I recently aquired an 1983 MSX manufactured by Mitsubishi;

DSC_0081

It’s an MSX 1 with 64kb RAM I found some extra information here http://www.old-computers.com/museum/computer.asp?st=1&c=431

DSC_0086 DSC_0085 DSC_0087

Msx basic isn’t the same as the C64 basic, I had to to some research to write  a small basic script with my 7 year old son, but we succeeded 🙂

DSC_0089

Next find some cartridges to test the cartridge port, I never had an MSX when I was a child but a went to a local electorshop to try out their Sony hitbit which was on display. Remember playing some sort of ‘pitfall’ game on it. I have a hitbit in my collection but it isn’t in working condition.

Any Belgian retro-collectors out there who can lend me a cart ? They’re difficult to track-down on second-hand sites here.

Next time I dig up my Panasonic MSX together with  the Sony hitbit to complete the picture…

 

Installing and running an Atari 800 XL emulator on Ubuntu linux.

31 Jan

After reading a lot lately about some Retro Atari games, I decided to search for an Atari 800 xl emulator for Ubuntu. Yeh I ditched win7 this summer after numerous problems with my new core I7 laptop. So this happy Ubuntu user only had to type ‘atari’ in the Ubuntu Software Center to find Atari800 an Atrai 800, XL, XE, 5200, … emulator for linux systems. (See http://atari800.sourceforge.net)

So what now, the installation doesn’t put a launch icon in the Ubuntu launcher ? But wait before doing that we still missing something, the Atari ROMS, these are copyrighted so are not in the install archive. Luckily you can find the ROMS here http://pleasantfiction.ipower.com/ps3linux/xf25.zip unzip the archive on your computer.

Open a terminal window and type: atari800 -width 800 -height 600 -dsprate 48000 -windowed

ScreenshotAtari800EmuConfig

This should fire up the emulator, the emulator will show a message that it needs the ROMS. So we give it some ROMS, press F1, in the menu navigate to emulator configuration. Press ENTER, for each ROM in the zip archive you unzipped in the previous step set it’s path in the Emulator config.  When you restart the emulator (cold restart) it should find it’s ROMS,  You can resize the Atari800 emulator  just by resizing the window.

The emulator supports different kind of atari files like rom, atr,… But don’t forget the remove the cartridge (rom) if you want to load disk or cassette files after, as the cartridge will boot first, hey it’s an emulator of the real machine…

Here’s a screenshot of the classic pengo running on the Atari.

screenshotAtari800EmuPengo

I could be running these on my real machines, I have a boxed Atari 800 XL and an Atari 130 XE but sadly only a taperecoder and no tapes… Luckily I found out that some Atari fans have created an Arduino based sio2sd device but that’s another blog post.

Aside

DIY Android Game Console

18 Oct

While everybody is waiting for the ouya to arrive -you know the kickstarter funded project for a top notch Android  gaming console – just make one yourself.

What are the ingredients, well easy an Olimex OLinuxIno board (45 euro, with Android ICS image), an ordinary pc USB gamepad (10 euro), monitor or TV screen VGA and audio input.

As already mentioned in a previous post the Olimex board features a 1Ghz A13 Allwinner CPU and a Mali400 GPU plenty of power for an Android gaming console.

See https://www.olimex.com/Products/OLinuXino/A13/A13-OLinuXino/

You don’t need to install special software to use usb gamepads or joysticks. Since 3.1 Android offers out of the box support for game controllers. The app you see running on the video is the ApiDemos app you can find in the Android devs examples. Click on the Views -> Game Controller Input  in the ApiDemos example.

See http://android-developers.blogspot.be/2011/05/android-31-platform-new-sdk-tools.html

 

If you want to create Android games I suggest you’ll give AndEngine a try, see www.andengine.org

While there’s no real documentation, you can buy a book written by Rick Rogers that explains AndEngine in detail plus the beginning of writing games. ‘Learning Android Game Programming’ published by Addison-Wesley and available on Amazon,com where else ?

There are a few branches of AndEngine out there, I created my own version in the beginning of AndEngine one that still runs on 1.5 devices, yes I have a phone and tablet that run 1.5…yes that old…

On thing still missing is a plastic case for your console, I’m working on that, so keep en eye on my blog, when it’s ready I’ll publish the 3D files here so you can print one…

Create your own website, free on WordPress.com.Create your own website.
Start free