Saturday, April 7, 2018

Original FORTH from IBM 1130, meaning of pen markings on listings by Chuck Moore

CORRECTING BUGS IN ORIGINAL FORTH - AGAIN

The source materials we received in an email from Chuck Moore many years ago were scanned pages of an IBM 1130 assembler program and card images that we realized were early FORTH statements that built the language up from a few built in primitives to the interactive prompt for user input.

On the scanned pages of the early FORTH statements were a few black pen notations which I now realize were placed there while Chuck Moore was debugging his FORTH system. One notation was a change in the size of the disk buffer (a vector named IN) which was originally coded as x140 words in length but the marker corrected that to x141.

This makes perfect sense if you know the 1130 system. The disk drives were organized in sectors of 321 words, which is x141 in hex. Further, the system software for the 1130, Disk Monitor System, used the first word of a sector to contain the sector number and left only 320 words for user content.

This was just a convention established by the software. Since FORTH eliminates the use of DMS and other system software, instead handling disk I/O directly with raw 1130 instructions, there was no need to abide by the convention concerning the first word. Bumping the count from 320 to 321 words allowed Chuck to use the full physical capacity of each disk sector.

It would have been a subtle error to catch, as most lines of input in a disk block would have trailing blanks. That meant that reading the disk sector with a short count would leave the very last word untouched. If the buffer had a word of spaces there, it would be unaffected by any subsequent disk I/O. Only when he was testing some program that used the very last word of a sector would he have discovered the need to increase the length of the I/O buffer.

There are two other statements in his scanned pages which have pen markings on them - the CREATE verb and the EMPLACE verb. As I was slowly checking out the operation of every verb in this system, I found that EMPLACE was not working correctly. It should have allowed the user to place text into the disk buffer, taking the users keystrokes terminated either by an apostrophe character or a length of 40. Instead, it was writing the entered keystrokes into low memory.

I then figured out how to modify EMPLACE to make it work as I think was intended, but it was clear that Chuck Moore had known it wasn't working, based on his pen marking, although not yet having rewritten it to work properly.

The final spot with a marking, the CREATE verb, has underlined 2E0 SECTOR which is where he chooses to begin the area for user disk blocks. It corresponds to how I configured the simulated disk drive on the 1130 simulator, but he may have either confirmed the location or meant to change it to match some different disk drive layout. In either case, I don't think it is incorrect.

Therefore, we had one defect corrected in pen, one identified but not yet addressed, and an underline that either confirmed the address or highlighted were to change the starting sector for user disk files. 

No comments:

Post a Comment