virtualagc / virtualagc

Virtual Apollo Guidance Computer (AGC) software
http://www.ibiblio.org/apollo
Other
2.69k stars 342 forks source link

yaAGCb1 can't pass Solarium 55's SELF-CHECK #1150

Closed thewonderidiot closed 5 months ago

thewonderidiot commented 3 years ago

@indy91 recently decided to try to get Apollo 4 and 6 working in NASSP, and has been integrating yaAGCb1 to run Solarium. Things have been going mostly well so far, except that IMU alignment on the launchpad is behaving a bit unexpectedly. He asked me to check the usual culprit, DV, to see if it was obviously misbehaving in any way. So I figured out how to start up SELF-CHECK, and sure enough, it's finding some errors. :smile:

The procedure to run Solarium's self-check is:

If a check fails, the middle register of N31 (SFAIL) will be updated to show that check's address in bank 11.

The errors I have encountered so far, and their fixes, are: SFAIL Test Cause
06171 SCCHK AD and INDEX aren't performing editing
06305 DVCHK LP should be set to 140000 if the numerator was positive, or 140001 if it was negative. Furthermore, an error in a constant caused all divisions with a negative numerator to get stuck at POSMAX/NEGMAX.
(lockup) RUPTCHK CCS and SU were not handling overflow correctly. Furthermore, TS A was not preserving the value of A if it had overflow.
6605 CYCLSHFT SL was shifting into bit 14. It should always be cleared to 0.
7321 DV4++ DV of equal-magnitude numbers should set A = POSMAX/NEGMAX (depending on sign) and Q = -abs(numerator)

With all of these changes, SELF-CHECK passes!

One thing that I noticed that I haven't fixed is that TIME3 is in-phase with TIME1 and TIME4, while it should be 5ms out of phase. Fixing this was not necessary to get SELF-CHECK to pass.

The fixes that I've made are in #1149.

rburkey2005 commented 5 months ago

@thewonderidiot @indy91 I guess I never even knew there was a self-check in SOLARIUM back then. If I did, I obviously never ran it. It's practically a miracle that any of this stuff functioned as well as it did before you guys came on the scene. [Shakes head sadly.] As usual, thanks. Great job!

Just the fact that there is a self-test at all, and info about running it, is something important that I need to write up. Did you find that documented somewhere, or was it just picking through the code?

thewonderidiot commented 5 months ago

That is a good question! To be clear nothing has changed on this since we did this work 3 years ago (!) -- I was just looking through our open issues this morning and noticed this one never got closed. I think I worked it out picking through the code, but I'll see if I can dig up a document that properly says how to do it.

rburkey2005 commented 5 months ago

Thanks for the clarification; I hadn't actually noticed the dates. But as you say, I still think the question's a good one.

rburkey2005 commented 5 months ago

Or dumb! I realize now that this issue is from before SUNRISE was available. If you had had SUNRISE back then, you would have been using SUNRISE tests rather than SOLARIUM tests.

rburkey2005 commented 5 months ago

I went ahead and wrote it up as an additional thing to try in the mini-tutorial at the end of the Block I page, and having done that I don't see much need for any additional documentation. So if you've been fretting that, don't worry about it. Issue closed. On the other hand, if you have an idle minute and happen to use it to look at the write-up, let me know about errors you see.