Jump to content

Recommended Posts

Posted (edited)

Here's something weird. In the Lego-provided IBM (9771) code (http://www.brickhacks.com/ibmbasic.php), the check-out lines are:

10000 P=925
10010 OUT P,21
10020 IF (INP(P) AND 63)=21 THEN OUT P,0 ELSE ERC=4 : GOTO 20000

In 10010, I have to wonder: why is the test value 21? What's special about that number?

Edited by evank
Posted
8 hours ago, evank said:

In 10010, I have to wonder: why is the test value 21? What's special about that number?

Yes, that code is in the manual for 9771 - I have that at home.

Nothing, really nothing is special about that number. In binary notation, 21 dec (15h) is 010101 - some geek found it cool to test the presence of 9750 by alternately turning its 6 outputs on and off. On the other hand, that pattern stands out a bit when testing new hardware. I found it useful when making my serial-to-parallel Arduino thingy; when the pattern shows up on 9750, you know that at least the out command worked. Checking for the response by masking off bit 6+7 (AND 63 dec, 3Fh, bin 00111111) and getting the same number back, tells you the in command worked as well.

They do that in TCLogo as well:

1481:0A29  mov  al,15                  ;load 15h = bin 0001 0101 into al
1481:0A2B  out  dx,al                  ;write bin 0001 0101 to serial port
1481:0A2C  in   al,dx                  ;read serial port into al
1481:0A2D  and  al,3F                  ;al = al AND 3F (bin 0011 1111)
1481:0A2F  cmp  al,15                  ;compare al to 15h = 0001 0101

You can use any other number for testing, this 010101 pattern is maxing the probability that one or more lines on the data bus are not working.

I guess. Maybe it is also just for fun. Programmers ... :pir-laugh: maybe 42 (101010 bin) was simply too obvious ... 

Best,
Thorsten

Posted

I see your point about a nice-looking test pattern. I just figured it would be 63 (all on) or, as you noted, 42 - now THAT would be appropriate! Lego engineers clearly had a sense of humor. To check the connection of the 9751, your code must send a text string to Interface B: "Do you byte, when I knock?" and confirm the interface's reply, "Just a bit, off the block." The weird part is, the text string is mentioned in one of the 9750 manuals! (I forget which one right now. Just got out of bed. I'll check later.)

Posted
3 hours ago, evank said:

Lego engineers clearly had a sense of humor.

I agree. In the beginning ... it already seems to have faded in the late 1990's. To "unlock" the firmware in the RCX, you had to provide that phrase as well ...

