Tuesday, May 17, 2016

Recent work almost certainly lost, but soldiering on

LAPTOP CRASH

The Windows System Repair (which insisted it could not be cancelled) ran 30-40 hours before ceasing all disk activity and sitting helplessly inert. When I power cycled the laptop, I received a SMART error message to expect imminent disk failure. However, that occured before I could access the disk to remove anything.

Disk diagnostics on the laptop returned "Unusual Error" and immediately aborted. My standalone disk cloning box couldn't read it. I connected it to another PC and ran a good disk recovery utility. The drive takes a full set of recovery actions on each and every IO - I think 256 times is the magic number. That is why the system repair ran so long.

When I mount the disk to my other PC, it does its continual error recovery cycling amid each IO, but it did show up eventually. The disk recovery utility (Seagate) found the partitions and I selected the one with my data on it. The detailed scan ran excruciatingly slow - after four hours, I had found 232 directory entries and no files yet, with a projected completion time of over 10 years.

It does eventually get the data, but so slow as to be impractical. It does appear the data is intact and can eventually be read, although I am not sure how completely since it was just starting into the drive when I bailed out.

I could use a hard disk recovery service - they will swap electronics, replace heads if necessary and then extract as much data as possible. The downside is price - a minimum of $600 and some quoted up to $2400. While it is painful to have lost about a month of coding and some fpga logic, plus the huge annoyance of reinstalling applications and toolchains, it is also hard to justify spending that much money given the risk that key files might still not be fully recovered.

I did buy a 960GB SSD to use in the laptop and will receive a replacement hard disk drive with Windows and drivers installed, as the seller of the laptop considers this an in-warranty event.

All this pain because I didn't verify that I had a correctly operating backup in place on the laptop - assuming I was safe until it was too late.

RESTORING CALCOMP 565 AS IBM 1627 PLOTTER

I sent very detailed specs to the metalworker to get a quote for the cylinder, with holes predrilled for the pin feed but it is up to me to find/create them. I have received several good suggestions from readers of the blog, all of which I am considering carefully.

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

I will have to recreate everything I had built for the new GUI - screens, restructured logic in the model-controller-view pattern, and test it all again. At least I should be able to take a workable approach straight away, rather than fighting to learn what works as I did in past weeks. I also need to find and download all the images I was using for the interface. All achievable, once I put in the time.

I have adjusted or refined parts of the fpga logic, as well as having converted it to work successfully on the Vivado toolchain for the new fpga board. All that will have to be redone and I hope I can figure out what changes I had to make. Here, I can imagine burning debugging hours in the future only to spot a problem that I realize had been fixed but lost in the great crash of May 2016.

Sunday, May 15, 2016

Laptop disk crisis, setback on plotter restoration and progress on SAC program (possibly lost however)

Possible serious setback - I awoke to find my laptop with the Windows Startup Repair screen displayed, claiming to be repairing disk problems. It has been six hours minimum, perhaps many more depending on when the laptop attempted a reboot and started the repair. It can't be more than 15 hours since I saw a normal display on the laptop before I retired last night.

I have read posts where this process took multiple days to complete, after which I discover exactly how little or much of the disk contents are still accessible. I will buy a new disk and cloning gear, but I will have some challenges with software, keys and the like if I have to reinstall Windows and applications. More seriously, the work of the past couple of weeks might be completely obliterated.

RESTORING CALCOMP 565 AS IBM 1627 PLOTTER

Disappointing news from the metalworker who I hoped could remove the dent in the plotter drum. He believes that the aluminum is too stretched to get good results working it. The only solution would be to fabricate a replacement cylinder, but that would depend on my finding a source for the pin feed conical shaped rivets that are on the two ends.

This was one of the possible routes to repair - a substitute aluminum cylinder - but the pin feed rivets are the real fly in the ointment. A replacement cylinder would need the rivets to act as pin feed pulling paper on the drum. If the shape isn't correct, the paper could slip as the plotter moves the drum up and down or it could cause the paper to bulge up off the surface.

Pin  rivets that act as tractor feed for continous paper rolls
It does not appear that there is any need for tractor feed (pin feed) paper handling and nobody makes rivets for that role. My rivet heads are cone shaped, 1/8" at the base and spaced at 3/8" intervals around the drum circumference. I can find round head rivets, but not that close a match. The style that comes closest is called 'high button' head but I can't find any source for those either.

There are some alternate courses of action I could take. One would be to build a replacement cylinder but without the tractor feed pins (rivets). It won't be a faithful restoration because of this, but it will allow me to tape sheets of paper to the drum and run some plotting.

A very unlikely solution would be to remove the existing rivets as carefully as I can and find someone who can weld extensions to the bottom to allow them to be affixed to a replacement cylinder or otherwise find a way to attach them.

Backside of the pin rivets
As you can see, I either have to work the rolled over rivets to bend the metal up and into a hollow tube, allowing removal from the old drum and installation on the new, or I have to grind off this side, weld a new rivet rod to the removed rivet, and attach the new rod somehow inside the replacement drum.

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130


Restructuring the GUI

