Page 1 of 1
Pastrami+Tina
Posted: February 19th, 2012, 3:42 am
by Gemini
Pastrami+Tina: a SNES to PlayStation porting project
Players: depends on the game that we'll decide to port
Memory Card: 1+ Blocks (again, depends on the game; 1 block per save slot should to it, though)
Genre: depends
Controller: Standard Analog, Dual Shock is also supported (vibration not supported)
Time to Complete: still being developed
Languages: unknown yet, probably multi language
SDK: PSY-Q
This project is meant as a conversion procedure used to port SNES games to the PlayStation (or other systems more similar to the SNES, i.e. the Nintendo DS). It is composed of two main programs: Tina, the SNES to C converter (which is basically supposed to disassemble a full ROM and port all the code to C-style code), and Pastrami, the actual code base used to interpret all the SNES part of the software so that it can run in a similar manner to the original game.
The basic idea behind this project is to create a decent conversion of the 65c816 code so that it can be recompiled to newer systems using a set of macros to translate SNES opcodes and low-level procedures into more user friendly C instructions. So far it doesn't do much more than rendering VRAM chunks and interpret a few instructions manually disassembled and converted to C code, but in a near (?) future it will be able to do most of this stuff automatically and only ask the user to correct particular parts of the code that simply cannot be converted automatically (i.e. WRAM code, particular jump tables, indirect addressing).
Here's an example of the translated code:
Code: Select all
void GetPlayTime()
{
LDAram(0x21E); //LDA byte_7E021E ; Load frame count
if(a.seg.l==60) goto carry_sec; //CMP.B #060 :: BEQ loc_3143C | If 60, branch to below "carry out" into seconds
goto __overflow; //BRA __overflow | Otherwise, branch directly to overflow checks
carry_sec:
STZ(0x21E); //STZ byte_7E021E
LDAram(0x21D); //LDA byte_7E021D
if(a.seg.l==59) goto carry_min; //CMP.B #059 :: BEQ loc_3144B | If 59, branch to below "carry out" into minutes
INC(0x21D,1); //INC byte_7E021D
goto __overflow; //BRA __overflow
carry_min:
STZ(0x21D); //STZ byte_7E021D | Set seconds to 0
LDAram(0x21C); //LDA byte_7E021C
if(a.seg.l==59) goto carry_hr; //CMP.B #059 :: BEQ loc_3145A | If 59, branch to below "carry out" into hours
INC(0x21C,1); //INC byte_7E021C | Increment minutes
goto __overflow; //BRA __overflow
carry_hr:
STZ(0x21C); //STZ byte_7E021C | Set minutes to 0
LDAram(0x21B); //LDA byte_7E021B
if(a.seg.l==99) goto __overflow; //CMP.B #099 :: BEQ __overflow
INC(0x21B,1); //INC byte_7E021B
__overflow:
LDAram(0x21B); //LDA byte_7E021B
if(a.seg.l!=99) goto frame_inc; //CMP.B #099 :: BNE loc_31478 | If not 99, branch to frame increment; hours haven't overflowed
LDAram(0x21C); //LDA byte_7E021C
if(a.seg.l!=99) goto frame_inc; //CMP.B #059 :: BNE loc_31478 | If not 99, branch to frame increment; minutes haven't overflowed
STZ(0x21D); //STZ byte_7E021D | Set seconds to 0
frame_inc:
INC(0x21E,1); //INC byte_7E021E | Increment frames
TDC; //TDC
//RTL
}
Screenshots
A test of VRAM emulation with the rename screen from Star Ocean. Right is the SNES original, left is the PSX improved version using the same VRAM chunk as a base for rendering.
Testing a field scene from Star Ocean. The debugging information are there just for optimization purpose, since the PlayStation hardware isn't very good for rendering tiled graphics and the whole screen reprocessing can take a long time causing frame skipping in some cases.
A couple newer test screens made with the latest build of Pastrami. The second screen also shows the canvas procedures used to print text on screen, so that it can be impressed to a buffer once and will not need any additional drawing routines, just like it used to be on the SNES.
Re: Pastrami+Tina
Posted: February 20th, 2012, 9:39 am
by Avanaboy
So pastrami is a sort of emu base code, right ?
Btw this project sound cool , good luck
Re: Pastrami+Tina
Posted: February 20th, 2012, 12:27 pm
by Gemini
Nope, there's no emulation involved on the PlayStation side. All the code is statically recompiled to R3000 and whatever can't be ported straight is interpreted in an old-style manner.
Re: Pastrami+Tina
Posted: February 20th, 2012, 10:10 pm
by Avanaboy
oh cool , I was thinking that it was difficult to decompile a ROM in C lang, but if this will work it will be an useful prog !
cheers
Re: Pastrami+Tina
Posted: February 21st, 2012, 1:31 am
by Gemini
It's not a program that does magic, it basically only gives a useful resource to port it all to a different system. Still, there's a lot of manual work involved, like optimization of most aspects, especially game-specific APIs.
Re: Pastrami+Tina
Posted: February 21st, 2012, 3:34 am
by Avanaboy
That's normal , but it is still useful and cool to use ..
Re: Pastrami+Tina
Posted: February 24th, 2012, 10:28 pm
by Yuri^Cybdyn
i have idea in the future , create emu of cpu (of snes/sega and others...) in hadware (FPGA) for fast exection. PS-IO can reload internal FW to do this functions.
Re: Pastrami+Tina
Posted: February 25th, 2012, 3:37 am
by Gemini
How much fast could it perform? Still, I'm not entirely sure the rest of the hardware could make it. Emulating the SNES Vram and other peripherals is a real pain in the ass.
Re: Pastrami+Tina
Posted: February 25th, 2012, 8:53 am
by Yuri^Cybdyn
i think - faster then original cpu in more times))) . FPGA can multple clk to internal logic. i tryed it with PLL : external crystal was 25 Mhz -> but i got inside 320 Mhz )))
maybe you don't imagin how it works. FPGA can emulate many things - but it depends on Logical elements, internl delays, costs of chip, time for developing. and also we can emulate only some peaces of snes hw...
Re: Pastrami+Tina
Posted: February 25th, 2012, 10:25 pm
by Gemini
In other words it could work in a similar way to the DsTwo. Very interesting.
Re: Pastrami+Tina
Posted: February 26th, 2012, 8:11 am
by Yuri^Cybdyn
as for me i'm not too interesing in this. but who knows - everything is changes)))
don't know what DsTwo , something that is used FPGA?
Gemini - but what about of ths tpic - you interesting in this, have you already tryed or used this before? or its just story?
you need help?
and do interesting if FPGA would help with emulating or act like original SNES cpu... ?
Re: Pastrami+Tina
Posted: February 26th, 2012, 3:19 pm
by Gemini
cybdyn wrote:don't know what DsTwo , something that is used FPGA?
It's basically a DS flashcard with an additional MIPS CPU (200+ MHz if I remember correctly) and 32 MB of ram for user data. It can play DivX/XviD based formats with OGG, MP3 or AAC audio, and it also has plug-ins for emulating consoles such as the SNES and the GBA.
Gemini - but what about of ths tpic - you interesting in this, have you already tryed or used this before? or its just story?
I own a DsTwo card, but actually never did any real programming for it. I simply know how it works, more or less.
and do interesting if FPGA would help with emulating or act like original SNES cpu... ?
Well, what you have under Pastrami isn't emulated code at all. All the SNES opcodes are translated as macros so that each instruction is statically recompiled into native MIPS stuff, this way games can play just fine on any retail PSX unit without any extra horsepower. Basically, this is what TOSE (the company behind these ports) did for the PlayStation versions of FF4-5-6, Chrono Trigger, and Front Mission 1st. The idea behind this is not simply to port a game "as-is" to a different system, but also to implement some improvements in order to render them a little better in whatever aspect needs to be changed for good. An example would be these hacks I made for FFIV PSX:
The first picture shows a much improved dialog box to make it similar to the DS window theme. The second shows how I implemented a much better interface for the battle menus while also improving the backgrounds to make them use pictures taken from FFIV The Complete Collection for the PSP. Now, all this stuff has been done by injecting pure assembly code into the game, so imagine how much space for improvements there is with C/C++ and practically infinite room.
Re: Pastrami+Tina
Posted: February 27th, 2012, 9:08 pm
by Yuri^Cybdyn
its interesting make HW-based emulator or some old consoles for PS1. as for me - only need full info - how it works, and if it woulb be interesting for many people...
Re: Pastrami+Tina
Posted: February 28th, 2012, 2:03 am
by Gemini
Well, if you wanna see in detail how it works (more or less, that is), check out
this piece of code from the PPU emulation module.
Re: Pastrami+Tina
Posted: February 28th, 2012, 7:20 am
by Yuri^Cybdyn
not bad...
did you try compile this?
what is your plan with this in future? wanna made emu for ps1?
Re: Pastrami+Tina
Posted: February 28th, 2012, 12:09 pm
by Gemini
That source I posted above is part of the pastrami executable, so yeah, it has already been compiled into something working. I think it could be recycled for a SNES emulator, since all it does is emulating how the PPU works in some regards, even if it's largely incomplete and needs decent tests before it can be used for anything generic enough. I think the best idea would be using an already existing emulator, that should make everything playable almost out of the box.
Re: Pastrami+Tina
Posted: February 28th, 2012, 10:49 pm
by Shadow
Since PSIO will be sold and or distributed worldwide, we must own all software rights to avoid copyrights, patents, etc.
I dont think we will be able to use someones emulator already coded for the PS1. Not unless we have their permission of course...
Re: Pastrami+Tina
Posted: February 29th, 2012, 2:08 am
by Gemini
Well, the DsTwo also offers a few emulators to be installed on the SD card. They are not sold with the flashcard, but distributed as free plug-ins, so it shouldn't be a problem if one wants to port Snes9x or whatever other software to PSIO as long as due credit is given.
Re: Pastrami+Tina
Posted: May 23rd, 2014, 5:51 am
by emvivre
Very interesting project
Do you have any news about this project ?