Showing posts with label e-uae. Show all posts
Showing posts with label e-uae. Show all posts

Friday, 27 August 2010

LAP - E-UAE (Configuration)

We now have the Amiga Emulator up and running. We could now do just about everything we want to with the GUI configuration panel. However, a better option is to make configuration files for each different type of Amiga that we are going to be emulating.

First of all we are going to tidy up our /root folder. By now it is probably full of installation scripts. I would delete everything apart from the startx scripts, the compression instructions, and the wifi scripts. I made a new amiga folder to store the new settings and files:
mkdir ~/amiga
mkdir ~/amiga/roms
mkdir ~/amiga/disks
mkdir ~/amiga/harddisks
mkdir ~/amiga/shared

The folder names should give away the nature of the contents. We will store the configuration files in the ~/amiga folder. The [shared] folder is going to be treated like a harddisk by the Amiga, so I can easily pass files to and from the Amiga. I have moved the disk and rom images to the appropriate folder.

I am going to set up four machines, an A500, an A1200 and the same two but with hard disks installed. The first thing I am going to do is to make the files that will be treated as harddisks. TO do this I am going to use linux's [dd] program. The program is used to copy stuff at a very low level. The commands are as follows:

dd if=/dev/zero of=~/amiga/harddisks/A500_hdd.hdf bs=512 count=40960
dd if=/dev/zero of=~/amiga/harddisks/A1200_hdd.hdf bs=512 count=81920 

The commands copy from the [i]nput [f]ile [/dev/zero] (which is obviously blank) to the [o]utput [f]ile named, in 512 [b]yte[s] chunks. For the A500 we use 40960 chunks of 512 bytes, which should get us a 20Mb disk. The A1200 should get a 40Mb file.

First of all, we'll create the simplest machine - the A500. The configuration file is just a text document, and the '#' comment tag works as normal. I am going to structure the file into theme'd sections. I'll start with the Disk drives, as these are the most likely to be changed in an edit. Then we'll have the Amiga hardware to be emulated. Next will be a section which governs the speed or accuracy of the emulator. After that is a section which relates to the hardware of the source system, and finally is a section which sets the default paths to the folders we have made.

The first time we do this, I'll comment on everything, and then on subsequent builds only the changes.

cat > ~/amiga/A500.uaerc << "EOF"
#Disks Files 
floppy0=$(FILE_PATH)/1.3a.adf 
floppy1=$(FILE_PATH)/1.3b.adf

EOF

This loads two disk images. Workbench 1.3 comes on 2 disks, and I have renamed them to a and b. The emulator can handle 4 floppy disk drives, but by default only two work. You can peruse the documentation to see how to activate the other two, if you really want. We can use the [$(FILE_PATH)] instead of the absolute path to the files. We'll define the variable at the end of the file.

cat >> ~/amiga/A500.uaerc << "EOF"
#Amiga Hardware 
cpu_type=68000 
chipset=ecs_agnus 
kickstart_rom_file=$(FILE_PATH)/1.3.rom 
chipmem_size=2 
bogomem_size=0 
fastmem_size=0 
z3mem_size=0 
gfxcard_size=0 

EOF

Note that we are [>>] appending to the file now, not [>] over writing. We are emulating a [68000] cpu for the A500. We are going to use the ecs_agnus chipset present in later A500's as it allows us to use more RAM. We need Kickstart 1.3 for the A500. We also are telling it to use 1Mb of chip ram. It is measured in 512Kb chunks - hence the [2]. We are not using any other types of RAM.

cat >> ~/amiga/A500.uaerc << "EOF"
#Performance 
cpu_speed=real 
cpu_compatible=false 
cpu_cycle_exact=false 
cachesize=0
immediate_blits=false 
collision_level=playfields 
gfx_framerate=1 
sound_latency=100 
x11.low_bandwidth=false 
floppy_speed=100 

EOF

We are asking the machine to simulate the cpu at the normal speed. In other words no matter how powerful your machine the emulation should run at the speed of a real A500. If some software doesn't work you can flip [cpu_compatible] to true, and it will try to be even more exact, but potentially slower as well. If that still doesn't work, then you can flip the [cpu_cycle_exact] to true, which makes the cpu to chipset communications more precise.

