Going great guns on a Prince of Persia port...

developing/porting a new game or gaming framework? post in here!
User avatar
daveejhitchins
Posts: 7876
Joined: Wed Jun 13, 2012 6:23 pm
Location: Newton Aycliffe, County Durham
Contact:

Re: Going great guns on a Prince of Persia port...

Post by daveejhitchins »

Matt Godbolt wrote:I am SO excited for this. Can we support this in some way? A Patreon, or some such thing? The amount of effort you all are putting in is amazing!
Seconded, this Game is going to set-some-standards! . . . With Kieran working on this and Sarah working on her "tube type thingy" and White Light under her belt already . . . Wow =D>

Dave H :D
Available: ARA II : ARA III-JR/PR : ABR : AP5 : AP6 : ABE : ATI : MGC : Plus 1 Support ROM : Plus 3 2nd DA : Prime's Plus 3 ROM/RAM : Pegasus 400 : Prime's MRB : ARCIN32 : Cross-32
User avatar
oss003
Posts: 3849
Joined: Tue Jul 14, 2009 12:57 pm
Location: Netherlands
Contact:

Re: Going great guns on a Prince of Persia port...

Post by oss003 »

Congratulations guys, the gameshots are looking fantastic.
I know it's a big and long proces to check all game assembler and game data but checking 128KB is a huge, huge job........ respect ...... =D> =D>
Keep up the good work by posting some screen shots now and then, makes waiting easier ....

Greetings
Kees
User avatar
Lardo Boffin
Posts: 2977
Joined: Thu Aug 06, 2015 7:47 am
Contact:

Re: Going great guns on a Prince of Persia port...

Post by Lardo Boffin »

daveejhitchins wrote:
Matt Godbolt wrote:I am SO excited for this. Can we support this in some way? A Patreon, or some such thing? The amount of effort you all are putting in is amazing!
Seconded, this Game is going to set-some-standards! . . . With Kieran working on this and Sarah working on her "tube type thingy" and White Light under her belt already . . . Wow =D>

Dave H :D
Thirded. :D

This was my main motivation in getting a Master...
Adventure Language on GitHub
Atom, issue 5, YARRB + video noise killer
Elk
A number of econetted (is that a word?) Beebs
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

Matt Godbolt wrote:I am SO excited for this. Can we support this in some way? A Patreon, or some such thing? The amount of effort you all are putting in is amazing!
Thanks for the feedback & encouragement, that is all the support I need for the project (plus using jsbeeb to distribute test builds of course. ;))

The usage rights for the POP source code were made quite clear by Jordan when he posted them to GitHub: https://github.com/jmechner/Prince-of-Persia-Apple-II
Jordan Mechner wrote:As the author and copyright holder of this source code, I personally have no problem with anyone studying it, modifying it, attempting to run it, etc. Please understand that this does NOT constitute a grant of rights of any kind in Prince of Persia, which is an ongoing Ubisoft game franchise. Ubisoft alone has the right to make and distribute Prince of Persia games.
As we've said, this is a labour of love for those involved and we do it because it's a challenge, it's fun and for the love of the BBC! No Patreon required.

That said, whilst three of the team are gainfully employed elsewhere, our musician Inverse Phase does make a living creating chiptune music (a niche gig by any measure) so any time he spends working on POP is time not spent on paid work. I would therefore encourage everyone to visit his Patreon page and consider supporting him so we may continue to have new, awesome BBC tunes in the future https://www.patreon.com/inversephase/overview. (I know you're already a supporter Matt!)
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
User avatar
Matt Godbolt
Posts: 255
Joined: Mon Jul 31, 2006 11:02 am
Location: Chicago
Contact:

Re: Going great guns on a Prince of Persia port...

Post by Matt Godbolt »

Cool! Thanks Kieran. We'll keep up our side of the agreement by continuing to give our enthusiastic support!
RobC
Posts: 3816
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Going great guns on a Prince of Persia port...

Post by RobC »

Wow - that looks amazing. Congrats to all involved =D>

