Jump to content

Photo

Can I learn to hack 5200 pole position controller code?


7 replies to this topic

#1 Swami OFFLINE  

Swami

    River Patroller

  • 2,164 posts
  • Location:Twin Cities, MN

Posted Wed May 16, 2018 1:00 PM

If I wanted to learn to hack the 5200 pole position rom controller code for a PC racing wheel with a homemade 5200 to 15pin PC adapter, is this a reasonable short term goal for learning to program for the 5200? I know pretty much nothing, like should I learn to do such a thing in BASIC or assembly? Where can I learn step by step to get to this point?

 

The end goal of this project would be to move the acceleration and braking from fire 1 and 2 to up and down, to have analog gas and brake that work on old PC wheels, to move the shifter to fire1 and fire2, since the PC wheel shifters are digital, and, finally, be able to fine tune trigger values for these four functions to work with variations in wheel voltage outputs.

 

Thanks!



#2 baktra ONLINE  

baktra

    Dragonstomper

  • 520 posts
  • Location:Czech republic

Posted Thu May 17, 2018 1:40 AM

It is most certainly an ambitious goal.

You would need to do it in assembly language. that is for sure.

 

As your project involves also hardware, let us test feasibility.

Each 5200 controller has two analog inputs (two joystick axes, in modern terminology), that should be sufficient. One axis for steering, other axis for braking/acceleration.

 

In terms of the software, you would have to hack P.P's controller reading code (reading axes instead of buttons), and update also the game physics (so it not only recognizes "braking on/off", but "how much of braking". 



#3 Xuel OFFLINE  

Xuel

    Dragonstomper

  • 723 posts
  • Location:US

Posted Thu May 17, 2018 12:32 PM

In terms of the software, you would have to hack P.P's controller reading code (reading axes instead of buttons), and update also the game physics (so it not only recognizes "braking on/off", but "how much of braking". 

 

One way to handle braking without modifying the game physics too much would be to convert the analog braking value into pulse-width-modulated braking on/off. Varying the number of frames of braking "on" per, say, 20 frames would give you 20 levels of braking. So, for example, a very light braking could convert to braking "on" for 1 out of every 20 frames and full braking could convert to braking "on" 20 out of every 20 frames.

 

But maybe it's just as easy to modify the physics engine to handle variable amount of braking.

 

If I wanted to learn to hack the 5200 pole position rom controller code for a PC racing wheel with a homemade 5200 to 15pin PC adapter, is this a reasonable short term goal for learning to program for the 5200? I know pretty much nothing, like should I learn to do such a thing in BASIC or assembly? Where can I learn step by step to get to this point?

 

The end goal of this project would be to move the acceleration and braking from fire 1 and 2 to up and down, to have analog gas and brake that work on old PC wheels, to move the shifter to fire1 and fire2, since the PC wheel shifters are digital, and, finally, be able to fine tune trigger values for these four functions to work with variations in wheel voltage outputs.

 

Thanks!

 

You're going to need to disassemble the original game code into assembly so 1) you can understand how it works and 2) you know where to modify it.

 

Here's a quick disassembly the 8-bit computer version of Pole Position to give you an idea:

 

Attached File  pp.zip   301.34KB   24 downloads

 

I included my disassembler "dis" and xasm. I didn't label anything other than the standard OS and hardware memory locations. Disassembly is an art. You have to figure out what various parts of code do but the main thing is figuring out how the data and variables are laid out. Once you know which memory locations correspond to various aspects of the game it becomes much easier to understand what's going on throughout the code. For example, one byte may be used by the code to store the velocity of your car. Figuring out which one will help you unravel other bits of code since you'll see all the places that refer to that byte and then understand they must have something to do with either setting or reacting to the velocity of the car. It's a multidimensional puzzle.



#4 Swami OFFLINE  

Swami

    River Patroller

  • Topic Starter
  • 2,164 posts
  • Location:Twin Cities, MN

Posted Thu May 17, 2018 12:47 PM

It is most certainly an ambitious goal.
You would need to do it in assembly language. that is for sure.
 
As your project involves also hardware, let us test feasibility.
Each 5200 controller has two analog inputs (two joystick axes, in modern terminology), that should be sufficient. One axis for steering, other axis for braking/acceleration.
 
In terms of the software, you would have to hack P.P's controller reading code (reading axes instead of buttons), and update also the game physics (so it not only recognizes "braking on/off", but "how much of braking".

  

One way to handle braking without modifying the game physics too much would be to convert the analog braking value into pulse-width-modulated braking on/off. Varying the number of frames of braking "on" per, say, 20 frames would give you 20 levels of braking. So, for example, a very light braking could convert to braking "on" for 1 out of every 20 frames and full braking could convert to braking "on" 20 out of every 20 frames.
 
But maybe it's just as easy to modify the physics engine to handle variable amount of braking.
 

 
You're going to need to disassemble the original game code into assembly so 1) you can understand how it works and 2) you know where to modify it.
 
Here's a quick disassembly the 8-bit computer version of Pole Position to give you an idea:
 
attachicon.gifpp.zip
 
I included my disassembler "dis" and xasm. I didn't label anything other than the standard OS and hardware memory locations. Disassembly is an art. You have to figure out what various parts of code do but the main thing is figuring out how the data and variables are laid out. Once you know which memory locations correspond to various aspects of the game it becomes much easier to understand what's going on throughout the code. For example, one byte may be used by the code to store the velocity of your car. Figuring out which one will help you unravel other bits of code since you'll see all the places that refer to that byte and then understand they must have something to do with either setting or reacting to the velocity of the car. It's a multidimensional puzzle.


Thank you. That is helpful. Would you or anyone else know of a book or internet based tutorial that would be an introduction to 8 bit/5200 programming that would include 5200 controller (analog/digital/trackball) programming? Or two sequential sources that would get me to the same point more or less?

#5 Xuel OFFLINE  

Xuel

    Dragonstomper

  • 723 posts
  • Location:US

Posted Thu May 17, 2018 1:45 PM

  
Thank you. That is helpful. Would you or anyone else know of a book or internet based tutorial that would be an introduction to 8 bit/5200 programming that would include 5200 controller (analog/digital/trackball) programming? Or two sequential sources that would get me to the same point more or less?

 

The Altirra Hardware Reference Manual is a comprehensive Atari 8-bit computer and 5200 reference. The only other thing you need is a 6502 CPU fundamentals guide. Maybe this one is good? I haven't gone through it but superficially it looks OK.



#6 Swami OFFLINE  

Swami

    River Patroller

  • Topic Starter
  • 2,164 posts
  • Location:Twin Cities, MN

Posted Thu May 17, 2018 2:29 PM

 

The Altirra Hardware Reference Manual is a comprehensive Atari 8-bit computer and 5200 reference. The only other thing you need is a 6502 CPU fundamentals guide. Maybe this one is good? I haven't gone through it but superficially it looks OK.

Okay, I'm making pixels in a 6502 assembly environment in a Java 6502 emulator, I think...

Thanks for getting me started.



#7 baktra ONLINE  

baktra

    Dragonstomper

  • 520 posts
  • Location:Czech republic

Posted Fri May 18, 2018 10:04 AM

And let's not forget http://atariage.com/...ms-to-the-5200/



#8 pirx OFFLINE  

pirx

    Moonsweeper

  • 438 posts
  • Location:Poland

Posted Sun May 20, 2018 6:24 AM

what about doing this in e.g. arduino? this way not much of a 6052 learning would be involved (sadly), but other games could benefit. and finding old PC analog joysticks would be possibly easier than 5200 controllers, so it'd be a winwinwin situation.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users