I finished testing the PC side of the virtual 2501 card reader. It handles hopper empty conditions properly and will set or reset the last card status when the fpga signals operation complete.

Using what I learned, I then worked on other device drivers to have them behave properly although purely from a PC only standpoint as I am not yet testing with the fpga and the 1130 system in the loop. Next up for careful study and testing was the virtual 1403 printer function. In the course of testing, I decided to drop the Carriage Restore button and function from the GUI.

From here, I finished the PC only testing for the real 1627 plotter and real 1134/1055 paper tape devices. These serve only to activate and deactivate the fpga which controls the real devices. The 2310 device took a bit more time to accomplish.

Next up was the code to communicate over the USB link. I restructured this so that my Queueing object will instantiate the USB handling module and keep it encapsulated entirely inside. This allows me to change the USB functions independently and allows the queueing module to control how it communicates, potentially even entirely replacing the USB link with something else. Good OO structure now and tested as far as possible without hooking up to the FPGA.

Once I felt comfortable with the logic for queuing transactions, having them pulled and communicated over a USB link and responses posted back to the caller, I could start up the background process that regularly updates the main screen with 1130 status. This too took some time to straighten out.

I had some hangs and stalls, since the main screen involves three cooperating threads, but I eventually got it all straightened out. I was attempting to pass an argument to one of the GUI threads that handle the main window status signals, which caused odd problems when I naively adding the argument to the threading command. I finally figured out a method to accomplish what I wanted without the argument.

Another enhancement I made was to add in logging window support, where status and error messages can accumulate, using the wxPython logging capability. This gives me a nice window with timestamps, support for saving the log to a file and/or clearing it out, and a new Action menu choice to Show or Hide the log window. This does require that I walk through all the code, replacing the diagnostic, status and warning 'print' commands with logging calls, a tedious but straightforward process. Fortunately, logging is thread safe and works well with my many-threaded design.

Thursday, May 12, 2016

Debugging started on 2501 function as GUI change nears completion

Many interruptions today - getting a filling over the recent root canal, volunteering at CHM where I installed 12 new brushes in one of the 729 tape drives, and dealing with the transition to Medicare (senior citizen) health care which involved two agencies and the health care provider. Still, I did get some work done on the 1130 project.

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

Restructuring the GUI

A friend asked why I didn't just reproduce the appearance of the various device control panels, and of the 1130's main display panel. It was something I considered, but decided against because the 'signal to noise ratio' would be too low.

Take, for example, the control panel for the 1442 card reader/punch. There are four active buttons, four lamps and a dummy button on the right side, and a set of seven lights in a flat black square on the left. The only lamp that is useful on my GUI is the Ready lamp and the only button that is useful is the NPRO one.

That leaves 3 live and 1 unused buttons cluttering up the screen, plus 10 of the 11 lights unused. Then, I need to show the state of the hopper, display the file names for both input hopper and output stackers, indicate the number of cards remaining in the hopper, and offer a Prog Load button which is on the main 1130 keyboard rather than the card reader.

The 1132 printer has 18 positions filled with buttons, lamps or a switch, but only a couple are useful. Displaying the paper and carriage control tape files does not have an analog on the real 1132. Once again, most of the panel would be non-functional but distracting.

The same was true of the main 1130 display panel, since I can only display the state of the Storage Data register, not the other five registers. Of the eight T clock levels, I only display four. Some information such as reset, X0, X2 and X4 clock states are not displayed at all on the real 1130. Other information, such as the Parity Stop, exist on the keyboard panel not the display panel.

I chose instead to be evocative of the 1130 but not a close match. I organized the control panels on the GUI to present the needed information and guide the user on the available operations they can request.

I walked through my 2501 reader code and realized that under the new model-view-controller, there is a flaw in how I handle the last card condition. I need to add a transaction that the code sends to the fpga to arm it for the last card status when it handles the very next XIO Init Read.

In a real 2501, when the hopper becomes empty, the reader goes out of ready. If the Start button is pressed without putting new cards in the hopper, the reader becomes ready but adds the last card bit in the DSW when the card is read. Otherwise, more cards are added to the hopper and Start makes the device ready again. Subsequent reads in that case do NOT have the last card bit set.

Tuesday, May 10, 2016

Building mirror interfaces for console entry switches and 1053 console printer

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

Restructuring the GUI

I built the code for the mirror Console Entry Switch device and cleaned up the mirror 1132 code, over the course of the afternoon. Plenty of opportunity to clean up and refactor code - one routine to build switches rather than repeating commands for all 16 of the console bit switches.  The switch ends will flip up or down to reflect the value that was read with an XIO Read from the physical CES on the 1131.

mirror Console Entry Switch panel
For the typewriter (console printer), I set up a nice window that appears to be a form emerging from a picture of the 1053 - clicking the paper either opens an output file or closes an existing file.

mirror 1053 Console Printer (typewriter) panel

Sunday, May 8, 2016

Great progress rebuilding GUI for SAC Interface Box

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

Restructuring the GUI

After working with the more complex 2501 functionality, I have a more solid approach to building the view, controller and model objects for each device. I am also clear on how to make updates across threads, since parts of each device run in their own threads but GUI actions must all occur in the main thread.

