War Stories: How Prince of Persia slayed the Apple II’s memory limitations

cactusbush

Ars Scholae Palatinae
735
When I bought my Apple II the memory was sold separately. In 1978 I payed about $1,200 for the PC, 16k ram and tax combined, which was all I could afford on that day. (I wasn't born with a silver spoon in my nose, but instead was on call 24 hours a day while working in the oilfields, offshore of Houston, TX).

The Apple II motherboard could only hold 48k RAM. A year or two later a “language card” (intended for CP/M language, expansion card holding memory) providing another 16k of ram came out (only 64k maximum total RAM was addressable by the system). It was cumbersome to address that extra memory from interpreted BASIC. Steve Wozniak wrote the first BASIC (called Integer BASIC) for the machine and later ROM chips could be purchased to install an improved floating point “Applesoft” BASIC (which was written by infant Microsoft).

At first the only way to install programs to memory or to save programming was by cassette tape interface - using analogue audio beeps or chirps that sounded like what a dial up phone modem would sound like a decade later. I purchased the Sargon I and a year later Sargon II chess program - both sold commercially in cassette tape form. Sargon was a remarkable program for the period – an assembly language program occupying 48k or less of physical RAM memory, but able to beat opposing chess programs (hosted on mainframe computers) in tournaments.

When 5.25” floppy disk drives for the APPLE II eventually arrived, they were also prohibitively expensive (costing perhaps $500 for one with controller card or $750 for two drives). Many of us simple folk just stuck with our cassette decks and TVs with RF modulators, for a long time (composite monitors were non existent to very rare) – and took up 6502 assembly language programming for light entertainment.

Down the road when the IBM PC came out, its motherboard would borrow heavily from the Apple II layout. The IBM's video output though - would be "de-WOZed", as the expression went.
 
Upvote
11 (11 / 0)
Post content hidden for low score. Show…

Aurich

Director of Many Things
41,148
Ars Staff
The fact that the author of the game had never heard of this trick tells us exactly how many video game he had played.
If you're not gonna watch the video, that's okay, but you might not want to scold people when it's clear you didn't and don't understand the context.
 
Upvote
32 (32 / 0)
Post content hidden for low score. Show…

Aurich

Director of Many Things
41,148
Ars Staff
what's my mistake in assuming thats all it was?
Your mistake is just that you assumed at all. Again, it's cool that you didn't watch, you're at work, it's fine. But you don't know the story, and kind of dunked on the guy like he was an idiot. Why do that if you haven't heard the story?

It's not so much a story of amazing technical achievement as it is a story about how limited resources lead to creative decisions. You edited your post to add more about how working around the memory barrier was no big deal, but again, without watching I think you're missing the point here.

I'm gonna leave it at that, I just found it a little irritating that you basically trash talked Jordan Mechner without even understanding the context of anything. Why do that? He doesn't deserve that scorn.

Better to either wait to comment after you've watched or not say something like that is my opinion.
 
Upvote
38 (38 / 0)

2TurnersNotEnough

Ars Centurion
369
Subscriptor++
If you're of a certain age — I won't say old, just seasoned — you probably have feels about this screenshot from the video. I know I do. I cut it off for just the top 10, but Wizardry is sitting at number 11. I definitely played most of these.

85-games-list.png

Nice to know that I’m “seasoned”. That list is pretty much the playlist of the end of high school/beginning of college period in my life
 
Upvote
7 (7 / 0)
Oooo, totally going to have to watch this when I have time and headphones on.

Mechner took advantage of some 6502 assembly instructions

Teh FEEEELS *shakes her head wistfully*

Honestly it's astonishing that this was coded overall for the 6502 in Basic and overall managed to be performant. I'm assuming it was compiled and not interpreted.

I remember being roughly 10 and struggling to get Applesoft Basic to run fast enough for writing a mouse based drawing program on the IIGS.

Not knowing any better at the time, nor having something like the internet (and having been moved to Italy so having to resort to asking relatives in the US to buy and mail books), and looking for ways to modify memory buffers faster, I ended up learning assembly using the built in assembler on the IIGS (not even macros like MASM!) and rewriting what I'd now call the hot path fully in assembly. I never really got the image editor working fully, but it was still fun times :p

/Has-a-quirky-idea-of-fun

Ahhh, youthful innocence!
 
Upvote
6 (7 / -1)

mvmiller12

Ars Scholae Palatinae
975
Subscriptor
One thing I think this series is sorely missing is a brief synopsis of "Where they are now" to explain what they're up to these days.

The people in these videos are the pioneers from the Golden Age of home computing - back when it was a fun and semi-exclusive hobby complete with it's own factions and before computers essentially became appliances. Seeing where these early pioneers went forward to from there would be fascinating against that backdrop. It would provide a real grounding to the story and it could easily be added to the text portion.
 
Upvote
9 (9 / 0)

The Bacon Baron

Seniorius Lurkius
21
Subscriptor
I'd heard about the way he rotoscoped his brother, and for years I've wanted to see the footage and hear about the process he used for these characters.

I've long understood the details of rotoscoping using purely analog or purely digital methods, but was so curious about doing in in the late 80's with an Apple II as the target. It was so great to hear the full details of that hybrid process, and to see some of the source materials!
 
Upvote
9 (9 / 0)

kj7bcf

Seniorius Lurkius
30
Subscriptor++
Loved Karateca, I played the last battle so many times to show family members and friends what happened when approaching the girl in "fight mode" instead of just running towards her...

Also thank you ArsTechnica for these terrific interviews to these Game Legends (i.e. this article and the recent one about Myst) -- so cool to learn what they did, how they did it, and the many technical challenges they went through...

Loved the XOR trick -- there used to be a joke (or license plate) decades ago about The XORcist ... So many great memories about 6502 assembly language (and Rodnay Zak's book about it), the Apple ][, "call -151", AppleVision, Beagle Bros small and fascinating code snippets, auto-proofreader, and so many, many more... wonderful times.
 
Upvote
11 (11 / 0)

Artemis3

Wise, Aged Ars Veteran
111
Loved Karateca, I played the last battle so many times to show family members and friends what happened when approaching the girl in "fight mode" instead of just running towards her...

You don't have to approach her in fighting stance, all you have to to is "doubt". Ie, rather than go running straight to her, if you pause a bit (joystick up) you'll see she lowers her hands, that's the signal... You can fix your mistake by going back the previous boss room and run back to her.

Also, the super funny joke never to be seen elsewhere i think? Insert the diskette upside down for an upside down experience, lol.
 
Upvote
4 (4 / 0)

J.King

Ars Praefectus
4,416
Subscriptor
I'd heard about the way he rotoscoped his brother, and for years I've wanted to see the footage and hear about the process he used for these characters.

I've long understood the details of rotoscoping using purely analog or purely digital methods, but was so curious about doing in in the late 80's with an Apple II as the target. It was so great to hear the full details of that hybrid process, and to see some of the source materials!
That was definitely the highlight of the video for me (not that the whole thing wasn't excellent). It still surprises me how fluid and lifelike most of the animations are, particularly the hang-swing.
 
Upvote
6 (6 / 0)

gavron

Ars Tribunus Militum
1,592
My first machine language (yes I don't mean assembly) was 6502... on the ATARI 400. I went from there to VAX (Yes, I do mean DEC VAX-11/780) and then Alpha/AXP. In the process assembly language took root ... because... sometimes you CAN take the easy way out.

PoP was a masterpiece not just in design but in how to fit A LOT in [no] memory. It is akin to the cartridges in the Atari 400/800 that were 16KB but swapped out the upper set of 8KB in banks. The VAX did virtual memory system (VMS). Years later the guy who helped develop that (Dave Cutler) would go to Microsoft to write WNT (The kernel used from W2K-W10) and Microsoft would pay DEC a F'lot.

Point is. There were lots of tricks used to get sprites, memory, maps, and characters to exist when your overall memory was 8Kbytes to 48Kbytes. 64 and higher was a rarity. To shift a character bitmap to get an antagonist out of a protagonist costs so little in RAM and processing it's not even a question of how but when.

Prince of Persia showed that if you can think outside the box you can accomplish a lot.

...and that was 40 years ago.

Now why can't we get to the moon today? ;)

E
 
Upvote
8 (8 / 0)

Danathar

Ars Praefectus
4,549
Subscriptor
As a commodore user and fan back in the 80's I had no idea how HARD it was to make games on 8 bit systems. The memory limitations affected EVERYTHING. Sure, the DOS systems had terrible graphics and sound compared to a C64 at the time (for the price) but as time went on, the memory problem was far easier on DOS systems than C64, Apple II, etc.

The 8 bit guy on youtube, made a miraculous real time strategy game explains in his making of video how he had to make really HARD choices about what he could do within the limitations on his C64 game.

https://www.youtube.com/watch?v=NB_VBl7ut9Y

Watch it and you will have a MUCH higher appreciation to how difficult it was to program back then.
 
Upvote
4 (4 / 0)

Jeff S

Ars Legatus Legionis
11,073
Subscriptor++
On the one hand, limitations, as we see in this piece, often serve as creative inspirations. I've heard of, for example, writers setting themselves challenges to write a paragraph or a page without using one specific letter anywhere, or maybe not more than twice, and other 'arbitrary' limits, to try to force some creativity.

And of course, characters in stories/games are often designed, as a starting point, with some character quirk or limitation that the writer/designer must work with (at least for awhile, until perhaps character development removes that limitation). Limitations also, for many games, start out as the starting point for game play, and player rewards/level up (lifiting those limitation in part or in full, either with a permanent level up 'skill' bonus, or with equipment, or with consumables like potions/food/magic crystals/scrolls/whatever).

BUT, a big part of the narrative of this story was the race against the end of life of the Apple II as a commercially viable platform with a large enough market to sell to.

He didn't want to start over, but I have to think that some developers/studios might look at that and say, well, maybe that's not so bad. Maybe I port this over to a new platform, and can make it way better.

Of course, that's way easier nowadays with portable high level languages, portable data formats, etc. He probably wanted to finish it on the Apple II because it was written almost entirely in Apple II assembly, using character art, music, etc that were represented in a format tightly tied to the video and audio hardware of that platform, etc.

And, he did eventually port it to other platforms. I bet getting Br0derbund to provide the financial backing to make those ports possible was a lot easier after he got the Apple II version out the door and published, and they were able to judge commercial appeal. Seeing that the game was successful on the dieing Apple II probably made it a no-brainer for the suits to finance the possibly much greater costs to port the game to the other platforms (greater costs, because not only would he have to re-write the game engine code, but also recreate all the assets in higher resolution and higher color, new music and sound effects - and with greater color, resolution, memory and better audio tech, comes greater expenses creating all those assets).
 
Upvote
2 (3 / -1)

pokrface

Senior Technology Editor
21,531
Ars Staff
BUT, a big part of the narrative of this story was the race against the end of life of the Apple II as a commercially viable platform with a large enough market to sell to.

He didn't want to start over, but I have to think that some developers/studios might look at that and say, well, maybe that's not so bad. Maybe I port this over to a new platform, and can make it way better.
Joel On Software has a pretty famous post on the pros and cons of redoing an entire project from scratch. It's kind of orthogonal to this discussion, but the stuff he discusses is definitely part of the calculus you have to do when deciding how to handle porting or migration.
 
Upvote
11 (11 / 0)
D

Deleted member 221201

Guest
Weirdly, the URL for this article talks about how Prince of Persia slew the Apple II's memory limitations, but the headline I see is about how it slayed them. If this is one of those A/B tests I keep hearing about, I vote for "slew", the standard past tense of "slay" in all senses but the comedic.
That was the ars edit desk disagreeing with my preferred past tense form of "slay." I've reverted it to "slew" in a petty display of my manager-powers. Respect mah authoritah etc etc

"Flay" would be the other option..

"Mind Flayer" .....might be taking it to 11

:D
 
Upvote
-2 (0 / -2)

Jeff S

Ars Legatus Legionis
11,073
Subscriptor++
BUT, a big part of the narrative of this story was the race against the end of life of the Apple II as a commercially viable platform with a large enough market to sell to.

He didn't want to start over, but I have to think that some developers/studios might look at that and say, well, maybe that's not so bad. Maybe I port this over to a new platform, and can make it way better.
Joel On Software has a pretty famous post on the pros and cons of redoing an entire project from scratch. It's kind of orthogonal to this discussion, but the stuff he discusses is definitely part of the calculus you have to do when deciding how to handle porting or migration.


That post is famous, yes. I remember reading it like 10 or 12 years ago. It makes some reasonable points. But I also wonder how well that post aged? I mean, it's built around the example of Netscape 6. Yeah, Netscape 6 took a few years to come out. . . and I may be wrong, but I think there's pretty good consensus that what came out the other end of that re-write was a MUCH better browser. . . more stable, faster, more portable, more standards compliant, more secure, and better able to be evolved by programmers in the future.

Yeah, it wasn't perfect, it had it's flaws, and much of it has again been rewritten over the years (although, after that big re-write, it seems Mozilla was able to adopt a more evolutionary approach, re-writing portions at a time, instead of the whole thing).

So, did Netscape really make a mistake by re-writing. I mean, maybe. . . they went from a profitable company, to a subsidiary of AOL, to a non-profit foundation, which maybe isn't the lifecycle that most corporate for-profit developers want for themselves. But, while it might not have been great for the corp, it seems to have been great for the product. What we ended up with has been a pretty darn good browser of the years (yes, it's been eclipsed by Chromium/Chrome, and may possibly be eclipsed by Brave). But, it's been a great piece of technology since that big re-write effort leading to 6.0.
 
Upvote
0 (1 / -1)

Voo42

Ars Praefectus
3,684
Subscriptor
So I admit that I'm way too young to have played this - what with it coming out the year before I was born - but I played The Sands of Time when it came out and it's still one of my favorite games (and some of the best writing in a game).

Watching the video I see lots of parallels between the two games, although I will say the way they introduce the enemy with the mirror and that you have to realize that you have to put your weapon away are brilliant ideas.

Not sure how well the game has aged (I tried Deus Ex a while ago again and I just couldn't go further than two hours in) and I just don't have much time for games these days, but I might have to see if I can get it to run on a modern PC somehow.
 
Upvote
2 (2 / 0)

Voo42

Ars Praefectus
3,684
Subscriptor
Upvote
3 (3 / 0)

Voo42

Ars Praefectus
3,684
Subscriptor
So, did Netscape really make a mistake by re-writing. I mean, maybe. . . they went from a profitable company, to a subsidiary of AOL, to a non-profit foundation, which maybe isn't the lifecycle that most corporate for-profit developers want for themselves. But, while it might not have been great for the corp, it seems to have been great for the product. What we ended up with has been a pretty darn good browser of the years (yes, it's been eclipsed by Chromium/Chrome, and may possibly be eclipsed by Brave). But, it's been a great piece of technology since that big re-write effort leading to 6.0.
The comparison shouldn't be "Is NetScape 6.0 better than 5.0?" but "Is NetScape 6.0 better than NetScape 5.0 would've been if they spent all those years iteratively improving it?". And I find it very hard to believe.

Honestly 6.0 was an awful mess and it took several more years for it to become stable and a good product.

Also very few products manage to survive the annihilation of their owning company. I wouldn't bet on that working for most other things.
 
Upvote
4 (4 / 0)

DidIKnowThat

Smack-Fu Master, in training
54
It wasn't until I redid the Ars logo in the Broderbund style for the opening that I realized the little graphic over the text was 3 crowns. I've been looking at that thing close to all my life and just never saw it until I had to deconstruct it to figure out what to replace it with. Funny how your brain does that.

ars-broderbund.png


I love PoP and Karateka, the latter of which I realized I have been grossly mispronouncing for 35 years
When I was a kid I had this karate-gi-like pair of pajamas that I would wear and pretend I was in Karateka. Which ... I was totally mispronouncing too lol.

The three crowns in the logo generally have been interpreted to refer to the three Carlston siblings: Doug, Gary, and Cathy. Doug and Gary founded the company and Cathy joined shortly after the founding. They are also a reference to the lesser coat of arms of Sweden (Gary once taught Swedish).
 
Upvote
4 (4 / 0)

elaintahra

Wise, Aged Ars Veteran
100
Wow, somehow I never knew PoP existed on the Apple II. I had only played the Mac version, though I definitely played Karateka on the Apple II a bunch. (My parents did not approve of such a violent game, so I had to play in secret.)

...publisher names like Sierra On Line and Broderbund...

Actually it was Br0derbund (with a zero).

No, it was Brøderbund with a Danish/Norwegian "ø".

"The "ø" in "brøderbund" was used partially as a play on the Norwegian/Danish letter ø but was mainly referencing the slashed zero found in mainframes, terminals and early personal computers." (wikipedia)
 
Upvote
1 (1 / 0)

ChrisSD

Ars Tribunus Angusticlavius
6,178
I'd also go to bat for PoP 2008. Well, to a certain extent. It's very different to the original or the Sands of Time games and it's definitely not the best game in the franchise. What it is is an absolutely beautiful platforming game. The acrobatics are exaggerated to absurdity but its a lot of fun chaining moves across walls, beams, trapezes, poles and even ceiling running a very short distance. If you ever thought "platforming in Prince of Persia is way too realistic" then this might be for you.

Unfortunately it does get repetitive after awhile and its not exactly a hard game. Also some of the writing and the (thankfully infrequent) combat aren't good so I wouldn't pay full price for it. But it's on sale right now so I think it's easily worth that price.
 
Upvote
1 (1 / 0)

Kurtz79

Wise, Aged Ars Veteran
188
When i was a kid, i played Prince of Persia fearing for my own skin, the animations where so realistic for the time i got seriously startled when the character dies.

I never got very far.

Same! I was terrified by the guillotine traps, I used to close my eyes when crossing them, as a kid.
 
Upvote
4 (5 / -1)

Kurtz79

Wise, Aged Ars Veteran
188
Ironically, I always thought the combat parts of Prince of Persia dragged a little — they're not irredeemable thanks to the skeletons, the battle with yourself, etc that throw in some variety, but they detract from the game proper.

Thankfully I primarily played the Sam Coupé version, where the guards are so dumb that you can just stand still repeatedly swiping your sword and they'll walk forwards into it.
It took 12-year-old-me a while to figure it out, but it turns out that combat in the original PoP is just a matter of alternating between pressing "ATTACK" and "BLOCK" at exactly the right tempo. Once you find the rhythm, you're more or less invulnerable.

The fluid "sword dance" in the original PoP was just amazing for the times. Funnily, I was reminded of it almost 30 years later when playing Sekiro.
 
Upvote
2 (3 / -1)
Wow, somehow I never knew PoP existed on the Apple II. I had only played the Mac version, though I definitely played Karateka on the Apple II a bunch. (My parents did not approve of such a violent game, so I had to play in secret.)

...publisher names like Sierra On Line and Broderbund...

Actually it was Br0derbund (with a zero).

No, it was Brøderbund with a Danish/Norwegian "ø".

"The "ø" in "brøderbund" was used partially as a play on the Norwegian/Danish letter ø but was mainly referencing the slashed zero found in mainframes, terminals and early personal computers." (wikipedia)

Yeah, I'm not sure what the intent was, but the Apple II's built-in ASCII character set definitely did not include any special Norwegian/Danish characters, so I always saw it written using a zero.

characters1_1.gif


The wikipedia article talks about a desire to not have the name confused with so-called "broderbund" organizations operating in South Africa.
 
Upvote
3 (4 / -1)