HP-35/45 Simulator for PDP-8
Vincent Slyngstad
v.slyngstad at frontier.com
Tue Sep 13 20:00:01 CDT 2016
From: Doug Ingraham: Tuesday, September 13, 2016 1:38 PM
> This struck me as a pretty clever bit of code. My first cut used 23 words
> including 2 masks and 3 temporaries.
Thanks!!
> This is the working version of Vince's original. It uses 18 words
> including 1 mask and 2 temporaries.
> I have done some edge testing and it appears to work.
>
> 30 / THIS VERSION BY VINCE SLYNGSTAD
> 31 00210 0000 BSWI, .-. /ENTRY POINT
> 32 00211 3175 DCA SAVEAC
> 33 00212 7420 SNL /REMEMBER LINK STATE
> 34 00213 7040 CMA /AS A -1 FOR ISZ TEST
> 35 00214 3176 DCA SAVEL
> 36 00215 7100 CLL /NEED THE LINK CLEARED
Ok, I just don't see why one should need to clear link here.
> 37 00216 1175 TAD SAVEAC /GET 0 XXX XXX YYY YYY
> 38 00217 0177 AND C7700 / 0 XXX XXX 000 000
These two lines, the comment would have "L" instead of their first "0".
> 39 00220 1175 TAD SAVEAC / X XXX XX0 YYY YYY
Poof! There goes the prior value of link! And the "0" in the comment
is correct.
> 40 00221 7006 RTL / X XXX 0YY YYY YXX
> 41 00222 7006 RTL / X X0Y YYY YYX XXX
> 42 00223 7006 RTL / 0 YYY YYY XXX XXX
> 43 00224 2176 ISZ SAVEL /WAS LINK SET?
> 44 00225 7020 CML /YES, RESTORE LINK
> 45 00226 5610 JMP I BSWI /RETURN
> 46 $
>
>
> As Klemens Krause points out you do need the CLL (line 36) somewhere before
> the second TAD SAVEAC or it will flip
> what was the original leftmost bit (AC 0).
Someone help me understand this claim.
> I have thought about this a bunch and have come up with an improved
> version. It also uses 18 words including 2 constants
> two temporaries. This is one less instruction executed.
>
> 32 00210 0000 BSWI, .-. /ENTRY POINT
> 33 00211 3174 DCA SAVEAC
> 34 00212 7430 SZL /REMEMBER LINK STATE
> 35 00213 1177 TAD C0100 /PRE ROTATE LINK POSITION
> 36 00214 3175 DCA SAVEL
> 37 00215 7100 CLL /NEED THE LINK CLEARED
> 38 00216 1174 TAD SAVEAC /GET 0 XXX XXX YYY YYY
> 39 00217 0176 AND C7700 / 0 XXX XXX 000 000
> 40 00220 1174 TAD SAVEAC / X XXX XX0 YYY YYY
> 41 00221 1175 TAD SAVEL / X XXX XXL YYY YYY
> 42 00222 7006 RTL / X XXX LYY YYY YXX
> 43 00223 7006 RTL / X XLY YYY YYX XXX
> 44 00224 7006 RTL / L YYY YYY XXX XXX
> 45 00225 5610 JMP I BSWI /RETURN
>
> Not bad but I realized even more was possible.
>
> 31 00210 0000 BSWI, .-. /ENTRY POINT
> 32 00211 3174 DCA SAVEAC
> 33 00212 7430 SZL /REMEMBER LINK STATE
> 34 00213 1176 TAD C0100 /PRE ROTATE LINK POSITION
> 35 00214 7100 CLL /NEED THE LINK CLEARED
> 36 00215 1174 TAD SAVEAC /GET 0 XXX XXX YYY YYY
> 37 00216 0175 AND C7700 / 0 XXX XXX 000 000
> 38 00217 1174 TAD SAVEAC / X XXX XX0 YYY YYY
> 39 00220 7006 RTL / X XXX LYY YYY YXX
> 40 00221 7006 RTL / X XLY YYY YYX XXX
> 41 00222 7006 RTL / L YYY YYY XXX XXX
> 42 00223 5610 JMP I BSWI /RETURN
Nice!
Vince
More information about the cctalk
mailing list