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

Got a programming project in mind? Tell everyone about it!
User avatar
tricky
Posts: 2109
Joined: Tue Jun 21, 2011 8:25 am
Contact:

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

Postby tricky » Thu Feb 01, 2018 6:56 pm

Kieran, I'm not trying to distract you, but as an owner of a B+ 128 (my favourite beeb after my original) I can't help but point out that depending on what you are doing with the shadow copy of the screen, you can display one while updating the other (but not vice-versa).
If I am reading the B+ service manual correctly, code in the last 4K of the 12K of RAM that overlaps sideways ROM accesses main RAM while in shadow mode, so a memcpy loop crossing &A000 should work!
Figure 5 RAM access in normal and shadow modes
In normal mode the RAM can be thought of as 44K from address &0000-&AFFF. The top 12K of this RAM from address &8000-&AFFF is paged into the memory map when required in place of the bottom 12K of the sideways ROM space, see 5.4.2. The remaining 20K of RAM is set aside for the shadow screen memory, while it always exists, it is not available to the system in normal mode. The bank of 44K RAM we shall call "normal RAM". In normal mode, VDUSEL (IC36 pin 17) is always zero.
Any code executing anywhere within normal RAM in normal mode will always access normal RAM, it cannot access shadow RAM.

In shadow mode the RAM can be thought of as 44K from address &0000-&AFFF, plus a parallel bank of 20K RAM from address &3000-&7FFF which we shall call "shadow RAM". As in normal mode, the top 12K of normal RAM is paged into the memory when required. In the address range &3000-&7FFF the PAL (IC36) is able to switch between shadow RAM and normal RAM. It selects access to the shadow memory if a) shadow mode is on b) it detects a VDU driver and c) the operand address is between &3000 and &7FFF, the part of the memory map used by the screen. Otherwise it selects access to normal RAM. The machines logic is set to shadow mode when logic 1 is written to D7 at address &FE34, this causes pin 17 (VDUSEL) to go high. &FE34 is the address of a register in the PAL and when D7 is set any screen access through the VDU drivers will cause the PAL to switch in the shadow memory by making pin 12 (CPUSEL) high. In shadow mode, VDUSEL is always set, and CPUSEL is low to access normal RAM and high to access shadow RAM.
When the paged RAM is selected in shadow mode, the top 4K, &A000 to &AFFF, is programmed by the PAL (IC36) to have the attributes of VDU drivers.
Any code executing between &0000-&9FFF in shadow mode will always access normal RAM.
Any code executing from sideways RAM between &A000-&AFFF will access the shadow RAN (if selected) when the operand address is between &3000-&7FFF. This special attribute is not available to any other sideways memory, ROM or RAM.

I must admit that I didn't even try this for AstroBlaster samples as it made my head hurt and hay it already had SWRAM.
Anyway, I just wanted it out there, I'm not suggesting you do it, not even as a stretch goal!

User avatar
Matt Godbolt
Posts: 176
Joined: Mon Jul 31, 2006 10:02 am
Location: Chicago
Contact:

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

Postby Matt Godbolt » Thu Feb 01, 2018 7:09 pm

lurkio wrote:
Matt Godbolt wrote:Cripes mate that looks fantastic!
kieranhj wrote:The Master version needs ...

-- although if Matt were to find the time to implement it, it would benefit another recent game, White Light, too. (Hint, hint!)

:?:


Hahah hint taken. I'm actually working on jsbeeb at the moment, to add support for serial stuff and touchscreens. I'll be sure to make writable discs too. I have some ideas about this feature too...

User avatar
kieranhj
Posts: 561
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

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

Postby kieranhj » Thu Feb 01, 2018 8:17 pm

tricky wrote:I must admit that I didn't even try this for AstroBlaster samples as it made my head hurt and hay it already had SWRAM.
Anyway, I just wanted it out there, I'm not suggesting you do it, not even as a stretch goal!

Yes, trying to read that also made my head hurt! If it’s a case of slightly rejigging the memory map and tweaking the addresses used for paging then I’ll add it to the list but going to come after the vanilla Master and NULA versions!

I may be using a couple of 65C102 opcodes but I don’t think they are critical.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
trixster
Posts: 539
Joined: Wed May 06, 2015 11:45 am
Location: York
Contact:

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

Postby trixster » Thu Feb 01, 2018 8:55 pm

