|
Post by hydrophilic on Dec 23, 2017 21:02:33 GMT
This a companion thread to my original post ( Tempest, listed under Games). I know it's bad etiquette to double-post, but I want the other thread to be about the original arcade game and the finished C128 version -- in other words, a polished/simple overview for the casual gamer. This thread is about the dirty details of porting TEMPEST to the Commodore 128. It's for the hackers and nerds. A few years ago, I found a disassembly of the arcade game on Tempest Code Project (a deep-link to that file is here). Take a look and you will find some cool info, but you will also find a LOT of missing info. It was so bad, I forgot about it for years. But several months ago, I was browsing my files of "Tempest Info" and found another disassembly that, together with the first file, and many other technical files made the entire software "click" in my brain. I've spent the last 6 months (in my spare time) working on a "new source code". This new file documents as much as I have learned and, importantly, can be assembled to reproduce the original arcade ROMs (well, one version... there are multiple ROM versions according to the arcade community). My new version can be found here. I've published that as a basis for anybody else who wants to write a 6500-CPU-based port of TEMPEST. However, it is not directly useful for the C128 (or C64 or Plus/4) because of several issues. I will list them here and we can discuss them below... - Addresses zero and one are used like normal RAM (the 6510 and 8502 use these as special I/O registers!)
- Addresses $e000~$ffff are an alias of $c000~$dfff (thus my code lacks the critical CPU vectors: NMI/RES/IRQ_BRK)
- The arcade has an Analog Video Generator (AVG) while the C64/128 has a VIC-II
- The arcade has two POKEYs while the C64/128 has one SID (and two CIAs)
- The arcade has a 'mathbox' which performs scaling (multiplication/division) in hardware -- the C64/128 doesn't have anything like that
- The arcade has a 'spinner' and 'coin slots' (the 'spinner' can be emulated with a mouse, and the slots with the keyboard)
- The arcade runs the CPU at 1.5 MHz, but in 40-column mode the C64/128 CPU is only 1.0 MHz (or about 1.2 MHz with 'fast border')
I'll obviously need to re-write my code to deal with all those issues. The first two (ZP 0&1, and aliasing memory $e000~$ffff) aren't too difficult. It is the remainder that will require real work!
|
|
|
Post by bjonte on Dec 25, 2017 13:03:32 GMT
Are you attempting a close to 100% accurate port? It feels like the lack of spinner will be making the game considerably harder since old mice don't work that well for arcade games. Is there a usb solution nowadays that makes it possible to use an optical mouse?
|
|
|
Post by Zippy Zapp on Dec 28, 2017 20:57:39 GMT
Cool. I love reading about all the programming geekiness, it is fascinating.
The spinner is the knob you turned to move the ship right? Couldn't you use paddle controls or the driving controllers for Atari 2600? Paddles wouldn't be ideal as they have stops, unlike the driving controls. Not sure that they can be interfaced though.
|
|
|
Post by hydrophilic on Jan 5, 2018 10:59:47 GMT
My plan is to use as much of the original arcade ROM as possible. bjonte , there is no "spinner" game-controller ever made for the Commodore (AFAIK), but I have 5 (five) ideas possible for my port: - Commodore Mouse (turn it upside-down and manually spin the ball)
- Atari Trackball (read below)
- Paddle
- Joystick (lame)
- Keyboard (lame)
The easiest, and most practical, conversion of this arcade classic is to simply use a C1531 mouse... but the user must turn the mouse "upside down" and spin the tiny ball manually. This will give (in my opinion) a true feel for the original game, but may feel very awkward!!
Another alternative is to invest in the "Atari Trackball". This device can work with a Commodore 64/128 or Atari 2600 in "joystick mode" (similar to C1350 mouse) with extremely limited resolution. Note the Atari Trackball can also work in "analog" mode, similar to C1351 mouse... however I never discovered how to make the "analog" mode work with a Commodore! It might not even be possible to use "analog" control without hacking the hardware... In summary this is a "pipe dream" that may never be possible, but if it could be forced to work then it may be the best!!
Option 3, the "paddle" is easy to program, but there are no "official" paddles that allow spinning an infinite amount in either direction (clockwise or counter-clockwise). In other words, the "paddle" option would give a true "feel" for spinning (in a limited amount) but it would also fail in the context of "infinite" spin.
Options 4 and 5 (Joystick/Keyboard) are lame. These allow the user to move in a particular direction, but only at a constant speed. Sure we could implement a subroutine to increase speed based on how long a a joystick/key is constantly held down (which could poorly emulate a mouse/trackball/spinner), but it just wouldn't "feel" the same.
For development / debugging purposes, I plan to implement the simple/lame Joystick/Keyboard (option 4/5) in my first "alpha" testing. Once the game is "working", I will implement (option 1) "upside down mouse". Finally, if I find the time, I will try options 2 and 3 (but don't rely on that).
-- OFF TOPIC -- I wanted to discuss OUTPUT issues -- like audio and video -- in my first follow-up post... but it seems all I talked about was input ... Well, in retrospect, it seems you HAVE to consider input before output...
|
|
|
Post by bjonte on Jan 5, 2018 18:11:49 GMT
Upside down mouse sounds like an interesting idea that may work! That would work for other mice as well with down side down so it seems almost perfect. Paddles could be supported as well (even of gameplay is slightly affected).
|
|
|
Post by hydrophilic on Jan 7, 2018 9:54:48 GMT
The "upside-down mouse" (option 1) will give a great "feel" of the original arcade game for Commodore owners, but there are 2 main issues... - The exposed ball of a C1351 mouse is tiny (it may be difficult to control)
- With the mouse "upside-down" clicking the buttons will be awkward!
The Atari Trackball -- in ANALOG mode -- (option 2) should give the best "feel" of the arcade classic, but I still don't know how to make it work with C64/128... and even if possible, this would apply to a VERY limited number of Commodore owners...
Option 3, "paddle" mode is a good compromise. Although paddles aren't as popular as joysticks, they are are easy to obtain. I was thinking that because a paddle can't rotate an infinite number turns (like a "spinner" of the arcade), a very effective (read "cool as ice") alternative would be to set the "middle" of a paddle to be "no movement" and then a slight turn to the left or right would give a SMALL "rotation" in the game (left or right, respectively). And thus (expanding on the idea), a large turn from the "center" would result in a BIG "rotation" in the game (left or right, respectively).
Options 4 (joystick) would simply use multiple "speeds of rotation". For example, left-right on a joystick could be "slow" movements (counter-clockwise or clockwise), while up-down on a joystick could be "fast" movements (again, clockwise or counter).
Finally, option 5 (keyboard) could use both "slow" and "fast" rotations based on keys pressed (similar to Joystick / option4). ... Well this is what I am thinking NOW... I still need to emulate the AVG (Analog Vector Generator) and POKEYs (POtentiometer/KEYboard) on the C128 before I proceede... ANYWAY... thanks for discussing this input issue with me! If I missed something, please do tell!
|
|
|
Post by Pyrofer on Jan 7, 2018 14:54:19 GMT
could you use an optical encoder? Like the way the Amiga mouse axis work. You could easily connect it to the joyport or userport. You could also make some kind of custom controller that converted an optical encoder to an easier input for the Commodore. You could use the mouse emulation trick to send an analogue value giving the appearance of a continuous rotation POT (they exist already, but have a dead zone of 40 degrees or so which would suck in game). The other method would be outputting a 5bit digital position giving 32 possible positions. I am not sure how many segments the largest maps on Tempest have but if its less than 32 you could possibly use that which would be easier to read than the mouse style input. This all requires a custom controller however.
|
|
|
Post by hydrophilic on Jan 9, 2018 7:45:06 GMT
The "upside-down mouse" is the most practical method for real Commodore users. If you just want to play the game on a modern PC using VICE (or another emulator), then the next-best thing is using a laptop-PC's "mouse pad". As fast as you can slide your finger across the pad, the player "ship" will move... The ATARI trackball uses an optical encoder. This would be the best option for real Commodore users (who can find an ATARI trackball), but only if I could discover how that device works in "analog mode". (In "digital mode" it works like a common joystick or 1350 mouse.) I was thinking that if I can't find a simple software-solution to using an ATARI trackball (in "analog mode") then a hardware hack might work. Pyrofer you mentioned a 32-position (5-bit) optical encoder... I had similar thoughts! My idea is to use a 16-position (4-bit) encoder using a common Joystick port (of course you could rig one to User Port too). So 4 bits for position, and 1 bit for the FIRE button -- hopefully you can see this would work fine for a CBM-Game port. Now you may be thinking that 4-bit resolution isn't adequate, but Lo and Behold: the real TEMPEST arcade game also uses a 4-bit optical encoder... so I'm pretty confident it would work
|
|
|
Post by Pyrofer on Jan 9, 2018 15:10:05 GMT
16 positions isn't enough, but you don't need to translate it to an absolute position only see which direction it has moved so a 4 bit optical encoder should work when polled and even if you miss the odd step it won't matter too much. I've only normally seen 2bit optical and 4bit mechanical, you would want a nice smooth rotation for game flow so the controller is going to be a fun project all in itself.
|
|
|
Post by Zippy Zapp on Jan 11, 2018 15:42:43 GMT
As to the driving controllers I mentioned above. In case you aren't familiar they have no stops so they can turn infinitely. But apparently they are more like joysticks then paddles. So maybe it wouldn't be ideal. They are usable on a C64/128 though: www.lemon64.com/forum/viewtopic.php?t=61436
|
|