The updated window for the 2501 now displays the count of cards sitting in the virtual card hopper. It added an NPRO button (non-process runout is how you empty a card reader) to clear out the hopper and set the device not ready.

When the user clicks buttons or icons on the graphic window for a device, those actions are handled by the view module. It runs in the main thread. It may present dialogs to select files as part of the process - for example when clicking the card deck icon to load more cards in the 2501 hopper. The card images and updated card count are updated by a call to the model module, which maintains the state of the device. Checking modes like binary cards or last card will also call the model module to update state. The view module can be triggered by an event if the controller, in another thread, wants the view to update.

The controller module runs the main processing for the device in a separate thread. This module is what sticks requests on the queue to be issued to the fpga board. The controller module must check the state of the device as well as ask for card images from the model module. While this is a cross thread operation, it does not need any locking. If the controller module sees it has updated the state of the device which should be reflected on the GUI, it sticks a custom event in the queue which is processed by the view module under the main thread.

Thus, the view and controller modules each communicate only with the model module. The controller can trigger a custom event that is processed by the view module, but it is not calling directly thus the event switches threads.

Both 2310 and 2501 devices active with files loaded
After the screen image I saved above, I changed the icon of the punched card to a obvious deck of card picture. I think I have the 2310, 1627, 1134 and 2501 code ready to test, the 1403 printer code mostly completed, and am starting in on the 1442 restructuring. Still to be worked on are the mirror 1132 printer, mirror 1053 printer, mirror console entry switches, and the core memory loading function.

Control panel for 1403 printer function
New version of 2501 panel with card deck icon
I did take some time to refactor some code, although often that involves a dive into fine points of how Python works that chews up some time. This involves building strings that will become pointers or function objects, making use of the functions like getattr, setattr and delattr that manipulate name spaces.
Control panel for 1442 - note files for input hopper and output stackers

Saturday, May 7, 2016

Completing 2310 and 2501 device implementations

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

Restructuring the GUI

The 2310 function is converted and ready for testing. The virtual disk drive pops up a window with a picture of a disk cartridge to its right, the name of the PC file that is mounted on the virtual drive. Two lamp blocks are in the window, Disk Unlock and File Ready, which harken to the two lamp blocks on the keyboard panel of the 1130.

When it starts, the file name is **empty**, Disk Unlock is 'lit' and File Ready is dimmed out. Clicking on the 2315 cartridge icon brings up a file open dialog where the user selects a suitable file. The file is opened, validated, the file name is displayed, the Disk Unlock lamp is dimmed out and the File Ready lamp is 'lit'.

I then worked on completing the 2501 card reader function, building a window that pops up when the device is activated. It has an icon of a punched card and the name of the PC file to its right (or **hopper empty** when no file is open). A button, Prog Load and a lamp block, Ready, are on the next row. Finally, three checkboxes run across the bottom row - one to set up the last card status and two to choose between 029 and binary file modes.

The 2501 device is more complex, with more state information in the model and more fpga interactions. I also must decide whether to expose some of the state as output on the GUI window - such as card deck size and current card being processed.

I have icons for the other PC file types to open for the remaining device types - punch cards, a sheet of printout and core memory - which will be placed in the windows for those device types.

Wednesday, May 4, 2016

Restoration work on 1442, plotter and more development of new GUI

1442 CARD READER/PUNCH RESTORATION

I did some filing down on the UV curable plastic I bonded on the punch drive wheel to replace the cracked segment. I was pleased to find that it could be worked as promised. Next step is to be sure it is built up higher than the target diameter, so that my machining will all be subtractive to yield the intended surface.

I need to build a jig that will keep the outer face of the wheel, the perimeter that will contact cards, at the right distance to a rotary grinding tool. Then, I can slowly rotate the wheel to move the built-up sections along the repaired arc, grinding them down at the right diameter. The final step will be to coat some grit balls with the UV resin, place them on the repaired arc and cure them in place with UV.

The original wheel is a ceramic that has big grit balls embedded on the outer face. These grit 'balls' are the gripping mechanism to pull the card along. As long as I have the replacement section so its initial diameter is the same as the original's diameter in between grit balls, and make the balls the same size, it should all work.

SAC INTERFACE FOR ADDING PERIPHERALS TO THE 1130

Restructuring the GUI

Worked on the logic to fire up a device handler when the Device menu is selected, or to stop it when the user wants it deactivated. Each handler puts up a control panel window which will contain buttons and status displays. As a test of the concept, I built up the 2310 disk drive panel and am still tweaking it.

Now I am splitting the logic for all my devices into the model, controller and view portions - laborious but the heart of the restructuring. Models hold the device state, controllers communicate with the fpga and views control the on screen GUI elements.

RESTORING CALCOMP 565 IN GUISE OF IBM 1627

My connector arrived last night and looks perfect! It fits the connector on the rear of the plotter, although I want to clean up the contacts and pins a bit to make sure it is solid. I am still waiting for a quote from the metalworker for the task of removing the dent in the plotter drum.

New connector tested for fit