"Start firmware download clears RAM from 0x8000-0xcc00. Unlock firmware requires "Do you byte, when I knock?" string to be located in firmware image starting before cc00; anything after cc00 is ignored, so the string does not have to be complete (!). Firmware execution begins at the address specified by start firmware download."
(http://www.mralligator.com/rcx/romref.html)

Hope you enjoyed a good, strong, black coffee this morning!

Best,
Thorsten

Posted (edited)
On 7/29/2023 at 3:44 AM, evank said:

The challenge

Just to make sure this thread is not drowning in this Liebherr forum ... :pir-wink:

I am making progress getting into GFA Basic (for my Atari ST) - it looks rather promising. The parallel port of the ST is a nightmare though (signals destroyed by interrupt routines every such milliseconds, and no ACK line - crap! Have to live with strobe and busy ... and have to figure out, how GFA Basic deals with that via the inp() and out() function/command). The serial port is plain vanilla, but using it will violate the rules (no Arduino etc.), as a breadboard will be, well, large to make a serial-to-6+2 bit parallel port ...

Right now I am doing all this in the Atari Hatari emulator :pir-laugh:, but well, we'll see.

I love challenges. Ready Player One!

Best,
Thorsten

Edited by Toastie
Posted (edited)

Update :pir-huzzah2:

Moved yesterday from "coding" (well, BASIC; GFA BASIC 3.6 though ... that language is powerful(!), I surely have to admit!) within the Hatari emulator to my real Atari 1040 STFM.

Took me a while to figure out the I/O mechanics on the serial port using "OUT serial_port,data" and "var=INP(serial_port)" - but got that to work today.

I have now an Atari ST controlling 9750 via its serial port and my Arduino Nano serial2parallel converter. So this is >NOT< an entry for the challenge, just an update, as the entire "controlling infrastructure" is done:

800x425.jpg

Yes, I know, this is nowhere being slick, but it works:

Left row: Inputs. Blistering fast readings of both inputs and updating counters (2nd line). 3rd line = input bits numbers. 4th line = io_status byte, always up-to date.

Center row: Outputs. T=toggle outputs on/off upon pressing numbers 0 to 5; P=pulse outputs with keyboard rep rate.

Right row: Mode. So far simulation (checking any program operating a robot via 9750 without actually turning the output ports on), and serial work. Parallel is to be done.

Commands recognized so far are: T=mode "toggle outputs" when pressing 0-5, P=mode "pulse outputs"; X=select I/O mode (sim, parallel, serial, space bar activates mode), R=reset counters.

To be added: A ... G=User programs; corresponding subroutines are easily coded.

My guess with the weird Atari parallel port is, that a modified 9771 circuitry will do the trick. No need for address decoding; this is done in GFA BASIC by selecting LST: as output and input port (yes, the Atari can read the 8 bits of its parallel port - sweet! However, latching the Atari's parallel port 8-bit outputs is required; and I need to figure out what happens to the strobe line when the Atari is reading the port.

We'll see.

Best,
Thorsten 

Edited by Toastie
Posted

"Major":pir-wink: update (for the 8-bit nerds only, of course) :pir-huzzah2:

Yesterday I got it to work. Interface A (9750) controlled by an Atari 1040 STFM from 1987 (PCB says so) via its - a bit weird - parallel port and with a little help of:

  1. a 1987 5V (+12V, not used) power supply I used back then for powering two 5 1/4" floppy drives I added to my Schneider Joyce (PCW9256 from 1991, (https://de.wikipedia.org/wiki/Amstrad_PCW) 
  2. a 74LS273 (https://www.ti.com/lit/ds/symlink/sn74ls273.pdf?ts=1692440430516&amp;ref_url=https%3A%2F%2Fen.wikipedia.org%2F) from >way< before 1990, used, most probably resurrected from an old computer - found that one "in the basement", well 10 of them.
  3. 8 x 2.2 kOhm resistors.
  4. optionally, 8 x 1 kOhm resistors and 8 x 3mm LEDs - just for program development, when you either don't have 9750 (which features corresponding LEDs) or want to program "offline"
  5. GFA BASIC 3.6 using only commands from GFA BASIC 3.0 from 1988. 

@evank: Are these conditions matching with the rules of the 9750 hacking challenge? If so, I'll prepare a full report on this :pir-huzzah2:

All the best,
Thorsten

 

Posted (edited)

@Toastie this sounds good to me! I have an idea for a (shhhh!) secret project :classic: ... I'll send you a private message.

Edited by evank
Posted

OK, full report is out :pir-huzzah2: in the Mindstorms Forum. No, I meant the Technic Forum, of course :pir-laugh:. Cross posting is strongly discouraged on EB, so I leave it with the link to that thread as it will drown there in a couple of hours

So this is my second entry for the challenge!

More importantly: When rummaging through my salvaged electronics parts and pieces, I found this:

640x297.jpg

As all of you know, this is a ZX Spectrum main board connector - in MINT condition! I have two Spectrums and did quite a bit of programming and made hardware additions for them back in the days, some 35 years ago. And recently ... so now that the Atari is done, I am considering to get one Speccy in touch with 9750. On the connector, there is everything: Address, data, control lines, power ... and I do still speak a bit of Z80 assembly ... hmmm.

The Speccy has a totally messed up address management, but that is so well documented, I'll find two unused I/O addresses ...

TLG endorsed system, as per @evank are:

  1. Apple II (CPU: MOS 6502, 8-bit)
  2. BBC Micro (CPU: MOS 6502, 8-bit)
  3. Commodore 64 (CPU: MOS 6510, a variant of the 6502, 8-bit)
  4. IBM PC (CPU: Intel 8086, internally 16bit, with 8-bit data bus)
  5. Philips P-2000 (CPU: Zilog Z80, 8-bit)

How many other non-LEGO endorsed systems from < 1992 were used for that purpose? I have added the Atari ST to this list, what else is there? There must be so many! The ZX Spectrum would be Z80/8 bit as well.

  1. Atari 1040 STFM (CPU: 68000, internally 32 bit, with 16-bit data bus)

All the best,
Thorsten

 

Posted

I'm wondering about other systems such as the KIM and Ohio Scientific series (both 6502), TRS-80, and even an Altair.

Posted

Hi Evan,

I studied the schematics of the Sinclair ZX Spectrum a bit and read some moldy magazines (the original paper versions, 1983-1985).

It turns out that 9771 with the help of a custom cable (Spectrum female card edge connector to female ISA BUS card edge connector) with no further electronics needed, should work well. All you have to do is getting the two connectors, solder that cable and that's it.

As I don't have another 9771 (and don't want to get that one card I have off from my XT), I can't try this almost pure LEGO approach. Would have been funny though when TLG had put 9771 into a slick (empty) black ABS box and then sold it off for crazy amounts of money to schools.

The native Spectrum BASIC has the command "OUT address, byte" and the function "byte = IN address". So we're all set.

Best,
Thorsten

  • 4 weeks later...
Posted (edited)

Lil' teaser :pir-laugh:

(I know, this audience is really small, but so is the world)

Finally, I got my Speccy to talk and listen to 9750. I tried the 8255 PIO first - total and utter failure - and then the 9771 approach on the Z80 bus - bummer as well. Why? 1) Stupid me. 2) - 9) see 1). 10) I need to edit the first post 9771/9750 thread regarding the decoding of 74LS373's - it is even better than I thought.

