Toastie

The Mindful Pub - A Discussion Thread on 8bit Computers and LEGO

Recommended Posts

Dear All,

after I was sleeping two days over opening a thread on "an idea", I am just doing it:

This thread is intended to be a (Mindful) Pub to discuss ideas/projects/wild thinking/just memories/the good ol'days/8 bit/crazy16bit/express printers printing NCC1701/PDP10/11 ... and mostly 8bit computers - controlling LEGO 4.5V/9V/12V/RC/PF/ and yes: PUp devices. Whatever comes to mind.

8bit computers are OLD. Very old. As in: You may think the chemist down the road is old, but that's just peanuts to the age of 8bit computers. We are talking true retro here. C64, Dragon 32, Oric-1, BBC Micro, ZX's, Amstrad CPCs and so on and so forth.

I don't know why, but it just never "left" me. When I was 23 years old, my wife (I was studying - well - chemistry) allowed me to buy a Sinclair ZX Spectrum. And it all began. Games never ever interested me (other than cracking the "copy protection" using the disassembled machine code) - it was the hardware. And changing/adding things. Controlling periphery. I graduated with a degree in chemistry though - and all figured out is "true homebrew".

It was the world of TTL, CMOS, and ECL ... and the world of 16k x 1bit chips being expensive. Just imagine: The 16k ZX Spectrum I had was ready to be upgraded to 48k. There was also a factory version of the 48k Spectrum. To make that one as cheap as possible, Sinclair used defective 64k x 1bit chips: These chips are organized in 2 banks of 32k. Upon final testing manufacturers as TI and others sold chips with one defective bank to other companies as "32k" chips. Can you believe that? Yes of course. It makes total sense! But today? Never ever. 

Now, the idea for this thread is: Can we control ancient or even current LEGO electronics with 8bit computers?

I am working on: Let a ZX Spectrum talk to an RCX brick. Why? Because. Nothing else. It has remotely to do with LEGO bricks being around since the 1960s - and still clutching - and LEGO electronics officially appearing and disappearing even faster than fashion trends do. You may think: So what. He has the ZX IF1 featuring an RS232 port. Well. The ZX speaks (hardwired = bolted in) 1 start, 8 data, no parity, 1 stop bit. The RCX speaks (again: Hardwired into the UART) 1 start, 8 data, odd parity, 1 stop bit (Challenge 1: Parity change). And then: The LEGO IR serial tower cranks out and sucks in bytes with no protocol at blistering 2400 Baud. The ZX IF1 can't handle that: After receiving 1 byte is pulls down the CTS -> RTS line - allowing one more byte and then think about how to store that (Challenge 2: HW protocol - the tower is totally dumb). Possible solution: Arduino as translator. We'll see.  

This thread will not be heavily populated, I believe. And it will take time. We are talking 1980s.

There are some folks here on EB though who may have something to say ... or maybe not.

  • @dr_spock suggested the title of this thread
  • @Duq repairs old washing machines
  • @zephyr1934 knows how to print NCC1701 on endless paper
  • @UltraViolet likes when an EB topic is derailed because of 8bit computing ...

This is it. Don't expect a viral thread. I am old. The cool thing though is: Posting here after ... let's say a year or so of silence will not get the moderators mad, as it is designed to be a repository :pir-huzzah2:

All the best,
Thorsten

P.S.: Just for those who were born 2000(+) : k stands for kilo:pir_laugh2:. A 16k x 1 RAM is a chip that holds 16384 bit (0/1). You needed 8 to get 16kByte RAM. Today, a 16G x 8bit DDR3 DIMM module, which holds about 1 million times more bytes, sells for about the same price as 16kByte cost in 1982. In other words: 1 bit then was 1.000.000 times more expensive than 1 bit is now, 40 years later.  

Edited by Toastie

Share this post


Link to post
Share on other sites

