Prince of Persia disassembled

All 680x0 related coding posts in this section please.

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Prince of Persia disassembled

Postby AtariZoll » Thu Nov 30, 2017 5:50 pm

AAmbrosio wrote:I´m writing a Prince of Persia for MSX system. I'm having a hard time re-creating the sounds of game.
As MSX use the PSG AY-3-8910 (same as YM-2149 of Atari ST) I think to use the disassembled code for find the sequence of sounds commands.
Unfortunately I don't know the assembler 68000 and I don't find the code.
Someone can help me. Information where are the play sound subroutine and the commands sequences of PSG.


Disassemble of game's executable, Atari v. is available here: http://atari.8bitchip.info/GameDisasm/PrincOfPersia/PRIP322.S
As you may see, I criticized game's sample playback code here. But even with some optimizations done sample playback - and that makes sounds during play - like door openings, run, hero's sounds .... it visibly slows down game - CPU load on 8 MHz 68000 is too high. In big part because samplerate (freq.) is high for that kind of playback. So, my concern is that it will be even much worse on slower MSX - with Z80 CPU, if I remember correct. If sample playback is possible at all on MSX at some acceptable quality.
Just to describe how it goes: there is interrupt generated in accurate intervals, controlled by timer chip. Then sound sample data is read from RAM, and it is converted via table to data for YM chip, and then write 6x in YM, 2 for each sound channel. If freq of interrupts is some 5KHz, it makes big slowdown on Atari, so on slower MSX probably will need lower samplerate - conversion is not problem in fact. Problem may by speed, RAM usage ... I think that better idea would be to look some other version of game, what uses not sampled sounds, but usual, less CPU loading sound generating. For instance Amstrad CPC version, I guess.
I mean, I can give help, but somehow I don't expect that it will work in acceptable quality on MSX.

To add here, that I recently did mod of Atari version, where sample playback goes not via YM, but via STE DMA audio system - it has 0 CPU load during sound play, so game is much better - no slowdowns, quality is better. You may see how it looks here:
http://atari.8bitchip.info/SCRSH/princofps.html
Will see YT links for org sound, and DMA sound versions, so can compare.

One question: what source of game you using ? I see a lot for POP online, but that's mostly usable on PC, as I see. Do you have some Z80 code, graphics, sprites usable on MSX ? Game is really good, and was big hit in it's time, I would say that inspired somehow Tomb Rider, for instance. So, idea is good, indeed.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

AAmbrosio
Atarian
Atarian
Posts: 2
Joined: Wed Nov 29, 2017 5:26 pm

Re: Prince of Persia disassembled

Postby AAmbrosio » Mon Dec 04, 2017 12:28 pm

Hi, thanks by help
I thought the sound of game was synthesized, not by samples. You're right, the samples on MSX (with Z80 at 3,59 MHz) is possible but the game will stop during the sound play. My idea is use sound synthesized with PSG.
I think of use the Vblank interrupts (50 or 60 Hz). For each interrup I send commands to PSG to play a step of sound (0,02 or 0,016 s). This is the maximum the MSX can do. My problem is convert the sampled sounds to syntetized sounds.
Your suggestion about Amstrad CPC is very good. I saw that the CPC use the PSG YM-3-8912 and probably the sounds are synthesized (the processor Z80 facilitates too for me). I'm already studying the CPC Prince code.
About my version of Prince to MSX I used it as a source the DOS. It will run on MSX2/MSX2+ (with VDP V9938/V9958).
I don't use sprites but graphics to all game (the sprites of MSX is very limitaded). Is necessary to simulated graphics on levels (kid over background and behind of pillars) and this resource isn't native of MSX. These reasons led me choice the graphics mode. I use the screen 8 (256 colors) and the hardware commands to higth sped of graphics..
The musics I converted form MIDI to MSX Music (YM2413 OPLL). This chip is default for MSX2+.
I already have the code for the oppening and level 1. I used it as a source the bitmaps, sounds and musics from 'MININIM'. http://oitofelix.github.io/mininim/
Once I have a demo I will make it available.

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Prince of Persia disassembled

Postby AtariZoll » Tue Dec 05, 2017 9:25 am

I see it now - MININIM is indeed great project, and I'm sure that will help in keeping POP alive, and to transfer it to more platforms. Something similar is done with Dungeon Master many years ago. Although, that game is not exactly for some 8-bit micro.
Yes, doing writes to PSG in V-blank interrupts is common way. Of course, you need to take care about playback speed - at 60 Hz it will be 20% faster, unless there is some correction for in SW. It there is some timer in MSX, what can be programmed for accurate intervals, that would be probably better - used in Atari games a lot.
Considering sprites: on Atari ST there is no any sprite draw support, all is on CPU. And it can do that job when is well coded. No 256 color mode.
So, there is some HW support in MSX, according to what you say, only that no OS sprite draw support - at least I understand it so. And it would be way too slow with that mode 8 if CPU should do all the job. I really know almost nothing about MSX.
Good luck with your project, and don't forget to inform us about demo ... and finished game :D
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 1 guest