Porting Code Between PIC chips (PS1 Modchip)

Discussion in 'Modding and Hacking - Consoles and Electronics' started by deserada, May 11, 2014.

  1. deserada

    deserada Active Member

    Joined:
    Jan 26, 2014
    Messages:
    35
    Likes Received:
    1
    Hello.

    At the moment I have about a dozen PIC12F683 chips looking for homes in some of my older PS1 consoles. The only MM3 hex for re-writable chips which I have on hand is written for the similar but slightly inferior PIC12F629 chips and I was wondering what would be necessary to port the code to something compatible with PIC12F683 (if it isn't compatible already).

    It might be the case that someone has already made this code available, and I simply wasn't able to find it.

    If anyone could advise future users in a similar predicament with where to find this code, or how to port it themselves, it would be much appreciated.

    Here is a dump of the hex, for reference:
     
  2. ChemicalBro

    ChemicalBro Spirited Member

    Joined:
    Apr 6, 2014
    Messages:
    104
    Likes Received:
    1
    Might just work as is, only difference is the osc I think? So that might need a code tweak if it doesn't.
     
  3. TriMesh

    TriMesh Site Supporter 2013-2017

    Joined:
    Jul 3, 2008
    Messages:
    2,324
    Likes Received:
    750
    It will require a significant amount of rewriting to run on those later chips.

    The most significant issue is that the old modchip code made heavy use of the TRIS instruction to set pins to tristate mode. By the time the 12F629 came out, this instruction was deprecated (along with OPTION) - but it still worked. On the later chips like the 12F683, it's actually been deleted.

    Basically, you will have to go through the code and replace every instance of the TRIS instruction with
    BSF STATUS,RP0
    MOVWF GPIO
    BCF STATUS,RP0

    Obviously you need to keep an eye out for skips when doing this, too.
     
    Last edited: May 11, 2014
  4. deserada

    deserada Active Member

    Joined:
    Jan 26, 2014
    Messages:
    35
    Likes Received:
    1
    Alright, thanks for the tip. I'll get to it after I knock some repairs out of the way.

    I'll do some more research and come back if I hit a roadblock.

    This has been my quick reference:
    http://www.pages.drexel.edu/~kws23/tutorials/PICTutorial/PICTutorial.html
     
    Last edited: May 17, 2014
  5. ChemicalBro

    ChemicalBro Spirited Member

    Joined:
    Apr 6, 2014
    Messages:
    104
    Likes Received:
    1
    Ah good tips. There's a post on psx-scene about someone who was porting it for old crow, but their code is still using tris, so not sure how that was supposed to work.
     
  6. deserada

    deserada Active Member

    Joined:
    Jan 26, 2014
    Messages:
    35
    Likes Received:
    1
  7. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,309
    Last edited: May 11, 2014
  8. ChemicalBro

    ChemicalBro Spirited Member

    Joined:
    Apr 6, 2014
    Messages:
    104
    Likes Received:
    1
    Yep, I was only mentioning the old crow as a basis to see how that other guy was porting 12f629 code to 12f683. But it looks like he didn't get very far since there was still tris commands.

    I have 683's that I would enjoy using for mm3, maybe I'll give it a shot at tweaking if possible. Good way to learn some assembly I suppose.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page