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 &

No comments:

Post a Comment