The [cachesize] set to 0 diables the JIT system. This only works on 68020 cpu's so we do not need it. [immediate_blits] set to false makes sure the system doesn't cut some corners. Setting this to true may speed up the emulation. [collision_level=playfields] is about how precisely the emulation calculates collisions between objects (the player and a platform in a game for instance). The documentation explains how to change this if necessary.

The [gfx_framerate] tells it to show every frame. If this was 10, it would only show one frame in 10. The [sound_latency] sets the wiggle room the system has to synchronise the sound. [x11.low_bandwidth] if set to true reduces the information exchanged with the X server. It only updates the bits of the video which change from frame to frame. This ends up looking crap - as if you are using the system through VNC down a 56k modem line. [floppy_speed] is in %. You can increase it to as much as 800, but that may cause compatibility problems.

cat >> ~/amiga/A500.uaerc << "EOF"
#Host Hardware 
gfx_width_windowed=720 
gfx_height_windowed=568 
gfx_fullscreen_amiga=true 
hide_cursor=true 
show_leds=true 
sound_output=normal 
sound_bits=16 
sound_frequency=44100 
sound_channels=stereo 
joyport0=mouse 
joyport1=kbd2 
bsdsocket_emu=true 
x11.map_raw_keys=false 

EOF

The [gfx_{width,height}_windowed] options set the size of the window. There are options for fullscreen resolution as well, but the documentation is honest enough to admit that does nothing. We want to boot straight to the Amiga, so we tell it to [fullscreen]. We do not want to see the X cursor - just the Amiga cursor, so we [hide_cursor]. The [show_leds] put a graphical representation of the floppy and HDD activity lights. It also reports the frame rate and cpu usage. The [sound] options are all pretty self explanatory. The Amiga had two ports for mice or joysticks. Here we tell it the mouse is connected to [joyport0]. We tell it [joyport1] has a joystick attached to it which is simulated by the arrow keys and the right CTRL as the fire button [kbd2]. There are other options which are set out in the docs. The [bsdsocket_emu] turns on the network sharing that we enabled back in the compilation of the emulator. The [x11.map_raw_keys] relates to how the keys on your PC are mapped to the keys in the simulated Amiga keyboard.

cat >> ~/amiga/A500.uaerc << "EOF"
#Defaults 
unix.rom_path=~/amiga/roms 
unix.floppy_path=~/amiga/disks 
unix.hardfile_path=~/amiga/harddisks 
unix.savestate_path=~/amiga/saves 
EOF

These settings just tell the emulator the default location for the various file types. That also finishes the configuration file. The A500 can now be emulated by:

uae -G -f ~/amiga/A500.uaerc

This disables the [G]ui so that the emulator will start fullscreen.

Now for the HD version:

cat > ~/amiga/A500HD.uaerc << "EOF"
#Disks Files 
#floppy0=$(FILE_PATH)/1.3a.adf 
#floppy1=$(FILE_PATH)/1.3b.adf
hardfile2=rw,dh0:/root/amiga/harddisks/A500_hdd.hdf,32,1,2,512,1, 

#Amiga Hardware 
cpu_type=68000 
chipset=ecs_agnus 
kickstart_rom_file=$(FILE_PATH)/1.3.rom 
chipmem_size=4
bogomem_size=0 
fastmem_size=8
z3mem_size=0 
gfxcard_size=0 

#Performance 
cpu_speed=real 
cpu_compatible=false 
cpu_cycle_exact=false 
cachesize=0 
immediate_blits=false 
collision_level=playfields 
gfx_framerate=1 
sound_latency=100 
x11.low_bandwidth=false 
floppy_speed=100 

#Host Hardware 
gfx_width_windowed=720 
gfx_height_windowed=568 
gfx_fullscreen_amiga=true 
hide_cursor=true 
show_leds=true 
sound_output=normal 
sound_bits=16 
sound_frequency=44100 
sound_channels=stereo 
joyport0=mouse 
joyport1=kbd2
bsdsocket_emu=true 
x11.map_raw_keys=false 

