MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues.
2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)
Hi-Res Joystick Software: Difference between revisions
Luis46coco (talk | contribs) (Created page with "This project was jointly created by John Kowalski, Robert Gault and Nickolas Marentes How the ADC works The real work when converting any analogue voltage to a digital read...") |
Luis46coco (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
*'''Aaron wolfe/robert gault''' | |||
I present here a simple Basic program to demonstrate how the adapter can be used in either the Tandy or CocoMax modes. Most of the work is done by an assembly language routine, one for each mode. This is not the only way to write useful code, it is just an example to get you started on your own projects. Keep in mind that the timed circuit values change when the Coco CPU clock changes. It may be difficult to get the full resolution at fast clock speeds. | |||
[http://aaronwolfe.com/robert.gault/Coco/FAQs/HiJoystick/Joystick.zip Joystick.zip] demo Basic program and 2 asm source code files in [[EDTASM]] format binary files included plus Tandy/CocoMax circuit (joystick.gif) | |||
------ | |||
*'''John Kowalski, Robert Gault and Nickolas Marentes''' | |||
http://members.optusnet.com.au/nickma/ProjectArchive/hires.html | |||
This project was jointly created by John Kowalski, Robert Gault and Nickolas Marentes | This project was jointly created by John Kowalski, Robert Gault and Nickolas Marentes | ||
Line 11: | Line 20: | ||
This is the first stage of reading the joystick port that derives the normal 6-bit joystick port reading. | This is the first stage of reading the joystick port that derives the normal 6-bit joystick port reading. | ||
[[Category:Hardware]] [[Category:Joysticks]] |
Revision as of 14:00, 14 April 2017
- Aaron wolfe/robert gault
I present here a simple Basic program to demonstrate how the adapter can be used in either the Tandy or CocoMax modes. Most of the work is done by an assembly language routine, one for each mode. This is not the only way to write useful code, it is just an example to get you started on your own projects. Keep in mind that the timed circuit values change when the Coco CPU clock changes. It may be difficult to get the full resolution at fast clock speeds.
Joystick.zip demo Basic program and 2 asm source code files in EDTASM format binary files included plus Tandy/CocoMax circuit (joystick.gif)
- John Kowalski, Robert Gault and Nickolas Marentes
http://members.optusnet.com.au/nickma/ProjectArchive/hires.html
This project was jointly created by John Kowalski, Robert Gault and Nickolas Marentes
How the ADC works
The real work when converting any analogue voltage to a digital reading with the Color Computer is actually done using the DAC (Digital-to-Analogue) converter. To understand how the ADC (Analogue-to-Digital) circuit works, we must understand how the DAC works.
In simple terms, the DAC accepts data from the computer and converts it to an analogue voltage. Although the computer's data bus is 8-bit, the input to the DAC is only 6-bits. This represents a value from 0 to 63 or 64 individual voltage steps as output from the DAC. This is also how the 64 levels of volume is derived when the DAC output is diverted and used for sound generation.
In order to get a digital reading from the joystick port, the output of the DAC is fed into an input of a voltage comparator. At the same time, the voltage from the joystick or mouse is fed into a second input of the voltage comparator. This voltage comparator compares the two input voltages and sets an output high or low to indicate the difference. Software running on the Color Computer can read the comparator output and determine if the DAC voltage needs to be raised or lowered to attempt to match the joystick port voltage. This test is repeated until it locates the DAC voltage value which coincides with the incoming voltage. Through a process of successive approximation, an accurate ADC value can be found.
This is the first stage of reading the joystick port that derives the normal 6-bit joystick port reading.