Whilst we're making requests, how about BBC Bs with lots of swram AND shadow ram? Mine has got a WE ram card so there's 20k shadow to play with!
A3020 | A3000 | A420/1 | BBC B + 128K RAM/ROM + 20K Shadow + Pi0 + VideoNuLA
Master Turbo + DC + BeebSID | Atom | A4000 060 | A3000 060 | A1200 060 | A500
Atari Falcon 060 | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar

User avatar
tricky
Posts: 2109
Joined: Tue Jun 21, 2011 8:25 am
Contact:

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

Postby tricky » Thu Feb 01, 2018 10:02 pm

I wouldn't say the B+ shadow ram is just a matter of rejigging the memory map as I think although you could siplay one screen while building the other, then I think you would have to copied the changed bits back, but maybe its not that bad!

WE Shadow RAM won't sole the double buffering the screen problem, just give you more RAM.

User avatar
daveejhitchins
Posts: 3868
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

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

Postby daveejhitchins » Fri Feb 02, 2018 7:29 am

Just like to 'chip-in' here and really ask a question that I already know the answer to - but what the Hell!

How about an Electron with Turbo, shadow RAM and AP6 with lots RAM (extra 112K!) - could also add 2 x ABR giving a total of 176K of sideways RAM :D :roll:

Always worth a punt . . . :oops:

Dave H :lol:
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

User avatar
sbadger
Posts: 243
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey
Contact:

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

Postby sbadger » Fri Feb 02, 2018 1:36 pm

Lovely Stuff Kieran, or should I say, Prince of Paddington!



:-D
A3020| A3000x3| BBCBx5 | Electrn | Masterx4 |RiscPC| RPix3
A600 | C64 bbin x2|C64C | Toastrackx2 |QL | XB360&1X |GB |GBC |GBA |GBASP | DS | 3DS XL x2| MD | MS
Atari 7600 | PS1-2-3-4| PSP |Vita |SNES|GC|N64|Wii & U |Switch|ArcadeCab |Sony PVMx2

SteveF
Posts: 462
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

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

Postby SteveF » Fri Feb 02, 2018 9:54 pm

tricky wrote:If I am reading the B+ service manual correctly, code in the last 4K of the 12K of RAM that overlaps sideways ROM accesses main RAM while in shadow mode, so a memcpy loop crossing &A000 should work!

I might be misunderstanding what you're saying, but I wrote a test program to investigate the behaviour of this on real hardware and some people kindly ran it - have a look at the thread starting at http://www.stardot.org.uk/forums/viewto ... 87#p158387 Following on from that, my understanding is that code in the last 4K of the private 12K of RAM always accesses the displayed screen RAM, be that shadow or main RAM.

User avatar
kieranhj
Posts: 561
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

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

Postby kieranhj » Fri Feb 02, 2018 10:17 pm

I think I can safely discount the possibility of a B+ version at this point. And as for your ultra-pimped Electron... :lol:
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
daveejhitchins
Posts: 3868
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

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

Postby daveejhitchins » Sat Feb 03, 2018 5:19 am