I'm sure it'll be well worth the wait :D
User avatar
trixster
Posts: 1173
Joined: Wed May 06, 2015 12:45 pm
Location: York
Contact:

Re: Going great guns on a Prince of Persia port...

Post by trixster »

It looks absolutely amazing! More screenshots please!
User avatar
richardtoohey
Posts: 4075
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: Going great guns on a Prince of Persia port...

Post by richardtoohey »

Matt Godbolt wrote:We'll keep up our side of the agreement by continuing to give our enthusiastic support!
Hear, hear! =D> It's looking great, but don't kill yourselves with delivery deadlines/stress; it will be ready when it's ready! :D
User avatar
Dave Footitt
Posts: 998
Joined: Thu Jun 22, 2006 10:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Going great guns on a Prince of Persia port...

Post by Dave Footitt »

Aye, top work, looking really lovely!

I've just had my Master Compact refurbed and this will be the perfect excuse to get it going =D>
User avatar
Dethmunk
Posts: 224
Joined: Fri Jul 01, 2016 1:29 pm
Location: Guildford
Contact:

Re: Going great guns on a Prince of Persia port...

Post by Dethmunk »

FYI It's close my Acorn loving friends.... :wink:
Note: This is just a bit of extra artwork I put together for Kieran. (Subject to changes). Up to him what he does with it mind you. He seemed to like it. :D I was just doing a test print of it.

Image
Image
User avatar
richardtoohey
Posts: 4075
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: Going great guns on a Prince of Persia port...

Post by richardtoohey »

No, no, you've got no time for that, get on with the game!

:twisted: :shock:

Just kidding, it looks great. :D

Just read Jordan's journal from that time (when he created Prince of Persia); interesting read (but very very light on any technical detail.)
User avatar
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Going great guns on a Prince of Persia port...

Post by FourthStone »

This PDF is a good read of some of the technical bits.

http://www.jordanmechner.com/downloads/popsource.pdf
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

Almost a year after first looking at the code here we go: http://www.stardot.org.uk/forums/viewto ... 57&t=14858.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

I did promise everyone a memory map of the game. RobC has prompted me to do this so here's a first attempt:

Code: Select all

-------- 
POP-BEEB MEMORY MAP
-------- 

-------- 
ZERO PAGE
-------- 
&0000 - &00FF: ZERO PAGE
-------- 
Zero page high watermark =  &A0 
Zero page free =  &0 
--------
Global variables &00 - &9F
Local variables &D0 - &DF
-------- 

-------- 
LOWER Workspace 
-------- 
&0300 - &0DFF: "Lower" RAM aka "Lang" (legacy name)
-------- 
Lower workspace high watermark =  &CF8 
Lower workspace RAM free =  &8 
-------- 
General run-time buffers
E.g. image lists, collision buffers, moveable object tables, global variables (not ZP)
--------
&0C00 - &0CFF: Lower data loaded from file "$.Lower" at boot
Contains filenames, sfx lookup table, crash message text, version number at &CF0
-------- 

-------- 
CORE Modules 
-------- 
&0E00 - &2FFF: "Core" RAM
-------- 
BEEB BOOT size =  &1EC              ; System and game bootstrap
AUX JUMP TABLES size =  &81E        ; Jump tables for AUX (gameplay) functions
DISKSYS size =  &187                ; Disk system (file + sector load)
SWR size =  &6                      ; Sideways RAM routines
BEEB TEST size =  &0 
BEEB PLATFORM size =  &129          ; ULA palette, sprite palette routines
MASTER size =  &446                 ; attract mode, load data for levels or cutscenes
TOPCTRL size =  &77E                ; main game loop
AUDIO (LEGACY) size =  &1 
PUCRUNCH size =  &15B               ; decompress static screens etc. 
BEEB AUDIO size =  &106             ; Beeb audio module handling
HIRES size =  &1DC                  ; original Apple II screen plotting routines
BEEB PLOT FONT size =  &F6          ; font plot routines
BEEB PLOT FASTLAY size =  &13C      ; fast sprite plot routines
BEEB PLOT LAYRSAVE size =  &167     ; unrolled sprite "layrsave" routines
-------- 
Core code size =  &20E1 
Core data size =  &40 
Core high watermark =  &2F21 
Core RAM free =  &DF 
-------- 
Code entry is at &E00
BEEB BOOT section is trashed after boot completes and used as the Exomizer decompression buffer (for music player.)
Aux jump table transparently redirects function calls to appropriate Aux (gameplay) module in sideways RAM bank, preserving registers and ROM slot on entry and exit.
Fastlay sprite routines are byte aligned and have no clipping - used for background objects
Layrsave routines save the screen buffer beneath the character sprites into the "peel" buffer memory area
-------- 