So ... just learned that a retro computer work/place/space makes it to the front page! (it is an Apple, isn't it?) - This is soo so cool :wub:

Well, here we go - this is even beamed back in time a little further than Apple 2E ...

As I am working on a ZX Spectrum talking to the LEGO serial tower (with reply ... sigh(!)) - it seemed to be appropriate to "prepare". And as said elsewhere, I got both, my ZX81 and my ZX Spectrum from 1983/95 back to work. Before diving into old electronics and old and current programming - I prepared myself creating the right environment to work on this (during endless nights :pir_laugh2:):

 

zx81_workplace.jpg

There is the Zeddie on the left, with the 16k MonsterRAMPack, and nifty 9V power supply. On the right front is the small scale LEGO version - as it was, last millennium: The Zeddie, the cassette player for true mass storage, power supply, couple of mass storage cassettes, CRT (that one I got from my mum - was a red "Colani type" CRT - no edges, just curves:sweet:. For me, it was quite the challenge to build that one with bricks, see below.

Back right is my laptop showing a Stud.io render of the scene. Back left is the "CRT" = LED TV I am using as ZX display. This needs some modding to the ZX81 video output, as around 1980, VHF/UHF was the standard. Today, hardly any TV set knows anything about RF - at minimum they want composite video. In front of the TV is a good quality audio capturing device, used for loading/saving Zeddie programs from my laptop (almost "glitchless" when using Audacity).

Credits for the LEGO models: The Zeddie LEGO model is based on Steven Reid's design: https://www.reids4fun.com/. I just replaced the round 1x1 tiles with square ones. And made some space for the cables. Also resized the RAM pack a bit to fit the scale and moved it a little to the right - as in the "original". The cassettes - I can't find the reference anymore. Merde. It is >not< my design. The CRT is; however, the front screen idea is not. This is from http://www.fubiz.net/2014/04/30/retro-technology-lego-kits/retro-technology-lego-kits3/. I just changed the direction of the curved slopes and the scale. BTW: The Zeddie never produced a decent picture back then with the RF modulator - so this is why the screen is not grey/white only. I believe the cassette player is also my design - at this scale. The lid actually opens, and you can insert one of the cassettes - see LDraw MPD file.

The LDraw MPD file is here: https://brickshelf.com/cgi-bin/gallery.cgi?f=582185. This BrickShelf folder is not moderated yet though.

I believe this is it. As my photography is crappy, here are some Stud.io renders.

zx81_workspace_s.jpg

(Shadows below the devices because I am too dumb to get the wires bent in a way they don't penetrate through the floor - and Stud.io does adjust the floor location to the lowest part - as far as I know.

zx81_-_cassetteplayer.jpg

The cassette player ... right now it plays a program to be loaded into the ZX81 - may take several times though!

zx81_-_crtback.jpg

The "Colani type" CRT I had back then, back view. Black = power, yellow = antenna in ...

And here is the Zeddie:

zx81_-_zx81.jpg

The Zeddie with RAM pack.

Sorry for just the renders; but as said: I am not good with photography.

All the best,
Thorsten

Share this post


Link to post
Share on other sites

Wonderful!
Awesome!

Both your idea and art products are interesting to me.


Dear, I agree with your idea. The old fashion computer has it's value. It is a fundamental tool for children learning computer knowledge, such as binary and Ascii.

Besides, when quantum mechanics computers are coming, old fashion computer will give a transparent compare between classic computers and quantum mechanics computers.

What’s incredible is, I have a similar experience with you. Learning and working in both the electricity and the chemical industry.

Just do as you wish! 

You are not old. You have a young spirit and positive thought.

You will have great success!

Share this post


Link to post
Share on other sites

Nice build. I remember the ZX81. Do your cassette tapes still work?  I may still have a Z80 processor somewhere.

I was thinking the thread would be more like the Technic Pub where it is not  too LEGO-centric and more on the off-topic side of shifting bits or shooting the breeze.

Back in the days, I wrote some assembler to control fluid flow with an 8088 processor.  I never did like the Intel segmented memory addressing.  Coming from the MOS 6502 and Motorola 68000, the Intel drove me nuts.  Making ASCII art on a IBM System/34's 5211 band printer was more entertaining.  :classic:

 

 

Share this post


Link to post
Share on other sites

@camellia  Thank you very much for your (very) kind words. I really agree with your assessment on 8bit computing and learning how computers work. Absolutely. It even works with the e.g. the 8/16 bit microchip PICs - and of course all small scale RIS brains from other vendors - at least for me. On the other hand, when I do program Arduino's and derivatives it is more or less a miracle to me, what they a) have on board and b) what they can accomplish. Usually I do import libraries without knowing how they work and copy code from the various forums etc. out there and stitch all that together with a couple of code lines (sometimes even a few more). And: When some programmer would look at my "C++" Arduino code, he or she'd say: "This isn't even close to the beauty of C++ - this is crappy BASIC style" :pir-blush:.

@dr_spock Oh - this is intended to be all about other things than LEGO. As I said: My goal is to have my Speccy talk to the LEGO IR serial tower - which is currently far, far away ... at least for me. I am working on it :moar:.

The LEGO stuff was just for setting the stage - my workspace that is. As I haven't figured out a decent way of building a Speccy at this scale that suits me, I was going with the Zeddie.

Back on topic:

I just ordered three tiny SP3232 based RS232 communications boards to be connected to an UnoR3. Three because chances are that I'll blow up one or two things. These boards have 4 lines (lets call them RxD/TxD/RTS/CTS) at RS232 voltage level available. The IF1 interface of my Speccy wants CTS and RTS hardware handshake - or it remains silent. In addition, the serial input buffer of the ZX IF1 is 2 bytes. So it pulls down CTS to signal stop it, I have to move these bytes somewhere else ... and when done, 2 more bytes are allowed to flood the buffer ... if I get that to work, I will of course build an old school MAX232 based little breadboard circuit. Looks much better!

Ah - and found an Arduino library for other than generating plain vanilla 1 start, 8 data, no parity, 1 stop bit frames! There are not that many out there I believe. And this is certainly because these C++ folks simply program their own code to accomplish 2400 baud, 1 start, 8 data, ODD parity:ugh:, 1 stop bit communication. On my laptop, HTerm hooked up via USB/Serial converter (just using a 3-wire RxD/TxD connection) to the tower can make the RCX beep. OK, and all the other things. Making it beep is good feedback though. It sounds like the RCX is happy:pir-cry_happy:.

Best wishes
Thorsten

P.S.: Just looked up what "shooting the breeze" means:laugh:. Yes. This is exactly it!

Edited by Toastie

Share this post


Link to post
Share on other sites

Crappy BASIC style? I taught myself to program in BASIC.  My code may read like a bad romance novel but they seem to work out in the end.  :laugh:

Older school would be 1488 and 1489 level converters for RS232.  I may have to build a serial IR tower one day when my LUG can meet again. One of my members has a SCOUT for me.  Hopefully it won't be too hard to fix and get working.

rs232.jpg

Are you writing your own serial communication routines for the ZX81?

 

Share this post


Link to post
Share on other sites

Swwweeet! 1488s ... oh my. Beautiful.

Yeah, I know - the cool programmers in my group who are literally talking to each other in C++ (and of course JAVA - and of course Python) always just shrug, when I talk about my more than 10000 lines of VB6 (yes, VB6) code - no dot, no net, no express, no studio - just VB6:pir-huzzah2:). The thing though is: It works. It controls RCX trains, SCOUT switch controllers talking to MicroSCOUTS via VLL links, NXTs and recently yes, also PUp hubs. The latter is a bit shaky as I have no clue what I am doing - got the ActiveX control from n_software for free, no manual other than an example program, so no questions asked! But it all works.  

(Ha, for the VLL SCOUT - MicroSCOUT link I used the optical fibers from one of our labs dye lasers. Those are now in laser heaven, but the 6 m long VIS light fibers were too much for me, I saved them. LambdaPhysik (company is also gone) found it cool in the 1990s to control the electronics in their dye lasers with optical fibers instead of RS232 or IEEE-488 (HP-IB or GPIB) cables. Well these lasers were pumped with serious XeCl/ArF excimer lasers - and you can shield with cm thick whatever material - when 32 kV stored in a capacitor bank of some meters in size are discharged within 10 ns, this generates some electronic noise :cannon:)

Let me know about how it goes with the SCOUT, I took several of them apart to fix them. I love them. Space for 396 bytes for LEGO byte code is all RAM you get! So programming them is total fun. Actually Dave Baum changed the NQC code, when I asked him (that was very generous): For jumps, he originally implemented always long jumps. That costs you three bytes more than compared to a short jump! For the RCX memory monster that is no issue, but when left alone with 396 bytes of RAM, it is something.

Also, for the LEGO tower replacement - there is really cool Arduino code to generate the 38kHz modulation frequency. I found this here:

void setup() {
  pinMode (11, OUTPUT);               // Pin 11: Timer 2 "A" output: OC2A 
  // set up Timer 2
  TCCR2A = _BV (COM2A0) | _BV(WGM21); // CTC, toggle OC2A on Compare Match
  TCCR2B = _BV (CS20);                // No prescaler
  OCR2A =  208;                       // Original value: 209. 
                                      // Original comment: "compare A register value (210 * clock speed)
                                      //  = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095"
                                      // This results in 37.83 kHz on the Uno R3 clone board
                                      // Changed to 208 - this results in 38.01 kHz
}

And this is it! This makes pin 11 oscillate at 38kHz, 50% duty cycle. Entirely hardware driven! (Comments following the last line are from me to remember). This is really cool. And works - the RCX beep was generated using this setup. However, just turning an IR LED on and off with one leg connected to pin 11 and the other to lets say pin 10 configured as output did not work - ther was always residual IR light flooding the scene. Oh well, one NOR gate of 74LS02 takes care of that issue.

Well I am using the ZX Spectrum with Interface1 from my good ol'days, not the ZX81. The Spectrum IF1 one has serial communication routines built is - but with HW handshake and only 1/8/N/1 frames.

So I will use an Arduino for translation purposes. Well, that is the plan. Who knows ...

Best wishes
Thorsten
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.