kieranhj wrote:And as for your ultra-pimped Electron... :lol:
:(

Dave H :lol:
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

User avatar
kieranhj
Posts: 561
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

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

Postby kieranhj » Sat Feb 03, 2018 1:26 pm

daveejhitchins wrote::(

I’m not at all familiar with Electron hardware add-ons (despite it being my first computer - just a bit too young!)

On the positive side all the source to POP Beeb is in GitHub and built from a single BeebAsm master asm file. The code is structured across about 20 reasonably well defined modules and I will publish the final memory map when complete. So if anyone would like to port to their own more exotic Acorn configuration (Atom, Electron, B+) then I would be happy to provide guidance on where to find the various hooks for ram banking, shadow, disc access etc.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
danielj
Posts: 5609
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

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

Postby danielj » Sat Feb 03, 2018 1:30 pm

kieranhj wrote:
daveejhitchins wrote::(

I’m not at all familiar with Electron hardware add-ons (despite it being my first computer - just a bit too young!)


I think you'll come a cropper, as shadow ram can't be paged in/out - it's either or or off, and AFAIK you can't write directly to it, you have to go via the OS routines... *this could be incorrect!

d.

User avatar
daveejhitchins
Posts: 3868
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

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

Postby daveejhitchins » Sat Feb 03, 2018 4:09 pm

danielj wrote:I think you'll come a cropper, as shadow ram can't be paged in/out - it's either or or off, and AFAIK you can't write directly to it, you have to go via the OS routines... *this could be incorrect!
- - - AND!

Dave H :lol: :lol:
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

RobC
Posts: 1939
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

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

Postby RobC » Mon Feb 05, 2018 1:34 pm

Depending on the amount of actual RAM needed, I wonder whether the Mega Games Cartridge could be used as a large data store with 16KBs of data paged in as required?

crj
Posts: 545
Joined: Thu May 02, 2013 4:58 pm
Contact:

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

Postby crj » Mon Feb 05, 2018 2:33 pm

Terrifyingly, I realise that with modern hardware the limitation that the video subsystem always reads from main RAM needn't be an issue.

Suppose you'd attached enough RAM directly to a BBC B's CPU that it could happily emulate a BBC Master and more. That would leave the CPU's time on the main bus largely idle, apart from screen writes and memory-mapped I/O. The back of an envelope suggests some hardware trickery could react to a bank switch by blitting a different bank of screen memory into physical RAM quickly enough that it would keep ahead of the CRTC!

So nowadays, it's possible to make a shadow RAM system that supports bank switching without interfering at all with the video circuitry. Ulp!

paulb
Posts: 800
Joined: Mon Jan 20, 2014 9:02 pm
Contact:

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

Postby paulb » Mon Feb 05, 2018 3:39 pm

RobC wrote:Depending on the amount of actual RAM needed, I wonder whether the Mega Games Cartridge could be used as a large data store with 16KBs of data paged in as required?


Some kind of adjustable/scrolling window in the 16K sideways RAM/ROM region was done by various filing systems, and I did wonder whether Dave H might try and provide that with the MGC at some point. I did consider doing this with discrete logic, but you need quite a few ICs to make it work nicely, and the MGC has programmable logic, of course.

Another benefit of such a mechanism is the ability to access faster memory than the system RAM, although the 6502 instruction set really does favour zero page usage, thus limiting such benefits. And the screen accesses are still a bottleneck, too.

User avatar
daveejhitchins
Posts: 3868
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

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

Postby daveejhitchins » Mon Feb 05, 2018 7:39 pm

RobC wrote:Depending on the amount of actual RAM needed, I wonder whether the Mega Games Cartridge could be used as a large data store with 16KBs of data paged in as required?
The MK II will have just such a block available :D

Dave H :D
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

RobC
Posts: 1939
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

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

Postby RobC » Wed Feb 07, 2018 5:10 pm

daveejhitchins wrote:The MK II will have just such a block available :D

Sounds good. I was just wondering whether having lots of ROM available was good enough (as that's what the existing MGC provides)?

User avatar
Arcadian
Posts: 2890
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

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

Postby Arcadian » Thu Feb 22, 2018 7:21 am

kieranhj wrote:I will post a new level 1 WIP when I get chance, hopefully later today.

Hi, still planning a demo ver with dethmunk's marvy new gfx? Or have I somehow managed to miss it? :oops:
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug NORTH (Manchester) (19-21 January 2018)
ABug SOUTH (Hampshire) (1-3 June 2018)

User avatar
kieranhj
Posts: 561
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

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

Postby kieranhj » Thu Feb 22, 2018 2:05 pm

Arcadian wrote:
kieranhj wrote:I will post a new level 1 WIP when I get chance, hopefully later today.

Hi, still planning a demo ver with dethmunk's marvy new gfx? Or have I somehow managed to miss it? :oops:

Haha, I did promise that but then Dethmunk & I decided to keep you all in suspense for a bit longer whilst we got a further along with the graphics and Simon tinkered with the audio. I will endeavour to get a level 1 WIP demo released for the weekend in order to get feedback and compatibility testing with folks' real hardware setups etc. There are a couple of things I want to get sorted before then because these things tend to go wider than you expect!
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
Dethmunk
Posts: 170
Joined: Fri Jul 01, 2016 12:29 pm
Location: Guildford
Contact:

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

Postby Dethmunk » Sat Feb 24, 2018 1:55 pm

Can't wait for people to play the demo.... I'm enjoying working on this Kieran. Sure seems to be coming together well too. I'm neglecting my Nintendo Switch, TV and Movies for this... tsk dam you retro gaming love.... :-)
Here's me working on some pixel stuff. LOL.
Pixels blurred to protect the innocent. ha ha. #sneakpeak

Image
Image


Who is online

Users browsing this forum: Dethmunk and 1 guest