[stella] Uses for PHP

Subject: [stella] Uses for PHP
From: jimn8@xxxxxxxxxx (Jim Nitchals)
Date: Wed, 9 Apr 1997 05:50:47 -0700 (PDT)
Piero write:
> Uh, maybe the correct question was: had the _6502_ designers that trick in
> mind? Afer all, what's the use of PHP if not for tricks like that?! (BTW,
> how many years before the 2600 was the 6502 designed?)

I believe it was designed in 1974 and shipping either then or 1975.

PHP is most commonly used in interrupt routines (which the 2600 doesn't
have, obviously) to save and restore the status of the CPU flags.

Operating systems find it useful to use PHP to create universally useful
procedures that don't mess with the CPU status any more than necessary.

BopBuggy.asm from Party Mix for the Supercharger uses it to do a test,
but save code by loading some registers before branching:

MANOUV 	LDA PUSHMI,X
	PHP
	LDA WHICHWHEELY,X
	LDY WHEELYNUM,X
	PLP
	BEQ MANUV2

And last, if you need to delay for 7 cycles, a PHP/PLP is a code-compact
way to do it.

Given COMBAT's twiddling of that port's unused bit (that I'm back to being
sure is for a console LED), it's entirely possible they built the missile
enable bit that way deliberately.  The inner loops of COMBAT are sloppy
speed-wise but very tight on code efficiency.  Without many bytes to spare
it was probably cheaper to do a last minute remask of the TIA than to
sacrifice game features or add ROM.


--
Archives available at http://www.biglist.com/lists/stella/archives/
E-mail UNSUBSCRIBE in the body to stella-request@xxxxxxxxxxx to be removed.

Current Thread