-------- 
MAIN Modules 
-------- 
&3000 - &7FFF: "Main" RAM (also shadowed x2)
-------- 
BEEB PLOT size =  &360              ; character sprite plot routines
BEEB PLOT WIPE size =  &64          ; unrolled sprite wipe routines
BEEB PLOT LAY size =  &0 
BEEB PLOT PEEL size =  &125         ; unrolled sprite "peel" routines
-------- 
Main code size =  &4E9 
Main high watermark =  &34E9 
Peel buffer address = &3500
Peel buffer size = &C00
Screen buffer address =  &4100 
Screen buffer size =  &3F00 
Main RAM free =  &17 
--------
Character sprite plotting routines support per-pixel plotting with mirroring and per-byte clipping on all four sides
Sprite peel routines "peel" sprites pff the screen by writing previously saved ("layrsaved") data back
Screen is MODE 2 but at 160x200 resolution (24 character rows for game and 1 character row for the status line)
Entire Main RAM area is double-buffered using SHADOW RAM
--------

--------
ANDY RAM
-------- 
&8000 - &8FFF: "Andy" RAM
-------- 
AUDIO BANK 0 size =  &D6B           ; title screen music
AUDIO BANK 0 free =  &295 
AUDIO BANK 3 size =  &F14           ; in-game musical ditties
AUDIO BANK 3 free =  &EC 
AUDIO BANK 4 size =  &B09           ; in-game cutscene music
AUDIO BANK 4 free =  &4F7 
-------- 
Audio banks are overlaid as required by master.asm module
-------- 

-------- 
SIDEWAYS RAM BANK 0 
-------- 
&8000 - &BFFF: "Bank 0" (ROM slot 4)
-------- 
BGTABLE 1A size =  &171D            ; background sprites set 1A (Palace or Dungeon)
BGTABLE 2 size =  &1223             ; background sprites set 2
CHTABLE 4 size =  &14C1             ; enemy character sprites (Guards)
-------- 
BANK 0 size =  &3FC1 
BANK 0 free =  &3F 
-------- 

-------- 
SIDEWAYS RAM BANK 1
-------- 
&8000 - &BFFF: "Bank 1" (ROM slot 5)
-------- 
BGTABLE 1B size =  &7D8             ; background sprites set 1B
CHTABLE 1 size =  &129E             ; player sprites set 1
CHTABLE 2 size =  &1283             ; player sprites set 2
CHTABLE 3 size =  &E1A              ; player sprites set 3
AUDIO SFX size =  &3A2              ; sound effects
-------- 
BANK 1 size =  &3FA2 
BANK 1 free =  &5E 
-------- 

-------- 
SIDEWAYS RAM BANK 2
-------- 
&8000 - &BFFF: "Bank 2" (ROM slot 6) aka "AUX B" gameplay modules
-------- 
SEQTABLE size =  &9F1               ; animation sequence data
FRAMEDEFS size =  &7B7              ; animation frame data
CTRLSUBS size =  &86F               ; sub-routines for controling characters
COLL size =  &736                   ; collision detection routines
AUTO size =  &A4E                   ; AI / enemy character auto control
INVERTY size =  &DF                 ; code to invert all plot routines in Y axis
BEEB MASTER size =  &4B             ; Beeb specific functions for attract sequence
-------- 
Aux B code+data size =  &2CC5 
Aux B high watermark =  &BFC5 
-------- 
BANK 2 size =  &3FC5 
BANK 2 free =  &3B 
-------- 