#Defaults 
unix.rom_path=~/amiga/roms 
unix.floppy_path=~/amiga/disks 
unix.hardfile_path=~/amiga/harddisks 
unix.savestate_path=~/amiga/saves
EOF

We have commented out the floppy so that it boots from the hard disk. It makes it easy to activate the disks to install workbench in the first place. The [hardfile2] activates the file we made as [dh0:]. No real idea what all the settings guff at the end does, but it seems to work. I have also installed 8Mb of fast ram, and upped the chip ram to 2Mb.

cat > ~/amiga/A1200.uaerc << "EOF"
#Disks Files 
#floppy0=$(FILE_PATH)/3.1b.adf 
#floppy1=$(FILE_PATH)/3.1a.adf 

#Amiga Hardware 
cpu_type=68ec020 
chipset=aga 
kickstart_rom_file=$(FILE_PATH)/3.1.rom 
chipmem_size=4 
bogomem_size=0 
fastmem_size=0 
z3mem_size=0 
gfxcard_size=0 

#Performance 
cpu_speed=max 
cpu_compatible=false 
cpu_cycle_exact=false 
cachesize=8192 
immediate_blits=false 
collision_level=playfields 
gfx_framerate=1 
sound_latency=100 
x11.low_bandwidth=false 
floppy_speed=100 

#Host Hardware 
gfx_width_windowed=720 
gfx_height_windowed=568 
gfx_fullscreen_amiga=true 
hide_cursor=true 
show_leds=true 
sound_output=normal 
sound_bits=16 
sound_frequency=44100 
sound_channels=stereo 
joyport0=mouse 
joyport1=kbd2 
bsdsocket_emu=true 
x11.map_raw_keys=true 

#Defaults 
unix.rom_path=~/amiga/roms 
unix.floppy_path=~/amiga/disks 
unix.hardfile_path=~/amiga/harddisks 
unix.savestate_path=~/amiga/saves 
EOF

The Workbench floppies are there as suggestions. The [a] disk is the install for 3.1, and the [b] disk is the normal 'workbench' disk. The CPU type and chipset match the hardware in the A1200. We also use 2Mb [4]x512k of chipram. We switch to Kickstart 3.1. We change CPU speed to [max] because we do not want to be restricted to running at the speed of a A500. We have also changed the [cachesize] to 8192 (meaning 8Mb) which activates the JIT compiler. The rest is the same.

And lastly, the HD version, which is going to be the most powerful.

cat > ~/amiga/A1200HD.uaerc << "EOF"
#Disk Files 
#floppy0=$(FILE_PATH)/3.1b.adf 
#floppy1=$(FILE_PATH)/3.1a.adf
floppy2type=0
floppy3type=0
hardfile2=rw,dh0:/root/amiga/harddisks/A1200_hdd.hdf,32,1,2,512,1, 
filesystem2=rw,dh1:Shared:/root/amiga/shared,0

#Amiga Hardware 
cpu_type=68020 
chipset=aga 
kickstart_rom_file=$(FILE_PATH)/3.1.rom 
chipmem_size=4 
bogomem_size=0 
fastmem_size=0 
z3mem_size=256
gfxcard_size=32

#Performance 
cpu_speed=max 
cpu_compatible=false 
cpu_cycle_exact=false 
cachesize=8192 
immediate_blits=false 
collision_level=playfields 
gfx_framerate=1 
sound_latency=100 
x11.low_bandwidth=false 
floppy_speed=100 

#Host Hardware 
gfx_width_windowed=720 
gfx_height_windowed=568 
gfx_fullscreen_amiga=true 
hide_cursor=true 
show_leds=true 
sound_output=normal 
sound_bits=16 
sound_frequency=44100 
sound_channels=stereo 
joyport0=mouse 
joyport1=kbd2
bsdsocket_emu=true 
x11.map_raw_keys=false

#Defaults 
unix.rom_path=~/amiga/roms 
unix.floppy_path=~/amiga/disks 
unix.hardfile_path=~/amiga/harddisks 
unix.savestate_path=~/amiga/saves 
EOF

