ForthHub / discussion

Discussion repository for Forth enthusiasts.
116 stars 4 forks source link

The original FORTH for the IBM 1130 has been found and is being restored to run in emulation! #63

Open i336 opened 6 years ago

i336 commented 6 years ago

HI THERE

That's what the original printed when it had initialized :)

Read all about it here: https://rescue1130.blogspot.com.au/2018/03/historical-recreationrestoration-of.html

There are further restoration-related tidbits in these posts:

  1. https://rescue1130.blogspot.com.au/2018/03/various-items-disk-drives-ethernet.html
  2. https://rescue1130.blogspot.com.au/2018/03/restoring-original-source-code-for.html
  3. https://rescue1130.blogspot.com.au/2018/02/built-battery-for-roomba-discovered.html

As of writing this post, the current caveat emptor is that the code has not yet been released.

From link #3 above,

It looked like no copy existed until I discovered an obscure reference from 2011 on the 1130 google group which suggested that Chuck did send some code to a friend of mine.

The post wasn't linked, but the group is low-traffic enough that Google Groups' rather primitive search capabilities was able to find it: https://groups.google.com/d/msg/ibm1130/KpvBOrgT3Pw/WCj5Z-OmG4YJ

Continuing from link #3,

I contacted Bob Flanders, who dug through his old email and discovered a previously unnoticed attachment which contained sixteen scanned images. These were twelve pages of an IBM 1130 assembler run and four pages of cryptic FORTH-like code.

I typed in the sixteen pages to make them machine readable, then Bob and I began to attempt a resurrection.

This is apparently going well (based on the positive noises in the first link).

I'm very interested to see this released (in any form), and have commented on the first post (the one linked in bold) saying as much.