-------- 
SIDEWAYS RAM BANK 3
-------- 
&8000 - &BFFF: "Bank 3" (ROM slot 7) aka "AUX High" gameplay modules
-------- 
CTRL size =  &B4C                   ; character control routines
FRAMEADV size =  &B41               ; render a single gameplay frame into image lists
GAMEBG size =  &507                 ; functions to plot specific game objects
GRAFIX size =  &40E                 ; plot sprites from image lists onto screen
SUBS size =  &868                   ; general sub-routines including cutscene
MOVER size =  &A60                  ; moveable object routines
MISC size =  &3EE                   ; misc routines including energy meters
SPECIALK size =  &5E2               ; keyboard handling
BEEB SCREEN size =  &89             ; Beeb specific screen functions
ATTRACT size =  &20F                ; entire attract sequence
-------- 
Aux High code size =  &3ED2 
Aux High high watermark =  &BED2 
-------- 
BANK 3 size =  &3ED2 
BANK 3 free =  &12E 
-------- 

-------- 
HAZEL Modules 
-------- 
&C300 - &DEFF: "Hazel" RAM
-------- 
BLUEPRINT size = &900               ; level data loaded from disc
TABLES size =  &57C                 ; multiplication tables
BGDATA size =  &1EB                 ; data tables related to background sprite pieces
HRTABLES size =  &190               ; lookup tables for sprite plot
BEEB PALETTE DATA size =  &4C1      ; unrolled palette tables for fast sprite plot
EXO size =  &134                    ; Exomizer decompressor
VGMPLAYER size =  &132              ; VGM music player module
FONT size =  &1CA                   ; font data
-------- 
HAZEL data size =  &F00 
HAZEL code size =  &2FC 
HAZEL BSS (blueprint) size =  &900 
HAZEL high watermark =  &DEFC 
HAZEL RAM free =  &4 
-------- 

-------- 
CUTSCENE OVERLAYS
--------
CHTABLE 6 size =  &3E0A             ; cutscene sprites (4bpp) level 2+
CHTABLE 7 size =  &8EB              ; cutscene sprites (4bpp) attract only
CHTABLE 8 size =  &1B9E             ; cutscene sprites (4bpp) attract + level 1-2
CHTABLE 9 size =  &2B0F             ; cutscene sprites (4bpp) attract only
AUDIO BANK 1 size =  &128C          ; story cutscene music
AUDIO BANK 2 size =  &2B48          ; epilog cutscene music
--------
CHTABLE 6 or 8 are loaded into BANK 0 (ROM slot 4) between gameplay levels, displacing background sprite sets
CHTABLE 9 is loaded into BANK 1 (ROM slot 5) during attract cutscene only, diplacing background and player sprite sets
CHTABLE 7 and AUDIO BANK 1 are loaded into BANK 0 (ROM slot 4) during attract sequence only
AUDIO BANK 2 is loaded into BANK 0 (ROM slot 4) before the final epilog cutscene
--------
Also attached as a text file for convenience. I will check this in to the GitHub repo when I get chance.
Attachments
pop-beeb-memory-map.txt
POP BEEB memory map
(7.87 KiB) Downloaded 128 times
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
RobC
Posts: 3816
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Going great guns on a Prince of Persia port...

Post by RobC »

Thanks Kieran - that's awesome.
User avatar
polluks
Posts: 8
Joined: Fri Jul 03, 2015 10:44 pm
Location: Germany
Contact:

Re: Going great guns on a Prince of Persia port...

Post by polluks »

Hi!
Is a Electron with 128Kb SWR also supported?

Greetings,
Stefan
Acorn Electron
Oric Atmos (out of order)
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

polluks wrote: Thu Jan 24, 2019 5:32 pm Hi!
Is a Electron with 128Kb SWR also supported?

Greetings,
Stefan
Hi Stefan - unfortunately not. This is for the BBC Master only as it relies on the additional memory and features available on that machine outside of just the SWRAM space. I hope you can enjoy it on an emulator if you don't have a real machine.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Going great guns on a Prince of Persia port...

Post by tricky »

