Emailed Thom my code for safe keeping, he seems to have managed to get the code accepted in to Z88DK! Guess that means I infect every project that uses the serial port on IF1 from now on!
The Speccy kids should get the Jetset Willy comments, only regret is not sticking Make-A-Chip in there... Well there is always the clean up version I need to make. https://github.com/z88dk/z88dk/blob/master/libsrc/rs232/spectrum/if1/rs232_get.c https://github.com/z88dk/z88dk/blob/master/libsrc/rs232/spectrum/if1/rs232_put.c
0 Comments
I doubted I would be able to. Nothing like proving yourself wrong.
Managed to take the disassembled ROM code. Remove the offending BREAK routine and Border flicker. Plato works perfectly. So, I have not only had some C code published. I have now written a library/driver, with some assembly in it. Probably to be cleaned up and accepted by a compiler maintainer. Still can't believe the silly buggers put a check on the break key in there, and a half check at that!!! Did you miss me? Who am I kidding no one reads this, I will be lucky if Weebly is around when I am old and losing it. (When I will need to look back at these entries and remind myself of this time in my life.) I write for the enjoyment of it, like a graffiti artist spraying on a subway wall. This is me marking the world in some way. So what have I been doing, well more Plato PLATO PLATO stuff on the speccy. Having refurbished the old machine, checked the Interface1 is "safe", made an RS232 lead up. What do you think I did. I loaded the PLATOTERM up and connected it to IRATA.ONLINE. Bloody worked first time, got the lead correct the code worked every thing went well. Up until I decided to write a note to claim dibs on 48K on-line. Pressed space and the program stopped. After a few repeated attempts, the pattern of the problem wasn't a coincidence. You have some room for doubts with a machine over 30 years old, an interface of similar age with no knowledge of history. Touching a Sinclair Spectrum and having it randomly crash is not unusual behaviour many people have been known to tape EVERY thing down on the table to prevent crashes. Space on the old rubbery key 48K is a special key, it doubles as the BREAK key. Usually in combination with the Caps Shift key, to invoke the BREAK function. Looking at my modern keyboard its labelled as Pause, if you have one on your keyboard its probably dusty but in pristine condition. Its rarely used by most people, there is probably one person that will read this and say "I use it all the time". Great, what for?! Traditionally Break was the big red button for stopping programs that are executing. In today's multitasking multi threaded applications its a little difficult to know what you want to break! So knowing a little history, spotting the blanking (black ink on black paper) at the bottom of the screen it eventually clicked. Hitting space which I didn't need to do signing on, selecting menu items etc was causing the Break to fire. OK so why do we get a break event on a 48K and not on the +3. Thom's cool head got me in to line, back to basics he sent over 2 programs. One a key code print program, easy press key get 0x## hex code for the key. The second program was a tiny terminal, basically read a key send the key check for RS232 inbound data. Nothing exciting about the key codes. Really didn't take long to find the fault was still present with the tiny terminal. In a way its nice to know the main PLATO application wasn't at fault. After some playing about with tiny terminal it became apparent the break key was detected if Space/Break was pressed during and RS232 operation. Having looked at the fairly empty library files and Z88DK dev team confirming what was suspected. The library files are just wrappers for the ROM code routines. Z88DK developers gave Thom a bunch of tricks to try and clear the keyboard buffers etc to avoid the problem. I suspected the problem would inevitably be the ROM code itself, based on gut/experience. (Sods law, Murphy's law its that one place we don't want the problem to be!) The tricks worked well enough that I managed to post a note. It went from 100% failure on pressing space to 1%, you have to try to break out but it can still happen. Never expected to ever have a reason to look through the ROM disassembly of the spectrum. Surprising how the simplicity and almost beauty of assembly comes back to you. Nice to see comments in code to! Slapped boldly just before the bit banging of the line for data transmission, a call to check for "Break key". ...Sigh... Not a full check for break and Caps Shift, no just a quick cheeky check on the one key. Why would you do that?! From what I can tell, the RS232 port was only really intended for use with printers (back in the day serial printers were a thing). The ROM routines had been written with this in mind, hitting space/break would let you quickly stop a print job. The CPU bit bashing the port would lock the machine in to a fairly tight loop, this was the quick safety feature to stop printing. A design feature that would have stopped any one using basic for writing even a simple terminal application. If Clive Sinclair really wanted his machines to hit the Business market terminal applications would have been a big selling point. Granted there were modems devices sold, but a basic serial port enabled machine opens doors. Its impossible to know what was going through someones head at the time. May be the code was rushed known to be buggy so they just sold it as to be used for printing. Looking at the disassembly of the IF1 ROM thankfully its well documented with comments. Finding the serial routines was not difficult, commenting them out wont be difficult. Getting the entry and exit conditions well that might take a little work. ;; REC-BYTE One of the fun things about doing this sort of thing is leaving little Easter egg comments in the code. Some day it might snake its way upstream and sit in code that someone reads through looking for answers. It might just make someone smile at a time when they really need it! (P.S. Sorry if this code has screwed your project up!) ; OUT ($FE),A ; Change the border colour. - No Thanks Jetset Willy change the borders in program if wanted Hard part is trying to get the ASM code to start and end as required so not to crash. I have a lot of crashing going on, which is nice because I am changing things and it is having an effect on the system. Keep at it and we will see how long this takes...
Fitted the membrane for the keyboard. Had a problem with the keyboard randomly going from working to totally dead. From what I can make out the tracks on the membrane shorted out on the shielding on the video output. A dash of insulation tape over the metal parts confirmed it. I moved the tape to the membrane to be sure it won't catch anything else. Both ribbons insulated and the case closed, can't help but wonder if that was the problem with the original. The old membrane is packed away safe, it might be working but I am not up for any faffing today. Still not feeling great.
Interface 1 tested and working, did a little scrubbing on the edge connectors with white vinegar. Turned the queue tips from which to dull grey, so something has been removed. The IF1 seems to work, that is the basic interpreter works still on the spectrum. Usual childish 10 print "profanity" 20 go to 10 test program worked. Need to work on the RS232 cable pin outs. Hopefully better tomorrow and I can get the soldering iron out and get the leads made up. Then get on Irata.online, oh to be the first again would be nice. Issue 1 48K meets the PLATO over the internet. Feeling like crap today. What started as a throat infection kept me up with a cough, today is aches and pains.
Found randomly dumped in the porch was a jiffy bag though with the IF1. I've had a quick look over and clean of the connectors this evening. It has been fixed in that Sinclair style, so hopefully it works. So turned out not to be the power lead from the PSU to spectrum. Having un-soldered one of the wires and testing continuity ever thing was fine. I reassembled the PSU tested it on the bench every thing was fine. Took it back in the house plugged it in setup, nothing worked. Tested the output, 1V again! After some muttering and wire wiggling nothing changed, until I knocked the PSU with my foot. 7V appeared on the meter, OK half the output very odd. Best bet was a dry joint. Out to the garage, re-soldered every thing. Tested and working now.
Well the power supply is working. The next problem was the classic membrane failure on the keyboard. I might have been able to live with it, if it wasn't a fault on the row with J on it! So opened it the speccy up again and had another look at the ribbons from the keyboard. Other than the discolouring there was a faint crack just above the connector on one side. It was worth a cheeky hack attempt, so I snipped it off just above the crack. Didnt work, actually made it damn near impossible to re-install. After several attempts I went from no keys to a few keys and back again. Seating the ribbon is a pain.
Ordered another online just under £10 including postage (UK), www.dataserve-retro.co.uk So there have been some more updates on the irata.online code based on my work. Thom has taken on some more fine tuning with keyboard detection. I put in some Rasta bars and keyboard click as general UI improvements. They seems to have gone down well, the keyboard click was more of a burp. I think Thom has improved on my place holding burp, yet to see. My attempt to use the "click()" failed, guessing it needed a loop and calling a few times to kick the speaker. -dunno-
The Irata.online project is bounding forwards its admirable the force being thrown in to porting the code across systems. I ran through code with Thom for a few hours looking for an illusive bug. Issue with Talk and Bad passwords causing the cursor to mysteriously re position and over type causing no end of mess. I had a hunch about it being joined to the blank line process, damned if I could find my way through the code. Thom found it and the reference in the documentation to requiring a -15 being required to correct the position after clearing the line. Having only tested with the +3 I thought I should look at checking the Interface 1 RS232 code. There is a big assumption its just working. I had a scan through the assembly routines, there is very little in there probably calling ROM code (no comments can't tell!).
Next shot is Z80 from Gerton Lunter, I actually had a copy of this as shareware and is possibly the only shareware I upgraded to full version as a teenager. Serial port didnt work this time, but keyboard was fine. Given 3 emulators presented 3 different issues, I am giving up at this point. Fair to say a software defined port emulated and then using an actual buffered serial port is going to be a bust for testing. Even if it all worked, would it work on real kit?
After some contemplation I did the next silly thing. Jumped on ebay and found an IF1 for £38 including postage. No microdrives, just the interface. Not sure I would want and actual microdrive they like to chew tape too much, far to impractical. VDrive on the other hand... Well may be for Christmas?
Quick sanity check with the Spectrum group on Facebook. Peter Mulholland got it spot on with the cable being most likely at fault. Opening the PSU and testing at the board I found a nice 11V, slightly hot but with no load that is expected. Just need to cut the cable down and re-attach to the board. PSU actually looks to be in good condition. The casing looks to have warped a little, but I think that is from past problems. This old things had a repair or two over the years. Hopefully it will hold it together for the testing!
So with power under control next is a quick visual inspection on the old 48K. See if we have any leaking capacitors, bits of metal or other nasty surprises. The keyboard membrane looks to be in good condition, the ribbon on the right seems suspect. If a row of keys isn't working on one side I know what it will be. All in all it is looking good in the case. Once the PSU is fixed up, I will just need to pray to the gods of silicon heaven. And pray the soul doesn't come out the back of the machine on power up. Worst case its off to a repair shop, "paging Dr Ian" the frequent call on Facebook group.
|
AuthorMe, slightly crazy engineer type. Generalist in nature, hardware or software with nonspecialist skill set. Archives
January 2020
Categories
All
|