Re: AGC restoration / was Re: PDP-8 signed overflow detection - Apollo guidace computer

2019-03-30 Thread Curious Marc via cctalk
Yes, that would be Carl’s “day to day” blog (http://rescue1130.blogspot.com/). 
He is also on the list, lurking in the background. Carl, are you there?
Ken Shirriff has also several deeply researched blog articles on specific AGC 
topics (righto.com).
Mike has some very interesting posts on his AGC FPGA emulation work here: 
http://mikestewart.hcoop.net/
Marc

> On Mar 26, 2019, at 10:43 AM, Brent Hilpert via cctalk 
>  wrote:
> 
> On 2019-Mar-26, at 9:28 AM, Noel Chiappa via cctalk wrote:
>>> From: Ben Bfranchuk
>> 
>>> Now they seem to have have found a SCRAPPED Apollo guidance
>>> computer and am rebuilding the missing pieces.
>> 
>> Wow. What a great site (and that guy has mad skills, everything from
>> repairing old Teletypes, through designing boards, to repairing analog
>> stuff). Just 'wasted' a good chunk of the morning reading back through
>> it; tons of really neat things (including recovery of the very first
>> FORTH, along with a lot of Diablo drive - from the Alto - repairs).
>> 
>> As a shortcut, here:
>> 
>> http://rescue1130.blogspot.com/2018/11/
>> 
>> is the backstory on the AGC; about 1/3 of the way down, in "Restoring an
>> Apollo Guidance Computer, part V".
> 
> 
> 
> This is the same AGC restoration that curious marc has been making videos 
> about:
> 
>https://www.youtube.com/watch?v=2KSahAoOLdU
> 
> The project and videos were mentioned on the list back in December.
> There's an interview with Jimmie there (4:13) with more details about the 
> backstory.
> 


AGC restoration / was Re: PDP-8 signed overflow detection - Apollo guidace computer

2019-03-26 Thread Brent Hilpert via cctalk
On 2019-Mar-26, at 9:28 AM, Noel Chiappa via cctalk wrote:
>> From: Ben Bfranchuk
> 
>> Now they seem to have have found a SCRAPPED Apollo guidance
>> computer and am rebuilding the missing pieces.
> 
> Wow. What a great site (and that guy has mad skills, everything from
> repairing old Teletypes, through designing boards, to repairing analog
> stuff). Just 'wasted' a good chunk of the morning reading back through
> it; tons of really neat things (including recovery of the very first
> FORTH, along with a lot of Diablo drive - from the Alto - repairs).
> 
> As a shortcut, here:
> 
>  http://rescue1130.blogspot.com/2018/11/
> 
> is the backstory on the AGC; about 1/3 of the way down, in "Restoring an
> Apollo Guidance Computer, part V".



This is the same AGC restoration that curious marc has been making videos about:

https://www.youtube.com/watch?v=2KSahAoOLdU

The project and videos were mentioned on the list back in December.
There's an interview with Jimmie there (4:13) with more details about the 
backstory.



Re: PDP-8 signed overflow detection - Apollo guidace computer

2019-03-26 Thread Noel Chiappa via cctalk
> From: Ben Bfranchuk

> Now they seem to have have found a SCRAPPED Apollo guidance
> computer and am rebuilding the missing pieces.

Wow. What a great site (and that guy has mad skills, everything from
repairing old Teletypes, through designing boards, to repairing analog
stuff). Just 'wasted' a good chunk of the morning reading back through
it; tons of really neat things (including recovery of the very first
FORTH, along with a lot of Diablo drive - from the Alto - repairs).

As a shortcut, here:

  http://rescue1130.blogspot.com/2018/11/

is the backstory on the AGC; about 1/3 of the way down, in "Restoring an
Apollo Guidance Computer, part V".

Noel


Re: PDP-8 signed overflow detection - Apollo guidace computer

2019-03-26 Thread ben via cctalk

On 3/25/2019 7:27 PM, Charles Dickman via cctalk wrote:

On Mon, Mar 25, 2019 at 1:26 AM Kyle Owen via cctalk 
wrote:



All this to fix a ~45 year old bug in Spacewar! where a ship's velocity
overflows, causing the ship to "bounce" off of nothing.

I would have figured it was bouncing off a chunk of dark matter.


Cool stuff! PDP-8 programming always seems a bit like puzzle solving.

Kyle


Some times the hardware is more fun than the software.
I got looking at a BLOG I had forgotten about.
First they planned on Emulating a IBM 1130
Later they found a real IBM 1130 in the middle of now where.
Now they seem to have have found a SCRAPPED Apollo guidance
computer and am rebuilding the missing pieces.

http://rescue1130.blogspot.com/
Ben.


Re: PDP-8 signed overflow detection

2019-03-25 Thread Charles Dickman via cctalk
On Mon, Mar 25, 2019 at 1:26 AM Kyle Owen via cctalk 
wrote:

>
> All this to fix a ~45 year old bug in Spacewar! where a ship's velocity
> overflows, causing the ship to "bounce" off of nothing.
>
> I would have figured it was bouncing off a chunk of dark matter.

Cool stuff! PDP-8 programming always seems a bit like puzzle solving.

Kyle
>


RE: PDP-8 signed overflow detection

2019-03-25 Thread mike via cctalk
Kyle and Vince, thanks for the education. Not sure I can use this right now,
but it is always helpful to see how others attack a problem. 

Mike Zahorik
(414) 254-6768
-Original Message-
From: cctalk [mailto:cctalk-boun...@classiccmp.org] On Behalf Of Kyle Owen
via cctalk
Sent: Monday, March 25, 2019 12:26 AM
To: General Discussion: On-Topic and Off-Topic Posts
Subject: Re: PDP-8 signed overflow detection

Overflow can be summarized in a few ways, such as: (sign of arg_a XOR sign
of arg_b == 0) AND (sign of arg XOR sign of result == 1)
or, less intuitively, the carry into the sign != the carry out of the sign.

My first inclination was to try the XOR approach, as that was most
intuitive to me. Using the "traditional" XOR macro on a PDP-8 is rather
inefficient, as you don't really care if you're XORing the rest of the
bits; only the sign bit. Since the sign bit is the high bit of the AC,
ignoring the link bit, simply adding the signs together results in an XOR
of the signs. However, you can't simply add the arguments, as you need to
ensure there are no carries into the sign bit; hence, ANDing one argument
with 04000 prevents any potential carries in.

I then realized that, when performing the addition with the link cleared,
the parity (i.e. XOR) of the link bit and the three sign bits will also
indicate overflow.

So, all this to say, here's my implementation:
/KYLE'S IMPLEMENTATION
SATADD, 0
CLA CLL
TAD ARGA
TAD ARGB
DCA SUM /NORMAL SUM
RAR /LINK TO SIGN BIT
TAD ARGA /SIGN OF LINK XOR SIGN OF ARGA
AND (4000
TAD ARGB /XOR SIGN OF ARGB
AND (4000
TAD SUM /XOR SIGN OF SUM
SMA CLA /OVERFLOW?
JMP NOPROB
TAD SUM /YES, GENERATE CORRECT CONSTANT
SPA CLA
CMA
TAD (4000
JMP I SATADD
NOPROB, TAD SUM /NO OVERFLOW, RETURN
JMP I SATADD
ARGA, 0
ARGB, 0
SUM, 0

Vince Slyngstad and I worked on this puzzle at VCF PNW this weekend quite a
bit, and I feel very compelled in declaring Vince the winner! Here's his
very elegant solution:
/
/ Saturation add
/
/ Add ARGA and ARGB, returning the sum in AC.  If integer overflow
/ occurs, return 3777 or 4000, depending on the sign,
/
SATADD, .-.
TAD ARGA / Get first operand
CLL RAL / Remember the sign
CLA / ...but not the magnitude
TAD ARGB / Get the second operand
SPA / Is it negative?
CML / Yes, add to sign(ARGA)
TAD ARGA / Add the rest of ARGA
SMA SNL / Link == sign == 0?
JMP I SATADD / Yes, we are done
TAD (4000 / Complement sign, also carry into L
SMA SNL / 00 => was 11
JMP RESTOR / No overflow, go restore sum and return
SMA CLA / Overflow.  Is the sum to be positive?
CMA / Yes, get -1
RESTOR, TAD (4000 / Form the correct result
JMP I SATADD / ...and return it
ARGA, .-.
ARGB, .-.

Vince's solution is 20 total locations; mine is 24. Excellent work, Vince!

All this to fix a ~45 year old bug in Spacewar! where a ship's velocity
overflows, causing the ship to "bounce" off of nothing.

Kyle



Re: PDP-8 signed overflow detection

2019-03-24 Thread Kyle Owen via cctalk
Overflow can be summarized in a few ways, such as: (sign of arg_a XOR sign
of arg_b == 0) AND (sign of arg XOR sign of result == 1)
or, less intuitively, the carry into the sign != the carry out of the sign.

My first inclination was to try the XOR approach, as that was most
intuitive to me. Using the "traditional" XOR macro on a PDP-8 is rather
inefficient, as you don't really care if you're XORing the rest of the
bits; only the sign bit. Since the sign bit is the high bit of the AC,
ignoring the link bit, simply adding the signs together results in an XOR
of the signs. However, you can't simply add the arguments, as you need to
ensure there are no carries into the sign bit; hence, ANDing one argument
with 04000 prevents any potential carries in.

I then realized that, when performing the addition with the link cleared,
the parity (i.e. XOR) of the link bit and the three sign bits will also
indicate overflow.

So, all this to say, here's my implementation:
/KYLE'S IMPLEMENTATION
SATADD, 0
CLA CLL
TAD ARGA
TAD ARGB
DCA SUM /NORMAL SUM
RAR /LINK TO SIGN BIT
TAD ARGA /SIGN OF LINK XOR SIGN OF ARGA
AND (4000
TAD ARGB /XOR SIGN OF ARGB
AND (4000
TAD SUM /XOR SIGN OF SUM
SMA CLA /OVERFLOW?
JMP NOPROB
TAD SUM /YES, GENERATE CORRECT CONSTANT
SPA CLA
CMA
TAD (4000
JMP I SATADD
NOPROB, TAD SUM /NO OVERFLOW, RETURN
JMP I SATADD
ARGA, 0
ARGB, 0
SUM, 0

Vince Slyngstad and I worked on this puzzle at VCF PNW this weekend quite a
bit, and I feel very compelled in declaring Vince the winner! Here's his
very elegant solution:
/
/ Saturation add
/
/ Add ARGA and ARGB, returning the sum in AC.  If integer overflow
/ occurs, return 3777 or 4000, depending on the sign,
/
SATADD, .-.
TAD ARGA / Get first operand
CLL RAL / Remember the sign
CLA / ...but not the magnitude
TAD ARGB / Get the second operand
SPA / Is it negative?
CML / Yes, add to sign(ARGA)
TAD ARGA / Add the rest of ARGA
SMA SNL / Link == sign == 0?
JMP I SATADD / Yes, we are done
TAD (4000 / Complement sign, also carry into L
SMA SNL / 00 => was 11
JMP RESTOR / No overflow, go restore sum and return
SMA CLA / Overflow.  Is the sum to be positive?
CMA / Yes, get -1
RESTOR, TAD (4000 / Form the correct result
JMP I SATADD / ...and return it
ARGA, .-.
ARGB, .-.

Vince's solution is 20 total locations; mine is 24. Excellent work, Vince!

All this to fix a ~45 year old bug in Spacewar! where a ship's velocity
overflows, causing the ship to "bounce" off of nothing.

Kyle


Re: PDP-8 signed overflow detection

2019-03-21 Thread Pontus Pihlgren via cctalk
I thought about it during the bus ride home. I don't 
think I got it right. I'll try again after the kids 
go to bed.

/P

On Thu, Mar 21, 2019 at 04:37:26PM +0100, Pontus Pihlgren via cctalk wrote:
> Hmm, sounds like a fun thing to figure out. How about this for a start. 
> Naive, written five minutes before I have to catch my bus, untested.
> 
> I hope I understood the problem at least :)
> 
> /P
> 
> SATSUM,0
>CLA CLL
>TAD I SATSUM
>ISZ SATSUM
>TAD I SATSUM
>ISZ SATSUM
>SNL
>JMP I SATSUM
>AND (4000)
>SZA
>TAD (3777)
>JMP I SATSUM
> 
> On Thu, Mar 21, 2019 at 12:26:37AM -0700, Kyle Owen via cctalk wrote:
> > What is the shortest subroutine on a PDP-8 which will add two variables in
> > RAM and return the saturated sum (that is, returning 2047 or -2048 upon
> > overflow, otherwise the sum) in the accumulator?
> > 
> > Kyle


Re: PDP-8 signed overflow detection

2019-03-21 Thread Pontus Pihlgren via cctalk
Hmm, sounds like a fun thing to figure out. How about this for a start. 
Naive, written five minutes before I have to catch my bus, untested.

I hope I understood the problem at least :)

/P

SATSUM,0
   CLA CLL
   TAD I SATSUM
   ISZ SATSUM
   TAD I SATSUM
   ISZ SATSUM
   SNL
   JMP I SATSUM
   AND (4000)
   SZA
   TAD (3777)
   JMP I SATSUM

On Thu, Mar 21, 2019 at 12:26:37AM -0700, Kyle Owen via cctalk wrote:
> What is the shortest subroutine on a PDP-8 which will add two variables in
> RAM and return the saturated sum (that is, returning 2047 or -2048 upon
> overflow, otherwise the sum) in the accumulator?
> 
> Kyle


PDP-8 signed overflow detection

2019-03-21 Thread Kyle Owen via cctalk
What is the shortest subroutine on a PDP-8 which will add two variables in
RAM and return the saturated sum (that is, returning 2047 or -2048 upon
overflow, otherwise the sum) in the accumulator?

Kyle