The first change is the [floppy{2,3}type] option. By default df2: and df3: are deactivated. By setting their types to '0' we activate them. I know that sounds unintuitive, but a setting of -1 means deactivated. We want as many active floppies as possible for doing stuff like installing Workbench. I have commented out the Workbench disks, as they should not be needed on a regular basis. Best to refer to them though, so we can quickly activate them if the HDD corrupts.

We have had to switch to the 68020 CPU rather than the cut down 68ec020 that is actually in the A1200. The reason is that we need 32 bit memory addressing rather than 24 bit memory addressing
to support the extra memory [z3mem] and [gfxcard] we are going to use. The Z3 memory emulates memory being added in a Zorro III slot. The gfxcard memory is going to be used by the Picasso96 emulated graphics card to get a high resolution desktop. There were expansion cards for the A1200 which supplied a full 68020 and 256Mb of Zorro III ram, so this is historically accurate.

To boot straight into the Amiga, add this to .xinitrc before the openbox-session line:

exec /usr/bin/uae -G -f ~/amiga/[whatever].uaerc &

Thursday, 26 August 2010

LAP - E-UAE (Install)

Now, download the disk format library into the /sources/amiga folder by using the LiveCD:

umount -v /media/amiga 
sudo mkdir /media/lfs 
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs 
cd /media/lfs/sources/amiga
wget -O ipfdevlib_linux.tgz -- http://www.softpres.org/_media/files:ipfdevlib_linux.tgz?id=download&cache=cache

Hit enter to exit the program once 100% download has been reached. We have to use the [O] option which saves the download to the file we name after the [O] because otherwise we get a stupidly named file. The downside is we apparently need to exit the download manually by hitting enter.

In order to test the IPF support, you will obviously need a disk image in IPF format.  One of the best places to legally download these is the Dream 17 website.  Dream 17 have permission from the Amiga developer Team 17 to distribute their games.  You should download these in IPF format - if you can.  I chose to test this with Alien Breed.  Once I had downloaded the images, I uncompressed the archive and copied them into the root folder on the Amiga key with sensible names.

cd /sources/amiga
tar -xzvf ipfdevlib_linux.tgz 

tar -xjvf e-uae-0.8.29-WIP4.tar.bz2 
cd e-uae-0.8.29-WIP4 
./configure --prefix=/usr --enable-jit --enable-natmem \
--enable-autoconfig --enable-threads --with-sdl-gfx \
--enable-aga --disable-scsi-device --enable-bsdsock --with-caps \
--with-caps-prefix=/sources/amiga/ipfdevlib_linux --with-alsa \
--with-x | tee config_report.txt

That is a hell of a lot more options that we have used before. Lets look at the extra ones. [jit] allows the emulator to execute 68020 code natively on your CPU. This speeds up the a1200 operation but does nothing for an a500. [natmem] works alongside [jit] and gives the emulation direct access to your system RAM. [autoconfig] turns out not to be what I thought it was. Instead of autoconfiguring the emulator, this instead autoconfigures the emulated machine to use virtual hardware that you add. Probably didn't need this before.

[threads] lets the emulator make use of any extra cores your CPU may have. [aga] allows emulation of the chipset of the a1200. [scsi-device] gets disabled because I do not intend to emulate any scsi devices AND because it has dependencies that we have not met when building the system. [bsdsock] lets the emulated amiga use the linux network connection. Essential to get internet. [caps] tells it to build in support for the IPF disk format, and [caps-prefix] tells it where to find the files we just downloaded an uncompressed. [alsa] and [x] should be self explanatory.

Lets just check it found the caps/IPF stuff:

cat config_report.txt | grep caps
checking caps/capsimage.h usability... yes
checking caps/capsimage.h presence... yes
checking for caps/capsimage.h... yes 
Well, thats good.

make $CORES_TO_USE
Test it:
./src/uae -r ~/1.3.rom -0 ~/1.3.adf

And test it with the IPF image you chose at the beginning (I went for Alien Breed):
./src/uae -r ~/1.3.rom -0 ~/ab1.ipf

That did not work. I got a warning dialogue and the following message:
Unable to open libcapsimage.so.2
.Failed to load CAPS plug-in.

Right, we must have to install from the IPF source as well as compiling it into e-uae. There is a readme file for the IPF source and it has the instructions for installing the library. No configure/make stuff required. We just copy the library straight to /usr/lib.