NB. Please feel free (don't wait for me) to post updates as this develops.

i336 commented 6 years ago

I completely forgot to add the source link! https://news.ycombinator.com/item?id=16611505

I closed the tab just before I vacuumed up the links into the previous comment, so forgot to add it. I knew there was something I was missing, and just remembered.

Mecrisp commented 6 years ago

Very nice !

I am looking forward to the release and to try this very early Forth in emulation.

Matthias

monsonite commented 6 years ago

Hi All,

I have had a preliminary investigation into the first FORTH running on the IBM 1130.

This is detective work on a processor that was "born" the same year as I was - 1965.

Thanks to Carl Claunch, for sharing the listings with SV-Fig, and generating interest in his IBM 1130 restoration project.

https://rescue1130.blogspot.co.uk/2018/03/original-forth-from-ibm-1130-under.html

Carl describes his 1130 system here https://www.youtube.com/watch?v=h3bwrQbNydg

There is very little documentation about Forth from the period 1968-1970 - and what there is gives very little detail about language specifics.

"Forth - The Early Years" says that Forth was coded in FORTRAN on the 1130, but the listings tell a different story.

The source code listings can be found here http://www.forth.org/svfig/kk/02-2018-Claunch.zip

It's clearly a Forth interpreter written in 1130 assembly language.

The 12 pages of assembler and 4 pages of "proto-FORTH" appear to be Charles Moore's recoding of the FORTH interpreter into IBM 1130 assembler, and then the Forth code necessary to get the 1130 disk working.

The interpreter has 29 primitives coded up in assembler. Unusually OR is coded. The reason for this is that it allows more machine instructions to be easily assembled from their bit fields - a very easy inline assembler.

Once the assembler is built - defining the rest of the Forth kernel become a whole lot easier.

The first 30 lines of the Forth listing are essentially an in-line assembler, to allow Chuck to mix Forth plus 1130 assembler - so that some more common Forth words can be defined, including DUP, DROP, SWAP etc.

The first 100 lines of Forth establish a fairly recognisable Forth system, and the next 100 lines are Chuck's application to exercise and exploit the disk drive on the 1130 system.

The IBM 1130 from 1965 was not a very sophisticated machine - and built to a budget to appeal to universities, education and engineering.

It is a bit quirky because it uses EBCDIC character coding (devised for IBM System 360) rather than ASCII - but it's a fairly simple 16 bit machine with accumulator and 3 index registers.

It could probably be emulated in 100 lines of C running on a TI MSP430 Launchpad. Imagine an IBM 1130 on a $20 devboard complete with SD card "Disk" plus 256K bytes non volatile FRAM

https://www.mouser.co.uk/ProductDetail/Texas-Instruments/MSP-EXP430FR5994?qs=sGAEpiMZZMt24PW2WNEtL9IVGFlmOnblllyKTKq%252b9gc%3d

Looking forward to updates from Carl regarding the 1130, but anyone else with an interest in 50 year old Forth - please chime in.

regards

Ken Boak

London.

On 21 March 2018 at 11:38, Matthias Koch notifications@github.com wrote:

Very nice !

I am looking forward to the release and to try this very early Forth in emulation.

Matthias

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/63#issuecomment-374909113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuUP_IpYMDvm8sTAvcEMx13pA6ddUM9ks5tgjvQgaJpZM4Sy6Q9 .

larsbrinkhoff commented 6 years ago

I'm interested in old software. Please post updates here!

monsonite commented 6 years ago

Lars,

You can follow the progress of the IBM 1130 restoration and early Forth here on Carl Claunch's blog.

https://rescue1130.blogspot.co.uk/2018/03/original-forth-from-ibm-1130-under.html

On 24 March 2018 at 15:58, Lars Brinkhoff notifications@github.com wrote:

I'm interested in old software. Please post updates here!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/63#issuecomment-375901851, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuUPx37YnAKQIT2ZxOEuJd_4QDgSLy4ks5thm0xgaJpZM4Sy6Q9 .

noqsi commented 6 years ago

On Mar 24, 2018, at 10:01 AM, Ken Boak notifications@github.com wrote:

Hi All,

I have had a preliminary investigation into the first FORTH running on the IBM 1130.

This is detective work on a processor that was "born" the same year as I was - 1965.

Thanks to Carl Claunch, for sharing the listings with SV-Fig, and generating interest in his IBM 1130 restoration project.

https://rescue1130.blogspot.co.uk/2018/03/original-forth-from-ibm-1130-under.html

Carl describes his 1130 system here https://www.youtube.com/watch?v=h3bwrQbNydg

There is very little documentation about Forth from the period 1968-1970 - and what there is gives very little detail about language specifics.

"Forth - The Early Years" says that Forth was coded in FORTRAN on the 1130, but the listings tell a different story.

The source code listings can be found here http://www.forth.org/svfig/kk/02-2018-Claunch.zip

It's clearly a Forth interpreter written in 1130 assembly language.

The 12 pages of assembler and 4 pages of "proto-FORTH" appear to be Charles Moore's recoding of the FORTH interpreter into IBM 1130 assembler, and then the Forth code necessary to get the 1130 disk working.

The interpreter has 29 primitives coded up in assembler. Unusually OR is coded. The reason for this is that it allows more machine instructions to be easily assembled from their bit fields - a very easy inline assembler.

Once the assembler is built - defining the rest of the Forth kernel become a whole lot easier.

The first 30 lines of the Forth listing are essentially an in-line assembler, to allow Chuck to mix Forth plus 1130 assembler - so that some more common Forth words can be defined, including DUP, DROP, SWAP etc.

The first 100 lines of Forth establish a fairly recognisable Forth system, and the next 100 lines are Chuck's application to exercise and exploit the disk drive on the 1130 system.

The IBM 1130 from 1965 was not a very sophisticated machine - and built to a budget to appeal to universities, education and engineering.

There were about 10,000 made. A typical setup cost $100,000, so it was a billion dollar product for IBM, back when that was a lot of money. For millions of us, it was the first computer we ever saw, let alone used. In many installations, students could walk up to the machine and put their card decks into the input stack themselves (“face down, nine edge first").

It is a bit quirky because it uses EBCDIC character coding (devised for IBM System 360) rather than ASCII

EBCDIC was an 8 bit condensation of 12 bit punched card (Hollerith) code, while ASCII was Teletype-based.

But EBCDIC was only one of many codes the 1130 used. Pretty much every peripheral had its own code, so a typical application program devoted a serious fraction of its memory to conversion routines. Most 1130s had 8k or 16k words: memory was tight. The standard encoding for names of things (FORTRAN variables, assembler symbols, file names) in Disk Monitor V2 was a 6 bit condensation of EBCDIC that packed up to five characters into a 32 bit doubleword, with two extra bits for metadata. Legend has it that FORTH is so-named because it fit the five character limit.

  • but it's a fairly simple 16 bit machine with accumulator and 3 index registers.

It could probably be emulated in 100 lines of C running on a TI MSP430 Launchpad.

I think this is optimistic. 1130 arithmetic was more FORTH-like than C-like, requiring some machinations to imitate in C. Then, there were things like the MDX instruction, a tricky (Turing complete!) beast with several special-case behaviors. The I/O channel was complicated and the peripherals were quirky.

Imagine an IBM 1130 on a $20 devboard complete with SD card "Disk" plus 256K bytes non volatile FRAM

There’s a working simulator at http://ibm1130.org/sim/ http://ibm1130.org/sim/.

https://www.mouser.co.uk/ProductDetail/Texas-Instruments/MSP-EXP430FR5994?qs=sGAEpiMZZMt24PW2WNEtL9IVGFlmOnblllyKTKq%252b9gc%3d

Looking forward to updates from Carl regarding the 1130, but anyone else with an interest in 50 year old Forth - please chime in.

regards

Ken Boak

London.

On 21 March 2018 at 11:38, Matthias Koch notifications@github.com wrote:

Very nice !

I am looking forward to the release and to try this very early Forth in emulation.

Matthias

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/63#issuecomment-374909113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuUP_IpYMDvm8sTAvcEMx13pA6ddUM9ks5tgjvQgaJpZM4Sy6Q9 .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/63#issuecomment-375891488, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYtQcuILkjwGwmNLEV3-zx35JJrvAonks5thlHHgaJpZM4Sy6Q9.

John Doty Noqsi Aerospace, Ltd. http://www.noqsi.com/ jpd@noqsi.com

monsonite commented 6 years ago

Hi All,

Today I decided to focus on the first 40 lines or so of the Forth listing. I have attached a text listing.

These lines define the assembler and also define some of the stack manipulation words such as DUP, DROP, SWAP as well as ADD, SUB and AND.

Working through these definitions shows how the early Forth uses the various 1130 registers and resources to create a Forth virtual machine.

In the first 40 lines of source, plus the 2000 bytes of assembly ( 320 bytes of disk sector buffer and 128 bytes of EBCDIC character conversion) you have the beginnings of a FORTH system.

Thanks to Carl Claunch for sharing the listings and Dean Sanderson for providing some further insight in to how Forth was built from the ground up

regards

Ken

.DEP LOC DEPOSIT, .DEPOSIT IC INC=, .INST OR DEPOSIT, .LD C000, .ST D000, .ADD 8000, .SUB 9000, .MUL A000, .DIV A800, .LX 6000, .SX 6800, .MX 7000, .B 7000, .BL 4800, .BSI 4000, .XIO 800, .X1 100 OR, .X2 200 OR, .X3 300 OR, .MDM 7400 INST DEPOSIT, .ZERO 1810 DEPOSIT, .XCH 18D0 DEPOSIT; .I 480 INST DEPOSIT, .L 400 INST, .LONG L DEPOSIT, .STORE ST LONG, .LOAD D LONG, .CALL BSI LONG, .ACC 1 B INST DEPOSIT FE INST, .GDEP IC 1 MDM IC ST I, .GOR E800, .GAND E000, .GWAIT 3000 DEPOSIT, .REL X3 LONG, .RELS X3 INST, .BASE LX REL, .BASA 1 ST INST 0 BASE, .TOD 1880 INST, .TOM 1000 INST, .TXD 1880 INST, .TXM 1080 INST, .TAD 1800 INST, .ZF 10A0 DEPOSIT, .LF ZF LOAD, .FS X2 INST, .LS LD FS, .SS ST FS, .LSI LD X2 I, .SSI ST X2 I, .MS MX FS, .RETURN BL I,

// Notes - to be confirmed // LS is Load Stack // SS is Store Stack // FS is the stack pointer // The MDX instruction is used to modify the stack pointer - either incrementing or derementing // From a root value of 7000, either 1 is OR'ed to increment it (7001) or FF to decrement it (70FF)

// Each dictionary entry is 4 words // The first 2 words contain 4 packed characters
// The 3rd word is the address of the code // The 4th word is 0000 // E1 is the top of the symbol table // E is where to start searching from // FC MDM sbtracts 4 // 4 MDM adds 4

OPERATION CONSTANT E1 LX X3 I LD LOC LIT ACC 2 ST X3 INST 0 LS 3 ST X3 INST RETURN OPERATION REVERT E LOAD E1 STORE E1 FC MDM RETURN OPERATION TOP E1 LOAD E STORE E 4 MDM RETURN OPERATION DUP 0 LS 1 MS 0 SS RETURN OPERATION VALUE 0 LSI 0 SS RETURN OPERATION DROP FF MS RETURN OPERATION RAISE 1 MS RETURN OPERATION SWAP 0 LS XCH FF LS 0 SS XCH FF SS RETURN .MSI LD SWAP ACC DUP ADD FS SS, OPERATION + 0 LS FF MS 0 ADD FS 0 SS RETURN OPERATION AND 0 LS FF MS 0 E000 FS 0 SS RETURN .DISP FF AND, OPERATION - FF MS 0 LS 1 SUB FS 0 SS RETURN

// This completes the listing to the end of page 1. // The assembler is inplace by line 51 allowing the stack manipulation commands to be defined // Key to understanding this are the words LS (load stack) MS (modify stack pointer) and SS (store stack) // FS probably means "First on Stack"
// To RAISE the stack pointer we use 1 MS
// to lower or DROP the stack pointer we use FF MS

larsbrinkhoff commented 6 years ago

Thanks Ken!

monsonite commented 6 years ago

Lars,

Just to understand the assembler and the asm needed for the stack operations is a major breakthrough in understanding IBM 1130 Forth.

I am now starting to unravel just how Forth was written for this 53 year old machine.

regards

KEN

On 25 March 2018 at 17:58, Lars Brinkhoff notifications@github.com wrote:

Thanks Ken!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/63#issuecomment-375985532, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuUP1Ozt6Oy3B75LVcpM9247EHttvTUks5th8yqgaJpZM4Sy6Q9 .