Another shortfall is the amount of available memory. Presently there is only room for a few sectors to be buffered. By emulating a spinning disk, a given track's data is output again and again. This causes the hard drive to read the same sectors over and over again. Being able to buffer an entire track would save wear and tear on the hard drive. Extra memory will also allow me to write a better implementation of FAT.
Monday, June 14, 2010
CHED - Update
The serial output of the Apple's floppy disk drive produces a continuous bitstream where one bit is output every four microseconds. Generating this bitstream has been more difficult than I had expected. The difficulty comes from doing the hard drive reading, data conversion and output of the bitstream all at the same time using the existing resources. The output of the bitstream requires a fair chunk of the CPU time just by itself. I was unable to utilise the Atmega's USART as the start/stop bits can't be disabled so bit banging was the only other option available. Adding some extra processing power will be required.
Another shortfall is the amount of available memory. Presently there is only room for a few sectors to be buffered. By emulating a spinning disk, a given track's data is output again and again. This causes the hard drive to read the same sectors over and over again. Being able to buffer an entire track would save wear and tear on the hard drive. Extra memory will also allow me to write a better implementation of FAT.
Another shortfall is the amount of available memory. Presently there is only room for a few sectors to be buffered. By emulating a spinning disk, a given track's data is output again and again. This causes the hard drive to read the same sectors over and over again. Being able to buffer an entire track would save wear and tear on the hard drive. Extra memory will also allow me to write a better implementation of FAT.
Monday, April 27, 2009
Game Controller - Atari Joysticks
The Apple II computer was designed to use an analogue joystick (via the 16 pin game port then later a 9 pin port). This joystick uses two potentiometers to represent the position of the stick, one for the x-axis (8 bit analogue signal) and one of the y-axis (8 bit analogue signal). The joystick also contains two pushbuttons (digital signals). Many computers and game consoles from the 8 bit home computer era were designed to use digital joysticks instead ie these contain five digital signals, one signal for each of the four directions (Left, Right, Up and Down) plus one for the trigger button. The analogue joystick has a greater range of movement but at the expense of a fast response time. The digital and analogue joysticks are not compatible however it is possible to convert one to the other in a limited capacity. There are two main methods in converting an Atari style joystick on the Apple II computer and each method is only compatible with certain software applications.
The first method of converting an Atari style joystick involves making the four digital positions (Atari joystick - Left, Right, Up and Down) represent the extremities of the analogue ranges (Apple joystick - y-axis low / high and x-axis low / high). For this joystick to work the software must have been written to only look at the low/high analogue values and only use the first pushbutton. The WICO Command Control Joystick Adapter is a good example of a converter that uses this method. If you wish to build one yourself then see Chaptor 9 of the "Computer Controller Cookbook" by Tom & Kelda Riley (http://www.atariarchives.org/ccc/chapter9.php).
The second method of converting the Atari style joysticks involves reading the digital signals (Atari joystick) by using the digital pushbutton input lines on the Apple II's game port. The problem is that the digital joystick contains five digital signals (ten when you talk about two joysticks) but the Apple II's game port only contains three digital inputs. The answer is multiplexing. Since the Apple II's game port (16 pin version) has Annunciator lines (digital outputs) these can be used to multiplex the input signals. The software needs to be specifically written to perform this multiplexing and in fact a lot of software was. It is known as the "Atari Joyport" option.
The second method was able to deliver my aim which was to reproduce that arcade style game controller feeling. It makes quite a difference to how some games are played.
The converter allows two Atari style joysticks to be connected. I also decided to run the signals through the switch box so as to allow switching with my other paddles and joysticks.
The converter requires Annunciator signals from the game port and these are only available via the 16 pin connector. Therefore I did away with the 9 pin cable that connected the Apple II with the switch box and replaced it with two cables.
After building the converter I tested it on some games but it would not work. I manually tested it and found it functioned exactly how I wanted it too. Through trial and error I worked out that my logic was incorrect. All the software was written to accept the opposite of how the analogue joysticks functioned ie the joystick trigger was registered when the pushbutton zero line (PB0) went from active to low and not the other way around. It ended up being an easy fix. All I did was change the inverting multiplexer chip with it's a non-inverting version.
The operation of the "Atari Joyport", when the joystick is in it's steady state (no movement and no trigger), sets the Apple's three input lines (PB0, PB1 and PB2) high. These signals get driven low when a movement occurs or when the trigger is pressed. This operation worked well on the older Apple II models but there was a problem once the Apple IIe came out. This model had a few differences over the previous models. In particular it had a self test (Control + Open-Apple + Closed-Apple + Reset) and two extra keys, the Open-Apple and the Closed-Apple which were electrically tied to PB0 and PB1. This caused a problem for the "Atari Joyport" operation because when a reboot was actioned (PB1 was set high by default) a machine self test accompanied by a high pitched screech resulted. I work around this problem by using the switch box before rebooting or holding the joystick to the left while pressing the Control and Reset keys.
Thank-you Michael for pointing out that my Atari joystick converter needed signal diodes between the multiplexer and the PB inputs. The signal diodes are needed so that the Open-Apple, Close-Apple and Shift (if the Shift key mod is installed) keys do not result in a short circuit condition with the converter's multiplexer. Take note that the diode for PB2 needs to be in the opposite direction to the other two. This is because PB0 and PB1 switch to +5V while PB2 switches to ground. After adding the diodes I had problems getting the converter to work well. It wasn't until I added a pull-up resistor and two pull-downs that the converter functioned correctly again.
A switch was add to the converter's power supply line. I found this easier to use than performing the switching via the switch box.
The schematic was also changed in an attempt to make it less confusing ie the gameport connection was changed to show the Apple's 16 pin port instead of my custom 9 pin hack.
Some examples of software that use the "Atari Joyport" operation are :- Boulder Dash, Spy's Demise.

The circuit board (top and underside views).

The two custom cables and an overview of the setup.

Atari Joystick to Apple II's "Atari Joyport" Converter - Schematic.

The first method of converting an Atari style joystick involves making the four digital positions (Atari joystick - Left, Right, Up and Down) represent the extremities of the analogue ranges (Apple joystick - y-axis low / high and x-axis low / high). For this joystick to work the software must have been written to only look at the low/high analogue values and only use the first pushbutton. The WICO Command Control Joystick Adapter is a good example of a converter that uses this method. If you wish to build one yourself then see Chaptor 9 of the "Computer Controller Cookbook" by Tom & Kelda Riley (http://www.atariarchives.org/ccc/chapter9.php).
The second method of converting the Atari style joysticks involves reading the digital signals (Atari joystick) by using the digital pushbutton input lines on the Apple II's game port. The problem is that the digital joystick contains five digital signals (ten when you talk about two joysticks) but the Apple II's game port only contains three digital inputs. The answer is multiplexing. Since the Apple II's game port (16 pin version) has Annunciator lines (digital outputs) these can be used to multiplex the input signals. The software needs to be specifically written to perform this multiplexing and in fact a lot of software was. It is known as the "Atari Joyport" option.
The second method was able to deliver my aim which was to reproduce that arcade style game controller feeling. It makes quite a difference to how some games are played.
The converter allows two Atari style joysticks to be connected. I also decided to run the signals through the switch box so as to allow switching with my other paddles and joysticks.
The converter requires Annunciator signals from the game port and these are only available via the 16 pin connector. Therefore I did away with the 9 pin cable that connected the Apple II with the switch box and replaced it with two cables.
After building the converter I tested it on some games but it would not work. I manually tested it and found it functioned exactly how I wanted it too. Through trial and error I worked out that my logic was incorrect. All the software was written to accept the opposite of how the analogue joysticks functioned ie the joystick trigger was registered when the pushbutton zero line (PB0) went from active to low and not the other way around. It ended up being an easy fix. All I did was change the inverting multiplexer chip with it's a non-inverting version.
The operation of the "Atari Joyport", when the joystick is in it's steady state (no movement and no trigger), sets the Apple's three input lines (PB0, PB1 and PB2) high. These signals get driven low when a movement occurs or when the trigger is pressed. This operation worked well on the older Apple II models but there was a problem once the Apple IIe came out. This model had a few differences over the previous models. In particular it had a self test (Control + Open-Apple + Closed-Apple + Reset) and two extra keys, the Open-Apple and the Closed-Apple which were electrically tied to PB0 and PB1. This caused a problem for the "Atari Joyport" operation because when a reboot was actioned (PB1 was set high by default) a machine self test accompanied by a high pitched screech resulted. I work around this problem by using the switch box before rebooting or holding the joystick to the left while pressing the Control and Reset keys.
Thank-you Michael for pointing out that my Atari joystick converter needed signal diodes between the multiplexer and the PB inputs. The signal diodes are needed so that the Open-Apple, Close-Apple and Shift (if the Shift key mod is installed) keys do not result in a short circuit condition with the converter's multiplexer. Take note that the diode for PB2 needs to be in the opposite direction to the other two. This is because PB0 and PB1 switch to +5V while PB2 switches to ground. After adding the diodes I had problems getting the converter to work well. It wasn't until I added a pull-up resistor and two pull-downs that the converter functioned correctly again.
A switch was add to the converter's power supply line. I found this easier to use than performing the switching via the switch box.
The schematic was also changed in an attempt to make it less confusing ie the gameport connection was changed to show the Apple's 16 pin port instead of my custom 9 pin hack.
Some examples of software that use the "Atari Joyport" operation are :- Boulder Dash, Spy's Demise.
The circuit board (top and underside views).
The two custom cables and an overview of the setup.
Atari Joystick to Apple II's "Atari Joyport" Converter - Schematic.
UFIC - Update
Sunday, February 22, 2009
UFIC - Images
The circuit board (top and underside views).
The circuit board attached to the CF Board, USB to ATA/ATAPI bridge and the Microdrive IDE controller.
The USB socket on the rear of the case and the USB bracket.

Power switch circuitry. Since MOSFETS provide switching of current in only one direction, U1 and U2 do the device switching while U3 and U4 are there for reverse current protection.
UFIC - Update
The board has been constructed and after doing some testing I found out that I am not quite there yet. I had incorrectly assumed that all ATA/ATAPI controllers were going to contain high impedance lines when powered off. The UFIC board works ok with only the USB to ATA bridge connected or only the Microdrive connected but not both. On the one side I tested two different USB to ATA bridge boards and found that one was ok to use (the one with the MOAI M110E chip) while the other (containing an ALCOR AU6391 chip) was not. On the other side I measured the Microdrive and found it too did not have high impedance lines when powered off. Therefore when not in use it will need to be isolated. A buffer/transceiver or multiplexer/bus switch modification will be required.
The power switch circuitry is used to switch between the two power sources. I considered using a relay but it would have taken up too much space. Using diodes would have caused a bigger voltage drop than I wanted. There were several fantastic all in one integrated circuit packages that would have worked brilliantly but due to their small size they were not friendly to hand soldering. In the end I decided to give MOSFETs a try. It was an interesting exercise as I went through a few revisions but in the end I am pretty happy with it.
To get a compact solution the parts needed some adjusting. The Veroboard and the 40 pin IDE socket needed filing down, the USB plug on the USB to ATA bridge was changed to a more compact version and for a nice USB connection I had to get a custom USB bracket made up. I would like to thank the guys from Queensland Sheet Metal & Roofing Suppliers for sorting that out for me.
The power switch circuitry is used to switch between the two power sources. I considered using a relay but it would have taken up too much space. Using diodes would have caused a bigger voltage drop than I wanted. There were several fantastic all in one integrated circuit packages that would have worked brilliantly but due to their small size they were not friendly to hand soldering. In the end I decided to give MOSFETs a try. It was an interesting exercise as I went through a few revisions but in the end I am pretty happy with it.
To get a compact solution the parts needed some adjusting. The Veroboard and the 40 pin IDE socket needed filing down, the USB plug on the USB to ATA bridge was changed to a more compact version and for a nice USB connection I had to get a custom USB bracket made up. I would like to thank the guys from Queensland Sheet Metal & Roofing Suppliers for sorting that out for me.
Monday, July 21, 2008
UFIC - Introduction
Project UFIC (USB For IDE Controllers)
The idea of this project is not to take the Compact Flash (CF) outside of the Apple II case but instead place a USB CF Reader inside it. UFIC is an alternate solution to the problem of accessing a CF card (or IDE/ATA hard drive) which is positioned internally in an Apple II computer.
UFIC is an adapter which plugs in between the Microdrive IDE controller and the IDE/ATA to CF Board. It consists of two IDE/ATA plugs, a type B USB plug, a USB to ATA/ATAPI bridge and a switch.
The operation of the adapter is very simple. When the Apple II computer is turned off, the adapter allows a USB connected PC to access the CF card (or hard drive). When powered on, the system bypasses the USB to ATA/ATAPI bridge and functions like it did without the adapter.
Note: You still need a utitlity on the PC side such as CiderPress (http://www.faddensoft.com/) to access the data on the CF card (or hard drive).
Note: A 2.5 inch hard drive will require more power than can be supplied using one USB port (multi USB port cable is needed). A 3.5 inch hard drive will require an external power supply.
Note: This adapter is specifically build for the Microdrive IDE controller. The same principle could be used for other IDE controllers like the CFFA and the Focus Drive. The only difference being different connectors ie CFFA would need 5 volts from the controller card instead of pin 20 and the Focus Drive would need 44pin plugs. A USB CF Reader could be used instead of the USB to ATA/ATAPI bridge to give the same result.
Suppliers of IDE Drives :-
Microdrive IDE controller - http://www.reactivemicro.com/
CFFA - http://dreher.net/?s=projects/CFforAppleII&c=projects/CFforAppleII/main.php
Focus IDE HD Controller - http://16sector.com/
The idea of this project is not to take the Compact Flash (CF) outside of the Apple II case but instead place a USB CF Reader inside it. UFIC is an alternate solution to the problem of accessing a CF card (or IDE/ATA hard drive) which is positioned internally in an Apple II computer.
UFIC is an adapter which plugs in between the Microdrive IDE controller and the IDE/ATA to CF Board. It consists of two IDE/ATA plugs, a type B USB plug, a USB to ATA/ATAPI bridge and a switch.
The operation of the adapter is very simple. When the Apple II computer is turned off, the adapter allows a USB connected PC to access the CF card (or hard drive). When powered on, the system bypasses the USB to ATA/ATAPI bridge and functions like it did without the adapter.
Note: You still need a utitlity on the PC side such as CiderPress (http://www.faddensoft.com/) to access the data on the CF card (or hard drive).
Note: A 2.5 inch hard drive will require more power than can be supplied using one USB port (multi USB port cable is needed). A 3.5 inch hard drive will require an external power supply.
Note: This adapter is specifically build for the Microdrive IDE controller. The same principle could be used for other IDE controllers like the CFFA and the Focus Drive. The only difference being different connectors ie CFFA would need 5 volts from the controller card instead of pin 20 and the Focus Drive would need 44pin plugs. A USB CF Reader could be used instead of the USB to ATA/ATAPI bridge to give the same result.
Suppliers of IDE Drives :-
Microdrive IDE controller - http://www.reactivemicro.com/
CFFA - http://dreher.net/?s=projects/CFforAppleII&c=projects/CFforAppleII/main.php
Focus IDE HD Controller - http://16sector.com/
Saturday, July 19, 2008
Game Controller - Serial Switch Box
Sure, in most cases one game controller (joystick) will pretty well get you by for most games but in my opinion some games are just better played using the hand controllers/paddles (yes, I know, it is hard to believe) while others are just meant to be played using a free floating joystick. The problem with having these options means manually having to swap over the controllers or reconfiguring the joystick modes (free floating verses self centering). After a while this starts to become a pain, especially if you are switching between them regularly.
To find a solution, apart from tracking down the game controllers themselves, all I needed was a 4 way serial switch box and a 9 pin male to 9 pin male cable which I made up. The trackball was easily configured. It just got plugged in on the ADB bus between the keyboard and the mouse.
I am very happy with my solution as I have finally got my game controllers setup the way that I wanted. That is, available at a flick of the switch.
Parts List
Apple Joystick Model A2M2012 (Self centering)
Apple Joystick Model A2M2002 (Free floating)
Apple Hand Controllers Model A2M2001
4Way 9 pin Serial Switch Box
9 pin male to 9 pin male straight through cable
Kensington Turbo Mouse (Trackball) Version 5.0 Model 64210
To find a solution, apart from tracking down the game controllers themselves, all I needed was a 4 way serial switch box and a 9 pin male to 9 pin male cable which I made up. The trackball was easily configured. It just got plugged in on the ADB bus between the keyboard and the mouse.
I am very happy with my solution as I have finally got my game controllers setup the way that I wanted. That is, available at a flick of the switch.
Parts List
Apple Joystick Model A2M2012 (Self centering)
Apple Joystick Model A2M2002 (Free floating)
Apple Hand Controllers Model A2M2001
4Way 9 pin Serial Switch Box
9 pin male to 9 pin male straight through cable
Kensington Turbo Mouse (Trackball) Version 5.0 Model 64210
Subscribe to:
Posts (Atom)