Playing with Sinclair ZX81 / Timex Sinclair 1000 / Timex Sinclair 1500
Bean
Posts: 8,129
I saw my old Timex Sinclair 1500 and decided to hook it up and do some Z80 assembly language programming.
I was surprised how many of the opcodes I remembered by heart.
The ZX81 is terribly slow at printing values, so I wrote a routine to print integer values quickly.
First I had to convert the floating point format to integer, then print the integer values.
It took a couple days (maybe 4-5 hours all together), but the routine is 10 times faster than BASIC.
Just for the heck of it here is the routine:
The Timex Sinclair 1000 was my first computer and I've owned several of them, but the keyboard makes me want to shove an ice pick in my eye.
I just can't stand it. So when I saw a Timex 1500 on ebay a couple years about I got it and it is MUCH nicer to type on.
Bean
I was surprised how many of the opcodes I remembered by heart.
The ZX81 is terribly slow at printing values, so I wrote a routine to print integer values quickly.
First I had to convert the floating point format to integer, then print the integer values.
It took a couple days (maybe 4-5 hours all together), but the routine is 10 times faster than BASIC.
Just for the heck of it here is the routine:
'ZX81 Print Integer Value LD HL,(VARS) 2A 10 40 ' Point to first variable INC HL 23 ' Skip variable name INC HL 23 ' Point to MSB value byte LD B,(HL) 46 ' Get MSB BIT 7,B CB 78 ' Is value positive (>=0) ? JZ Positive 28 03 ' Yes, jump ahead LD A,"-" 3E 16 ' No, print a "-" character RST 10 D7 Positive: SET 7,B CB F8 ' Set implied bit DEC HL 2B ' Point to exponent value byte LD A,145d 3E 91 ' Prepare to do 145-Exponent SUB (HL) 96 ' Subtract exponent INC HL 23 ' Point to LSB value byte INC HL 23 LD C,(HL) 4E ' Get LSB JR Skip 18 04 ' Rotate value A-1 Times Again: SRL B CB 38 ' Shift 16 bit value in BC right (/2) RR C CB 19 Skip: DEC A 3D ' Adjust counter JNZ Again 20 F9 ' If not done, rotate again PUSH BC C5 ' Move BC to HL POP HL E1 LD E,0 1E 00 ' Zero digit sum ' If E is zero the digit will not print ' because it is a leading zero LD BC,-10000 01 F0 D8 ' Do 10,000s digit CALL Digit CD C2 40 LD BC,-1000 01 18 FC ' Do 1,000s digit CALL Digit CD C2 40 LD BC,-100 01 9C FF ' Do 100s digit CALL Digit CD C2 40 LD BC,-10 01 F6 FF ' Do 10s digit CALL Digit CD C2 40 LD A,"0" 3E 1C ' Do 1s digit with simple addition ADD A,L 85 RST 10 D7 RET C9 ' Done Digit: LD A,"0" 3E 1C ' Set digit to 0 IncDigit: INC A 3C ' Assume next digit INC E 1C ' Adjust digit sum ADD HL,BC 09 ' Next digit again ? JC IncDigit 38 FB ' Yes, jump DEC A 3D ' Undo assumed increment SBC HL,BC ED 42 ' Restore value to previous DEC E 1D ' Undo assumed increment RETZ C8 ' If digit sum is zero, done (leading zero) RST 10 D7 ' Print digit RET C9 ' Done 78 bytes
The Timex Sinclair 1000 was my first computer and I've owned several of them, but the keyboard makes me want to shove an ice pick in my eye.
I just can't stand it. So when I saw a Timex 1500 on ebay a couple years about I got it and it is MUCH nicer to type on.
Bean
Comments
LOL,
I had one around 1982 (and a portable 5" TV). Think I gave it all to a pirate ... arrgh ;-)
A classic machine that got many a youngster into electrical or software engineering careers.
However, I suspect the best thing to do now is put it in your family heir loom display cabinet and play with ZiCog or qz80 on the Propeller when you need that Z80 assembler coding fix.
The original code may have been written more for compactness than for speed. After all, they did have to squeeze in a complete BASIC interpreter into 16K ROM.
Here's a listing of the ZX81 ROM:
http://www.wearmouth.demon.co.uk/zx81.htm
(The TS 1000 may be slightly different, though)
I just discovered Micro Men recently, brilliant movie. From my recollection, having been following Clive Sinclair since the days of the matchbox sized Micromatic pocket radio, and then Acorn with the advent of the microprocessor era, it all seemed remarkably authentic. Including the famous bar brawl between Sinclair and Chris Curry which was head line news at the time.
As teenagers we called Sinclair "Uncle Clive", that was years before the computer business. It was as if he was our crazy genius eccentric uncle that kept coming up with these fantastically clever inventions and solutions to problems but the products themselves were pretty much universally Smile. His scientific calculator was a huge break through on size and price but the accuracy was generally worse than using log tables. (Yes we used log tables in school about that time).
Anyway I don't recall that MicroMen makes much of a point about how those geeks hurriedly finishing the BBC computer were the ones who created the ARM processor leading to the mobile world we have today.
Another colleague of mine bought a Sinclair audio amp. He found that he could get acceptable audio quality out of it at low power levels, but there was horrendous distortion at the rated power output. He phoned Sinclair about it. I can't remember the response, but he could hear a baby crying in the background. He must have been talking to Sinclair himself, who was running his business from home at the time and had a young family.
I had a Sinclair Audio amp as a teenager. The "Project 80" twenty five watt stereo kit. It was great, with its scratchy, wobbly pots and all. I don't recall any distortion issues but then I could never play it very loud at home. The best part was that when I got to university it made an excellent receiver for the campus radio station!
Thanks, but my code only displays integers from -65535 to +65535 stored in the first variable defined.
I could make it much faster by not using the ROM "RST 10" instruction to print a character by instead just poking it into screen memory, but then it wouldn't work if you had less that 4K of RAM or if you use the SCROLL command.
Both of these produce a "collapsed" display memory map. Which must be expanded before a character is poked into screen memory.
Bean
I plan to use it to interface to a Propeller since all the parts are easily replaceable in case I release the magic smoke. In fact I built a circuit with the Propeller that reads "P" files off a SD card and translates that to the audio input for the TS1000 loading circuit.
Always nice to see someone still working with the Timex Sinclair's.
One of the first projects I did with micros was a cable assembly tester for a military contractor. Still tickles me when I see one of those multi-million dollar ships, knowing all the electrical cable assemblies were tested and documented with a Sinclair-based test system.
Code on!
Cheers,
Oh, yes, I have seen BBC Micro Computers in the test rigs of fly by wire systems for the Air Bus. Many, many years after the "beeb" dropped into the history books.
http://articles.courant.com/1994-04-18/news/9404180144_1_robots-hot-wheels-maze
Notice the last line in that article?
And now a robot vacuum is a favorite robot base by many.
The Sinclair ZX80, ZX81, ZX Spectrum all had their entire data and signal busses exposed on an edge connector. That made it very easy to adapt for HW control purposes.
You can use a very simple 1 transistor circuit to convert them to composite video output.
The contrast isn't great, but it's much better than the channel 2 or 2 picture.
If you want to play around with a Sinclair machine I high recommend finding a TS1500.
It has a usable keyboard, 16K built-in, and if you have the 16K ram pack it will have 32K (the internal RAM moves when the RAM pack is plugged in).
Has anyone used the ZXPand device ? I was going to get one, but they don't work with the TS1500 because it blocks the power and cassette ports on the back.
Bean
Once I discovered this I was hooked as I could actually control things with my Timex Sinclair 1000.
Bean
This has nothing to do with computers or electronics but I met Sir Clive several times over a span of thirty or so years.
We both belonged to the same organization and he was much sought after as a speaker at conventions.
Meeting with our group was likely a side trip to other much more serious business that brought him to the colonies.
The one thing he and I had in common was an appreciation for a well planned and executed party. Not once in all those years did anything to do with electronics or business come into our conversations. It was always a delight to have him seated at the table.
The Timex Sinclair 1000 was my first computer and my parents bought it at a local grocery store. It came with the 16K ram pack and was $100 with receipts showing you spent $100 at the store in the past month.