cp -v ../ipfdevlib_linux/lib/i686/libcapsimage.so.2.0 /usr/lib/
ldconfig

I then ran the test again and it now works just fine.  Now, finally, install e-uae and copy the documentation:

make install
install -v -d -m755 /usr/share/doc/e-uae
install -v -m644 docs/* /usr/share/doc/e-uae

Now clean up:

cd ..
rm -rvf e-uae-0.8.29-WIP4 
rm -rvf ipfdevlib_linux 

Thursday, 19 August 2010

LAP - E-UAE (Graphics Test)

Now that we have a GUI, we can try E-UAE again, this time without the highly amusing curses text mode. Actually, what we achieved in the last step was pretty significant. We now have a graphical user interface for our operating system. If we run the command:

xterm & 

In the xterm window, we can open another xterm window. We can also do this by left clicking anywhere on the desktop background and selecting xterm from the menu that pops up. This means that we can copy and paste commands to the command line again, which in turn means no more stupid scripts. Ideally, what you can do now is fire up the Lynx browser in a separate xterm window, and copy and paste directly from the blog posts:
lynx http://justbloodywork.blogspot.com
If you haven't bothered, or been able, to configure networking what you probably want to do is copy and paste this blog post (and the other ones coming up) and save them as text files in the /root folder on the Amiga Key. You then use two xterm windows, one with 'nano' viewing the text file, and the other to paste the commands.

Copying and pasting using xterm is a bit tricky. You highlight the text in the 'nano' window. There is no 'copy' key - as soon as the text is highlighted, it is good to go. You then move the mouse pointer over to the other xterm window and press the middle mouse button (simulated on a track pad by pressing the left and right mouse buttons at the same time) to paste. Note, it pastes at the position of the text entry cursor - NOT the mouse pointer.

So, from the Amiga Key, switch into the amiga source code directory and unpack the code again. Technically, back when we cleaned up after the text test E-UAE we could have just [make clean]ed the source directory. To avoid any possibility of contamination though, I prefer to delete the folder and unpack from scratch.

cd /sources/amiga
tar -xjvf e-uae-0.8.29-WIP4.tar.bz2
cd e-uae-0.8.29-WIP4
./configure --enable-autoconfig | tee config_report.txt 

Note, we have removed the curses option. Next, compile:

make $CORES_TO_USE 

Again, lets not install the software immediately. We are still in the testing phase. Lets try the rom first:

./src/uae -r ~/1.3.rom 

Woo, hoo. It popped up and asked me where to put the window first of all (just like I was running a new xterm), it then fired up the graphical window displaying the Amiga screen looking for a floppy. Lets give it one. According to the documentation for E-UAE you hit [F12 + F1] to insert a disk in drive df0: Did that. Nothing happened. No menu popped up asking for a disk. Also, you are supposed to be able to make it go fullscreen by hitting [F12 + S], which does nothing. Hmm. I quit by clicking in the xterm that I ran the program from, and used [CTRL + C] followed by [quit]. I then ran:
./src/uae -r ~/1.3.rom -0 ~/1.3.adf 

And it actually booted Workbench! Still can't switch disks or go fullscreen though. Lets have a look at the compile log:
nano /sources/amiga/e-uae-0.8.29-WIP4/config_report.txt

I spotted the following text:

checking for sdl-config... no 
checking for SDL - version >= 1.2.0... no 
*** The sdl-config script installed by SDL could not be found 
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in 
*** your path, or set the SDL_CONFIG environment variable to the 
*** full path to sdl-config. 
and

checking for GTK+ - version >= 2.0.0... no 
*** Could not run GTK+ test program, checking why... 
*** The test program failed to compile or link. See the file config.log 
for the 
*** exact error that occured. This usually means GTK+ is incorrectly 
installed. 
checking for gtk-config... no 
checking for GTK - version >= 1.0.0... no 
*** The gtk-config script installed by GTK could not be found 
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in 
*** your path, or set the GTK_CONFIG environment variable to the 
*** full path to gtk-config. 

This suggests that we do not have some things called GTK and SDL. GTK is a toolkit which allows buttons, menus, etc etc to be created. Like menus that let us switch disks while the emulator is running. SDL lets us run in fullscreen, which we also want. So we obviously want those two packages.

Part of my goal is also to boot straight to the Amiga, which requires me to boot straight to the graphical interface. This will require an auto login function. This last requirement simplest, relatively speaking, to fix. So lets do that first. Clean up first:
cd /sources/amiga/
rm -rvf e-uae-0.8.29-WIP4

Friday, 6 August 2010

LAP - E-UAE (Text Test)

Let's now try e-uae.  Why the hell would we do that without any kind of graphical user interface having been installed I hear you ask?  Well, the e-uae program has a really interesting, and completely fucking useless, feature.  It can be run without a graphical interface.  It uses the ncurses software to display the amiga video output using the text only terminal.  Oh, yes, you are going to want to see this.  Is it any use?  Fuck no, but it is amusing nonetheless.
umount -v /media/amiga
sudo mkdir /media/lfs
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs
cd /media/lfs/sources

Make a directory for the amiga software ...
mkdir amiga
chmod -v a+wt amiga
... and move into it and download the amiga emulator.  I should point out at this stage that there is actually a more up to date version of the emulator available. It is in beta though, and I have not tested it yet. I will set out how to download and configure it in an appendix post at the end of the build.

cd amiga
wget http://www.rcdrummond.net/uae/e-uae-0.8.29-WIP4/e-uae-0.8.29-WIP4.tar.bz2

Then reboot into the Amiga Key.  Run the following commands to unpack the Amiga emulator:

cd /sources/amiga
tar -xjvf e-uae-0.8.29-WIP4.tar.bz2
cd e-uae-0.8.29-WIP4

Again, you can autocomplete with [tab] to speed this up.  Now configure the install:
./configure --enable-autoconfig --with-curses | tee config_report.txt 

The [autoconfig] option may not strictly be necessary for this simple test, but I want to keep things as auto as possible, so lets stick it in.  The [curses] tells the configuration that we want to use the text graphics display.  The command then [|] pipes the output to [tee] which sticks it in the [config_report.txt] file.  That way we can peruse that file at our leisure to check for any error messages in the configure report.

Then build with:

make $CORES_TO_USE

I wouldn't actually install the software yet, because we are going to go through a few more configurations before we get one I will be happy with.  The executable file can be found in the [src] directory and it is called [uae].  Test it with:

./src/uae

It will fail.  If you read the failure properly it will tell you that it cannot find a .rom file.  This is the only thing which is stopping it working, but you wouldn't know that from the less than helpful text report.  So I jumped back into the LiveCD Key and copied a 1.3 kickstart rom file, and a 1.3 workbench disk to /root on the Amiga Key.  I renamed them to something very very simple.  I then rebooted to the Amiga Key, moved back to the e-uae sources folder and ran the command again as follows:

cd /sources/amiga/e-uae-0.8.29-WIP4/src
./uae -r ~/1.3.rom

That runs the emulator in default mode with the [r]om file [~/1.3.rom].  And, bugger me.  That looks surprisingly like an Amiga boot screen rendered in text symbols!

Lets try a workbench disk.  First we need to close the emulator.  The only way I would work out how to do that was to find the id number of the [uae] application in a new terminal:

ps aux | grep uae

and then [kill] that application number

kill 1234

Where 1234 is whatever the last command told us was the number.

For some reason that terminal window was rendered useless, so I switched to number 3.  However, thanks to the Ubuntu UK Podcast, I now know I can run the command [reset] when the terminal window is fubarred, and right enough it came back to life! I moved back to the [src] directory and ran [uae] again:

./uae -r ~/1.3.rom -0 ~/1.3.adf

This runs the previous command, with the disk image [~/1.3.adf] loaded in drive df[0]:
A, hahahahahaha, that's Workbench in text!  Completely indecipherable but entertaining nonetheless.  Mouse is non-functional.

Ok, clearly this is entertaining, and the emulator, roms and disks are working, but what we need is a proper graphical interface.  It is time for the X windows system to be installed.  Just tidy up the mess here first:

cd /sources/amiga/
rm -rvf e-uae-0.8.29-WIP4