Has anyone got this working on a compact?
I failed with dfs and a gotek as it stops after the initial intro.
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

tricky wrote: Fri Jan 25, 2019 1:06 pm Has anyone got this working on a compact?
I failed with dfs and a gotek as it stops after the initial intro.
Sorry, it's a known issue or perhaps one of several with MOS 3.5 / Compact. I never got round to finding / fixing it last year as was a bit burnt out on POP by the time it was released. I'll take a look when I get chance.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
BobuS
Posts: 5
Joined: Fri Sep 25, 2020 8:51 pm
Contact:

Re: Going great guns on a Prince of Persia port...

Post by BobuS »

I am wondering: Since BBC B+128 also has 4x16Kb of Sideways RAM and 20Kb of Shadow RAM (which makes him "almost Master") is it possible to port PoP on BBC B+128? From my point of view, that is almost the same amount and same organisation of Memory.
Or am I wrong?
"Unfortunately, no one can be told what the Matrix is. You have to see it for yourself."
Morpheus/2199A.D.
User avatar
danielj
Posts: 9900
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: Going great guns on a Prince of Persia port...

Post by danielj »

Someone with more detailed knowledge will probably jump in, but I think PoP relies on the fact that in the Master you can write to the shadow screen memory even if it's not being displayed, whereas on the B+ you can only write to it if it's selected for display. That's the main difference between them with the shadow memory implementation.
cmorley
Posts: 1867
Joined: Sat Jul 30, 2016 8:11 pm
Location: Oxford
Contact:

Re: Going great guns on a Prince of Persia port...

Post by cmorley »

You'd have to bin the double buffering on the screen which would make it flicker. You'd also have to remove all the 65C12 instructions Kieran will have used on the Master like PHX,PLX,STZ. As this would bloat code it might be a tricky job as you'd likely get branch targets exceeding the range and a whole host of knock ons as code spills. No Hazel on a B+ so you'd have to magic up something there :|

Not impossible but it would need a B+ port rather than a simple tweek.
User avatar
kieranhj
Posts: 1103
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Going great guns on a Prince of Persia port...

Post by kieranhj »

Yes, for the reasons mentioned above it wouldn't be possible to make POP run as-is on a B+ model. The game absolutely requires double-buffering for the graphics (this is the way that the original Apple II drawing code is written) so the ability to display SHADOW RAM whilst displaying main RAM in MODE 2 is essential, and this is only possible on the Master.

On reflection, it might be theoretically possible to create a Model B(+) version (requiring at least 64K SWRAM, maybe one bank more) but this would have to be in MODE 5 or 4, either of which would be disappointingly less impressive that the original Apple II version (which runs at approximately MODE 1 resolution, albeit with artifact colour.) As most of the graphics were already stored 2bpp compressed, in theory this would "just" be a rewrite of the sprite and tile plot routines for MODE 5, but often with such endeavours, once you start pulling on a thread there's bound to be a lot of gnarly things attached to the other end of it. :mrgreen: It would undoubtedly have an extremely high frame rate mind! :lol:

The source code is all on GitHub should anyone feel sufficiently motivated to give it a crack. I warn you there is lots of it though (40,000+ lines...)
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Going great guns on a Prince of Persia port...

Post by tricky »

kieranhj wrote: Fri Jan 25, 2019 2:06 pm
tricky wrote: Fri Jan 25, 2019 1:06 pm Has anyone got this working on a compact?
I failed with dfs and a gotek as it stops after the initial intro.
Sorry, it's a known issue or perhaps one of several with MOS 3.5 / Compact. I never got round to finding / fixing it last year as was a bit burnt out on POP by the time it was released. I'll take a look when I get chance.
The Compact compatible version is in this post viewtopic.php?p=278962#p278962 as a .SSD
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Going great guns on a Prince of Persia port...

Post by tricky »

Did a nula version ever happen, or even a replacement palette?
bob147
Posts: 340
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Going great guns on a Prince of Persia port...

Post by bob147 »

Wasn't there something funky about the engine that made nula non trivial? I'm not aware of any existing nula version at least.
Post Reply

Return to “new projects in development: games”