The ZX Spectrum is another computer (introduced 1982) now happily operating 9750. And yes, the magazine in the background is mine from 1984 and yes, this is a carved-out ZX printer case (with the 40 pin socket for the failed 8255 approach and a bread board in the back, along with 2 74LS373's and one 74LS02):

800x886.jpg

The coolest thing though is: I still speak a little Z80 machine code - and as said before, used to crack the copy protection of Spectrum games back in the days - in return for TTL chippies, people "had" to buy me :pir-huzzah2:

More to come.

#8bitisbetter!

All the best,
Thorsten

 

Edited by Toastie
Posted

@evank

Hi Evan, all,

I believe having another entry for the 9750 hacking contest: The Sinclair ZX Spectrum, doing it with a little help of a couple of TTL chips from the late 1970's to mid 1980's. The Spectrum debuted in 1982; I got mine (the one now controlling #9750) in 1985. Should be all within the contest rules:

1280x540.jpg

(The 8 4.5V lamps signal a very important message ...)

Main post is in the Technic etc. forum, even with a stupid 20s video at the end:

Next thing to do is getting my ZX81 and #9750 together. Needs a little hardware tinkering again. Also ZX81 BASIC does not know OUT/IN, only PEEK and POKE, which means I need using the MREQ# Z80 CPU output instead of IORQ# (memory mapped).

All the best!
Thorsten

 

  • 2 weeks later...
Posted

@evank

Hi Evan, All,

just to keep things straight: As posted in the Technic etc. forum, I'd like to introduce another 8bit-wonder from the 1980's controlling (writing to and reading the outputs/inputs) the LEGO Interface A #9750: The Sinclair ZX81, which appeared in Germany in late 1981. I still have my "issue one" machine; fixed the power supply and 16kRAM pack in 2021. Two additional TTL chips were added to the ZX81 "main board" (well, it is only one board, and only a small one); the ZX Printer interface I made for the Speccy is fully compatible with the Zeddy's edge connector exposing the Z80 system bus:

1280x886.jpg

Top: Zeddy hooked up to the ZX Printer interface, which connects to #9750. Bottom: The Zeddy all set-up for playing with LEGO as well.

Here's the link to the main post - as usually with a 10s stupid video showing that the Zeddy actually speaks with 9750):

Here are my three contestants in this challenge in one picture; the monitor is hooked up to a 4-port video/audio switch shared by the three musketeers - and a C64, below the Atari. In the photograph, the Zeddy is hooked-up to #9750 and the screen shows that is had heard from Deep Thought:

1280x731.jpg

BTW, as said in the main post, there was this ad back in the days (1983); well here they are happy - and in color:

640x463.jpg640x392.jpg

All the best,
Thorsten

  • 6 months later...
Posted

@evank

Hi Evan, All,

as just posted in the Technic etc. forum, and as this post will simply sink into oblivion in about a day on that forum, I cross post (:pir-grin:) here, because this the 9750 challenge thread, which drives me, and I would like to bolster my bragging rights on Evan's webpage: I managed to get the Amstrad PCW 8512 "Joyce" from 1985, a Z80 CPU driven 8-bit wonder, to read/write from/to the LEGO Interface A from within BASIC on that CP/M 3.0 system. The BASIC dialect bundled with the Joyce is Mallard BASIC, made back in the days by Locomotive Software.

Here is the link:

Here is the video proof :pir-huzzah2::

https://bricksafe.com/files/Toastie/amstrad-8512-and-9750/Amstrad 8512 LEGO 9750.mp4

All the best,
Thorsten

 

  • 2 months later...
Posted (edited)

@evank

Hi Evan, all :pir-huzzah2:

I just posted in the CADA Technic forum an (almost) full report on getting a TI99/4A controlling LEGO Technic Control Interface A (#9750).

Yes, the post will drown to oblivion in no time, but who cares. I just had a couple of hours in my attic upstairs to compose the post - my wife had her neighborhood birthday party today, I was in charge of preparing the infrastructure, such as additional tables on the patio, sunscreens (it was sunny hot in this region of the Earth), and (oh my) making a dish of tomato/mozzarella with a leave of garden grown basil in between every serving ... that is as far as it can possibly go here, dish-wise ... BUT: I can do the cocktails. That was my premium assignment tonight: Only the first round, though, and then I was allowed to disappear ...

So again, this may be considered cross posting, ashes on my head: Here is the link:

I need to make a video proof; so far all I have is this: The prototype bread board version, operating 6 LEDs and two inputs that fully mimic the hardware of the Interface A (#9750). The video shows that the synthesizer module I used for the hack is still operative and at the same time can talk/listen to #9750 using BASIC for coding.

In that video, I am using TI Extended BASIC along with a 32k expansion board to operate both devices, the speech synthesizer and #9750; controlling #9750 also works with TI BASIC and the mini memory module inserted, that has to be "video proven". :pir-huzzah2:

EDIT: I have more, there always is: Video (of the crappy type but) showing that the 99er can still talk and control #9750:

All the best, and hack the planet,
Thorsten

Edited by Toastie
  • 3 weeks later...
Posted (edited)
On 7/29/2023 at 4:44 AM, evank said:

This thread is for discussion about hacking the Lego set 9750, also known as "Interface A", primarily using 8-bit systems from the 1980s.

Forum members such as @Toastie, @alexGS, and I have long been hijacking other threads :laugh: so it's time to make a new one. Administrator @Jim may move some of the recent posts over here.

From around the middle of the 1980s through the early 1990s, Lego endorsed (via published applications and teacher's manuals) seven programming languages with Interface A: 6502 assembly, BASIC, COMAL-80, Lego Lines, LOGO II, LogoWriter Robotics, and TC LOGO. (As I'm typing this, I just realized that I can't count: I wrote "six" on my website at http://www.brickhacks.com/6.php. It is indeed seven choices! I'll fix it tonight or tomorrow.)

Lego also endorsed five kinds of computers: Apple II, BBC Micro, Commodore 64, IBM PC, Philips P-2000 (and all of the relevant sub-models, clones, etc. -- for example it's perfectly acceptable to use a Laser 128, Commodore 128, generic PC, etc.)

The challenge

How may the system have been hacked, using only technology that was commonly available from 1987-1992?

Rules:

1. Use any computer and any programming language you like, as long as it was for sale in 1992 or earlier (as the next-generation 9751 / Interface B debuted in 1993.)

2. Don't use any add-on hardware that was not available back then. A breadboard is fine; an Arduino is unacceptable.

3. It's okay to run emulators if you do not have original machines, but you can't use any additional features that did not exist back then. You can use Windows 1.0 or 2.0, but not 3.1 libraries, etc.

I'll be the judge, jury, and executioner :laugh: and with permission I'll feature the best answers on my website.

Everything from this point on, ending after Jim's post 7 hours ago, is content that he moved from the other thread.

------------------------------------------------------------------------

Everyone -- @alexGS documented his method, at my request, of using a PC parallel port so you don't need the ISA card. His work is based on Tom Cook's earlier work.

I linked to his document at http://www.brickhacks.com/4.php

Personally I prefer using the original hardware :) and still have a few of the PC kits with ISA cards for sale. I invested a substantial amount of money from this app https://play.google.com/store/apps/details?id=com.payday.advance.money.loan in these, so I'm hoping people here want to buy them!

Thanks for this post! It is very interesting thing to do!!!

Edited by ZeldaWilson

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...