That is a real eye opener into some the issues involved in writing assembly for the PDP-8 and how they can be solved. Good work!
As for me, I've always wanted to write small programs in FORTRAN on a DEC minicomputer, a much easier task.
There's several JMPs around data that aren't necessary. Move the data so those aren't required.
/ELEKMAN'S THEOREM: GIVEN 129 WORDS OF PDP-8 CODE, THE 129 WORDS CAN /BE OPTOMIZED TO 128 WORDS. /COROLLARY: THE TIME REQUIRED TO APPLY ELEKMAN'S THEOREM INCREASES /EXPONENTIALLY WITH THE NUMBER OF APPLICATIONS OF THE THEOREM TO A GIVEN PAGE.
--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+unsubscribe@googlegroups.com.
To post to this group, send email to pid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-8/b785717c-a82a-4117-b2d4-b3510f93567a%40googlegroups.com.
Doing this in FORTRAN would probably take up less than a "page" as long as you only include the generated FPP instructions.
If you include the runtime and FPP emulator, then that's going to take up at least 8k.
For assembler, attached is a version that fits on a single page. There's a whole location free. :)
current page literal capacity exceeded at Loc = 00374
Let me be VERY clear: the original code is an impressive job for someone just getting started on PDP-8 assembler.
There's several JMPs around data that aren't necessary.
Nit: You define a "TCA" Pseudo-op. That's not needed, there's already a "CIA" (complement and increment AC) that does the same thing. Threw me for a minute.
Repeated use of "TSF; JMP .-1; TLS; CLA" - so I made it a routine.
TAD (3) - not needed. Replace with CLA CLL CML RAL IAC. Yeah, really. :)
Several cases of SNA followed by CLR which can be replaced with SNA CLA so the extra CLA is avoided.
Incrementing a variable in memory - don't use "CLA; TAD thing; IAC; DCA thing" - either do "CLA IAC; TAD thing; DCA thing; or, use "ISZ thing" when the skip isn't going to happen.
/ELEKMAN'S THEOREM: GIVEN 129 WORDS OF PDP-8 CODE, THE 129 WORDS CAN/BE OPTOMIZED TO 128 WORDS. /COROLLARY: THE TIME REQUIRED TO APPLY ELEKMAN'S THEOREM INCREASES /EXPONENTIALLY WITH THE NUMBER OF APPLICATIONS OF THE THEOREM TO A GIVEN PAGE.
Oh, yeah - use of page zero literals would help, but that would be cheating.
Doing this in FORTRAN would probably take up less than a "page" as long as you only include the generated FPP instructions.(I say "page" as the FPP code doesn't have pages and uses 15 bit addresses). But let's use the 128-word definition of a page.If you include the runtime and FPP emulator, then that's going to take up at least 8k.For assembler, attached is a version that fits on a single page. There's a whole location free. :)Let me be VERY clear: the original code is an impressive job for someone just getting started on PDP-8 assembler. I've been doing this for what seems like a lifetime (it has been!) and I did this - another day of fizzbuzz lost. :)Getting down to one page:There's several JMPs around data that aren't necessary. Move the data so those aren't required.Nit: You define a "TCA" Pseudo-op. That's not needed, there's already a "CIA" (complement and increment AC) that does the same thing. Threw me for a minute.Repeated use of "TSF; JMP .-1; TLS; CLA" - so I made it a routine.
TAD (3) - not needed. Replace with CLA CLL CML RAL IAC. Yeah, really. :)Several cases of SNA followed by CLR which can be replaced with SNA CLA so the extra CLA is avoided.Incrementing a variable in memory - don't use "CLA; TAD thing; IAC; DCA thing" - either do "CLA IAC; TAD thing; DCA thing; or, use "ISZ thing" when the skip isn't going to happen.There's at least one other tweak that would bum another word or two. But perhaps this is getting to the brick wall. Quoting those who came before me:
/ELEKMAN'S THEOREM: GIVEN 129 WORDS OF PDP-8 CODE, THE 129 WORDS CAN /BE OPTOMIZED TO 128 WORDS. /COROLLARY: THE TIME REQUIRED TO APPLY ELEKMAN'S THEOREM INCREASES /EXPONENTIALLY WITH THE NUMBER OF APPLICATIONS OF THE THEOREM TO A GIVEN PAGE.(sic. *Optimized.)