Pastrami+Tina

General homebrew games, programs and PlayStation PS-EXE's
Post Reply
User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Pastrami+Tina

Post by Gemini » February 19th, 2012, 3:42 am


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
Image
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.

Image
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.

Image Image
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.

User avatar
Avanaboy
PSXDEV Moderator
PSXDEV Moderator
Posts: 12
Joined: January 13th, 2012, 10:00 pm
Location: Italy
Contact:

Re: Pastrami+Tina

Post by Avanaboy » February 20th, 2012, 9:39 am

So pastrami is a sort of emu base code, right ?
Btw this project sound cool , good luck

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 20th, 2012, 12:27 pm

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.

User avatar
Avanaboy
PSXDEV Moderator
PSXDEV Moderator
Posts: 12
Joined: January 13th, 2012, 10:00 pm
Location: Italy
Contact:

Re: Pastrami+Tina

Post by Avanaboy » February 20th, 2012, 10:10 pm

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

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 21st, 2012, 1:31 am

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.

User avatar
Avanaboy
PSXDEV Moderator
PSXDEV Moderator
Posts: 12
Joined: January 13th, 2012, 10:00 pm
Location: Italy
Contact:

Re: Pastrami+Tina

Post by Avanaboy » February 21st, 2012, 3:34 am

That's normal , but it is still useful and cool to use ..

User avatar
cybdyn
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: Pastrami+Tina

Post by cybdyn » February 24th, 2012, 10:28 pm

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.

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 25th, 2012, 3:37 am

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.

User avatar
cybdyn
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: Pastrami+Tina

Post by cybdyn » February 25th, 2012, 8:53 am

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...

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 25th, 2012, 10:25 pm

In other words it could work in a similar way to the DsTwo. Very interesting. :D

User avatar
cybdyn
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: Pastrami+Tina

Post by cybdyn » February 26th, 2012, 8:11 am

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... ?

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 26th, 2012, 3:19 pm

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:
Image Image
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.

User avatar
cybdyn
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: Pastrami+Tina

Post by cybdyn » February 27th, 2012, 9:08 pm

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...

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 28th, 2012, 2:03 am

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.

User avatar
cybdyn
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: Pastrami+Tina

Post by cybdyn » February 28th, 2012, 7:20 am

not bad...

did you try compile this?
what is your plan with this in future? wanna made emu for ps1?

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 28th, 2012, 12:09 pm

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.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2232
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Pastrami+Tina

Post by Shadow » February 28th, 2012, 10:49 pm

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...
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

Development Computer: Windows 98, Pentium 3 [400MHz], 128MB SDRAM, DTL-H2000, DTL-H201A, 21" Sony Trinitron CRT, CD-ROM burner, 3.25" and 5.25" Floppy Diskette Drives and a ZIP 100 Diskette Drive.

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: Pastrami+Tina

Post by Gemini » February 29th, 2012, 2:08 am

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.

emvivre
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: May 19th, 2014, 3:33 am

Re: Pastrami+Tina

Post by emvivre » May 23rd, 2014, 5:51 am

Very interesting project :clap Do you have any news about this project ?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest