evank Posted July 29, 2023 Posted July 29, 2023 (edited) 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 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 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 in these, so I'm hoping people here want to buy them! Edited August 3, 2023 by evank Quote
BatteryPoweredBricks Posted July 29, 2023 Posted July 29, 2023 7 minutes ago, evank said: 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 in these, so I'm hoping people here want to buy them! That's great! I used Tom Cook's method many years ago, but the last time I tried it didn't work for some reason. I'll blame software rather than my soldering skills , the laptop I was using died (along with my 486 laptop ). Also the link is a 404 with that extra period at the end Quote
evank Posted July 29, 2023 Author Posted July 29, 2023 Thanks Brian. I fixed the link. I know a couple of people, on and off this forum, who are interested in making Interface A work on an Atari 800/xl. In addition to using hardware no endorsed by Lego, I'd also like to know if anyone has used programming languages not endorsed by Lego. For example on my (under construction) code page at http://www.brickhacks.com/6.php, I list the six systems that Lego documented: 6502 assembly, BASIC, COMAL-80, Lego Lines, Logo II, LogoWriter Robotics, and TC Logo. I also have a bullet point there (and soon, an aftermarket book scan) where someone documented using Pascal for this purpose. I'm wondering if anyone has published instructions for other languages. If not, then EB forum readers should consider this a challenge! :) Quote
Toastie Posted July 29, 2023 Posted July 29, 2023 8 hours ago, evank said: I'm wondering if anyone has published instructions for other languages. If not, then EB forum readers should consider this a challenge! :) Challenge accepted :D (I believe we are in the wrong thread here, aren't we? Don't know ...) Regarding the control of Interface A (9750): What works as well in addition to the references you are listing on the 6.php page on your website is using the serial port of >any< computer, modern, semi modern or vintage with a little extra, an Arduino Nano (or any other of the smallest microcontroller boards put there featuring programmable 8 I/O ports). Even TCLogo in the serial port version @alexGS made as well, runs on a Win11 machine using DOSBox-X as vintage PC emulator. The modern machines can do that via USB2Serial ports - they are still addressable as classical COM ports. References are on EB. I used QBasic 1.1 for direct (as interpreter) interaction with 9750 as well as QuickBasic 4.5; with the latter I made a EXE/COM files which run on an original IBM XT using its parallel port, serial port as well as via 9771 - you can select the I/O route within the program. These run as well on a 1998 Toshiba 4090 laptop with serial and parallel port, and as said on modern Win machines w/DOSBox-X emulator. Files are all on Bricksafe and are discussed here on EB as well. With regard to the Atari: I recently talked and listened to 9750 using GFABasic on an Atari 1040 ST(FM); needed to first fit the Atari with a Gotek to get some software running (GFABasic, C, PASCAL) and study its hardware a bit. The VT52 emulator on the Atari lets you also talk (and listen) to 9750 - with the help of my little Arduino board running a 5 line C++ "code" . Oh, just for fun: I ran PCDitto (a DOS emulator) on my Atari - then ran my DOS 9750 control program made for the IBM XT on it; gues what: When suing the serial port communication, it talked to 9750 as well - but super slow. I am currently investigating the Atari's parallel port capabilities, which are a bit "different" from the classical "Centronics" configuration. Of particular interest in the GFABasic access via OUT/IN addressing. It appears as if the ST can read and write from/to that port, which in turn raises the question, whether the outputs are latched or not; if not then a read request may change the outputs; and apparently this is also happening because TOS does that frequently. In that case, either a 9771 analog TTL latch approach or an Arduino Uno will do the trick; I'd simply use hat one for latching the parallel data provided at the Atari printer port (in and out). Again, with about 5 line of C++ "code" ... So as said challenge accepted. I am travelling for three weeks - shall think about this and that during that time, and upon my return look further into the Atari world. BTW, the ZX Spectrum, which controls already my train layout, should also be well suited to talk to 9750. Fro sure via it's serial port. All the best, Thorsten Quote
evank Posted July 30, 2023 Author Posted July 30, 2023 (edited) @Toastie -- I meant in the context of only the original Lego-endorsed hardware. Not using modern PCs, microcontrollers, or any other aftermarket hardware. (An exception would be custom cables.) Edited July 31, 2023 by evank Quote
Toastie Posted July 31, 2023 Posted July 31, 2023 (edited) 16 hours ago, evank said: I meant in the context of only the original Lego-endorsed hardware. Not using modern PCs, microcontrollers, or any other aftermarket hardware. (An exception would be custom cables.) Ahh, I see. That includes QBasic and QuickBasic from Microsoft as well, doesn't it? Both are from the time of TC - and both run on an IBM XT with 256 kByte of memory. This is the configuration I have: IBM XT (5160) with CGA, parallel, serial cards; in addition it has a 9771 card. The QuickBasic program I wrote for this combo works flawlessly with 9750; it can't do PWM at the 125 Hz pace (1kHz resolution) as TCLogo does, since the Basic code is simply too slow on an IBM XT - as is IBM Basic. This program (running on the original IBM XT, 4.77 MHz, 8088 CPU) can do the communication with 9750 via 9771, the parallel (with the cable @alexGS has described (https://www.eurobricks.com/forum/index.php?/forums/topic/192941-lego-interface-a-97509771-–-lego-technic-control-1-tc1-referenceideas-thread/&do=findComment&comment=3581909), and serial ports (with an Arduino, so that is out of the challenge) as summarized here: https://www.eurobricks.com/forum/index.php?/forums/topic/192941-lego-interface-a-97509771-–-lego-technic-control-1-tc1-referenceideas-thread/&do=findComment&comment=3619101. You simply select your communication hardware by pressing "X" repeatedly and then "space bar" to find out, whether 9750 is present on the respective card - or not. So IBM XT + 9771 and or + parallel card should be along the challenge rules, right? Next question is: If I can get the Atari 1040 STFM with only a custom cable operating 9750, would that count as well? All the best, Thorsten Edited July 31, 2023 by Toastie Quote
evank Posted July 31, 2023 Author Posted July 31, 2023 @Toastie - I haven't used Qbasic much. Did you start with the same 9771 initialization code as in regular BASIC? --------------- 1000 'INIT 1010 P=925 1020 OUT P,21 1030 OUT P,0 1040 RETURN Quote
alexGS Posted July 31, 2023 Posted July 31, 2023 (edited) On 7/25/2023 at 7:14 AM, evank said: Nice!! <Edit - Looks like I replied to the wrong thing. Sorry> Indeed - I think everything from this post onwards needs to be a new discussion, as it doesn’t have anything to do with Control Lab? I was confused :) There is Thorsten’s thread about Interface A, but it’s long already Edited July 31, 2023 by alexGS Quote
Toastie Posted August 1, 2023 Posted August 1, 2023 (edited) @Jim Hi Jim, sorry for bothering you but @evank and most prominently I have seriously derailed this thread, @BatteryPoweredBricks opened - which is meant to address and discuss Dacta Control Lab stuff. Quick question, if we open a new thread dealing with "ancient hardware controlling ancient 9750 (Interface A) using ancient software (everything <1990 or so), would it be possible that you (or other moderators move all entries wrongly placed here (that is all posts including and after this one https://www.eurobricks.com/forum/index.php?/forums/topic/67665-dacta-control-lab-software/&do=findComment&comment=3633756) to that new thread? Thanks in advance + best regards, Thorsten Edited August 1, 2023 by Toastie Quote
Jim Posted August 3, 2023 Posted August 3, 2023 On 8/1/2023 at 11:54 AM, Toastie said: @Jim Hi Jim, sorry for bothering you but @evank and most prominently I have seriously derailed this thread, @BatteryPoweredBricks opened - which is meant to address and discuss Dacta Control Lab stuff. Quick question, if we open a new thread dealing with "ancient hardware controlling ancient 9750 (Interface A) using ancient software (everything <1990 or so), would it be possible that you (or other moderators move all entries wrongly placed here (that is all posts including and after this one https://www.eurobricks.com/forum/index.php?/forums/topic/67665-dacta-control-lab-software/&do=findComment&comment=3633756) to that new thread? Thanks in advance + best regards, Thorsten Yeah sure, that's possible. Quote
evank Posted August 3, 2023 Author Posted August 3, 2023 (edited) (Deleted by Evan due to redundancy of merged threads) Edited August 3, 2023 by evank Quote
evank Posted August 3, 2023 Author Posted August 3, 2023 (edited) (Deleted by Evan due to redundancy of merged threads) Edited August 3, 2023 by evank Quote
Jim Posted August 3, 2023 Posted August 3, 2023 Like this? I have included the last post, sorry. Not a big deal. You can edit the first post to the "new first post" Quote
Toastie Posted August 3, 2023 Posted August 3, 2023 37 minutes ago, Jim said: Like this? Perfect! Thanks a lot @Jim!!! And thank you @evank for creating this thread! Best regards Thorsten Quote
evank Posted August 3, 2023 Author Posted August 3, 2023 (edited) @Toastie and anyone else fluent in German: I scanned a period Lego robotics book (written in German) and my friend posted it on the Internet Archive: https://archive.org/details/sundr ... It's not yet in the correct collection, but I will fix that soon. Chrome translated the raw text into English for me. Unfortunately it is not formatted and there are several errors. I put that file onto my Google drive and made it public at https://drive.google.com/file/d/1K_AJxvJdXLtW-vEFCQ_nv0cSR30QxX4S/view?usp=sharing. Can someone do a proper translation? I have written permission from the author, but he didn't have time to do this. According to the table of contents, there are sections about programming 9750 in C and Pascal! So if it takes too long to translate the whole book, then I'd love for someone to focus on just those sections. I know @alexGS feels the same way. He really wants to use Pascal! Edited August 3, 2023 by evank Quote
Toastie Posted August 3, 2023 Posted August 3, 2023 On 7/29/2023 at 3:44 AM, evank said: 1. Use any computer and any programming language you like, as long as it was for sale in 1992 or earlier Oh yes! This includes my Atari 1040 STFM!!! And I can use GFABasic 3.0 ... will take some time to come up with a decent program, as I a) never had an Atari back then, b) never did GFABasic with all the million commands and functions it provides, and c) the parallel port access is, well, interesting. So my first entry is this QBasic1.1 (interpreter)/QuickBasic4.5 (compiler) program; these are essentially identical; QuickBasic has a couple of interesting features, QBasic does not have. QuickBasic version 4.5 came out in 1988. Source Code: https://bricksafe.com/files/Toastie/lego-interface-a---9750---9771---tclogo/tc-meets-pup/Q9750_9.BAS DOS 3.3 or higher EXE file: https://bricksafe.com/files/Toastie/lego-interface-a---9750---9771---tclogo/tc-meets-pup/Q9750_9.EXE The program has 4 "modes": Simulation (SIM), parallel (PAR), serial (SER), 9771 (LGO). Pressing "X" circles through the modes; pressing the space bar tries to access "nothing" (SIM), an ISA parallel card (PAR), an ISA serial card (SER), or the LEGO 9771 ISA card (LGO). If the respective device is not present, only the serial mode requires breaking the program (^C) - all other modes except SIM raise an error and the program simply continues. ESC ends it. In SIM mode, everything can be tried out - pressing the numbers 0 - 5 turn the outputs of 9750 on/off. The text on the left should be self-explanatory, I hope. Program start: In DOS or a DOS emulator type q9750_9; main screen appears; program is in SIM mode. Press "o" for enabling the 6 outputs of 9750, then play around. User programs can be started; you need to code them in QuickBasic though. UserProgramA is currently used (in the q9750_9 program) to run the "Dacta arm" as shown in this video, just ignore the PoweredUp stuff; the IBM XT is doing all the work: https://www.youtube.com/watch?v=-6WI4i-TcYs In SIM mode you can start the user program as well; the outputs will be turned on and off accordingly. Some steps require one of the two counters to reach a certain limit - or there is a pause of x seconds. Just press space bar to skip this step. Used this to check the program flow. Best regards, Thorsten Quote
Toastie Posted August 3, 2023 Posted August 3, 2023 3 hours ago, evank said: Can someone do a proper translation? I have written permission from the author, but he didn't have time to do this. Hi Evan, I downloaded the book and had a look. That is a nice one! The LEGO lines section is not that important, is it? Core to the matter in the Pascal section is having a software package called the "LEGO TC Controller", which is a collection of files providing the commands for direct and Pascal program access to 9750. Is this software available? As you have permission of the author for the translation: Is that my colleague Helmut Albrecht? Did you ask him about this software required? Best, Thorsten Quote
evank Posted August 3, 2023 Author Posted August 3, 2023 He's your colleague? LOL, small world!! I only asked him about permission to scan/upload the book and interpret it in English. I didn't ask about software, because I didn't know there was any. As I said though, ideally we'd have an English translation of all of the Pascal matter, and also the Turbo C matter that he covered. Quote
Toastie Posted August 3, 2023 Posted August 3, 2023 (edited) 39 minutes ago, evank said: He's your colleague? Oh well, he is a math prof at his university, and I am a chem prof at my university, and thus we're colleagues - I don't know him personally. So the world is not >that< small. Time is indeed an issue. I'll retire in 5 1/2 years ... But maybe I can extract the most important aspects? Best, Thorsten EDIT: I read a bit further - the world is weird The new commands provided in the LTCC.TPU include file for (Turbo) Pascal are to 90% available in my QuickBasic program: DECLARE SUB BitOn (Bitnumber AS INTEGER) DECLARE SUB BitOff (Bitnumber AS INTEGER) DECLARE SUB GetSensorBits (ClearInputStatus AS INTEGER) DECLARE SUB InterfaceInit () DECLARE SUB OutputsOnOff (OnOff AS INTEGER) DECLARE SUB SetMotors () DECLARE SUB ClearCounter (Counter AS INTEGER) DECLARE SUB WaitSeconds (Seconds AS INTEGER) DECLARE SUB Trigger (Bitnumber AS INTEGER) Missing is "SetPower" (as Alex knows, I am working on this; needs machine code though ;) - other than that it is all there But yes, I know, you want to do C and Pascal ... Edited August 3, 2023 by Toastie Quote
evank Posted August 3, 2023 Author Posted August 3, 2023 When you said colleague I thought you meant it literally. Quote
alexGS Posted August 4, 2023 Posted August 4, 2023 Thanks for starting this thread - I’m watching with nervous excitement :) I don’t know anything about Pascal and the chances of finding those libraries seem slim, but at least we’re a bit closer to learning how the 1092 plotter was programmed in an old scan/photo I saw somewhere (where Pascal was shown). Quote
evank Posted August 4, 2023 Author Posted August 4, 2023 I emailed the author again to ask about the disk. I didn't know there was an accompanying disk until Toastie mentioned it today. Quote
evank Posted August 4, 2023 Author Posted August 4, 2023 1 hour ago, alexGS said: Thanks for starting this thread - I’m watching with nervous excitement :) I don’t know anything about Pascal and the chances of finding those libraries seem slim, but at least we’re a bit closer to learning how the 1092 plotter was programmed in an old scan/photo I saw somewhere (where Pascal was shown). Do you still have the picture? What was the source? Quote
Toastie Posted August 4, 2023 Posted August 4, 2023 (edited) 22 hours ago, Toastie said: But yes, I know, you want to do C and Pascal ... @evank, @alexGS and all others: OK, things become much clearer now in regard to that "LEGO TC Controller" book you scanned, Evan. There are principally two different approaches described in the non-LEGO Lines sections: Using IBM BASIC, Turbo C, and also COMAL (which to me is very similar to QuickBasic) Using the "LEGO TC Controller" program as provided by TLG in a) direct mode and b) as unit in Turbo Pascal. A unit in TP is a "module", you can transparently use in your TP program; well, did some minor TP programming back in the days for spectra analysis. In the Turbo C (from Borland; the book deals with the DOS versions only) section of the book (chapter 6.2), a number of routines written by the authors are presented, which do what makes life easier when wanting to work with Interface A. On the hardware side you need an IBM PC or compatible and the LEGO 9771 ISA card. The latter is easily exchangeable with an ISA parallel card; note that in this case you need to use two different ports and the special parallel cable, @alexGS has documented. This is not covered in the book, though; here only the I/O address of 9771 is used (925 dec for in and out, alternatively 926). For Turbo C, every service routine the authors provide (like BitOn, BitOff, Count, Delay, Time etc.) essentially rely on two C-functions which calling the x86 processor directives "var(byte) = in(addr)" and out(addr,var(byte)). These functions called "inportb" and "outportb" come with the Turbo C program package not included in the book, which you need to #include when you want to use them. They are part of the dos.h file of Turbo C. So all you have to do is put "#include <dos.h>" at the top of your C-program. With that you have the functions unsigned char inportb(int portid) void outportb(int portid, unsigned char value) available in your program. Usage is straight forward: "outportb(925,5)" will turn on 9750's outputs 0 and 2; "char test = inportb(925)" will read out the entire 8 bit wide status of 9750, i.e., the two inputs and the six outputs. As the authors state: "The entire interface control is handled by these two functions". All other functions are convenience functions to make life easier, e.g., turn one individual bit on/off or read only one input bit of 9750 calling a function with parameter: "int ein(0)", "int aus(0)", "int toggle(0)", etc. etc. Yes, functions names are in German; "toggle" is not though, I guess "hin-und-her-schalten" was too much and even in 1990 kids in the classroom may have already adapted to "cool", "f*ck", and "toggle" All C-functions are listed in the book, so if the disc is not available anymore, I can surely adapt them to English. As said, COMAL looks to me like QuickBasic - it has the line indentions in the editor window, no line numbers, and essentially the same vocabulary. So nothing new here, I guess. Again, convenience functions and routines are presented, centered around in(925) and out(925,byte) - as I did in my QuickBasic program, so it is all there already A somewhat different story begins with chapter 7: Here, the LEGO TC Controller program (control.exe, provided by TLG) is loaded (residently) into memory and then can be used either directly to control 9750 by pressing buttons (as with my QuickBasic program) or by running TurboPascal programs with control.exe used as unit and thus functions are called within TurboPascal. (The equivalent are my "UserProgramsA,B,C ... within my QuickBasic program): It says below the (c) info: "The LEGO TC direct control module V2.00 is loaded into memory. Call with <ALT> + <i>". For your LEGO history research @evank that means there must be a control.exe program designed by TLG for DOS/PCs out there; they call it "LEGO TC Controller". I have never heard of it, but that does not mean anything. The big advantage of control.exe is, that it is a) resident in memory, b) easily accessible by TurboPascal (and I bet by other compiler languages as well, once you know the hooks into it - it would be a blast to see whether it can be linked to in QuickBasic), and c) the SetPower command (PWM) availability. I bet they do the same thing as they did with TCLogo with that 1kHz interrupt handling!!! Usage within TP is as follows: Load controller.exe into memory (within the DOS shell). Return to DOS prompt. Load TP. Write a program with the units TP has access to by default (you can check that within TP) plus declaring: "uses LTCC.EXE" in the top section. That's it, and you have access to all the bells and whistles of control.exe. Oh my here it comes: This says "According to the [LTCC] manual, LTCC can be activated i) within a DOS shell, ii) from a (program) editor, e.g., the TurboPascal IDE, from a running program." And that is it! Full-blown 9750 access at your programming fingertips!!! It could be that the LTCC control.exe file is on the disk accompanying the book: This reads: "This book comes with an accompanying disk for IBM-PCs and compatibles. The disk is organized in the following manner (see above) and includes the program files listed in the book. Maybe control.exe resides in the <LTCC> folder? Maybe not; it sounds to me like another expensive piece of TLG software? EDIT (sorry for being that disorganized) I believe, control.exe and all the other files you need for accessing the code in TP are indeed part of the software package "LEGO TC Controller". This package also had update versions: This reads: "Over the past years, new versions of Turbo Pascal (upgrades) came out. Accordingly, there are several object code versions of the LTCC.TPU unit on the LEGO TC Controller master disk (...)" Summary: We desperately need the LEGO TC Controller software package(s). Best regards, Thorsten (P.S.: If you don't need PWM, simply use my QB program - it does the same + has the parallel and serial port support (+simulation mode) as well). Edited August 4, 2023 by Toastie Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.