I found a post over at Cemetech by [Zeroko] claiming the T6A43 (z80 VLSI) in the TI-86 and TI-81 must have a wait-state added to every M1 cycle to account for some assembly timing oddities...
I came to a similar conclusion prior to finding that post... My autobaud function was measuring something like a 5.1MHz CPU clock, while my CPU frequency meter was measuring more like 4.7. So, on finding that forum post about an extra T-State for every instruction, I thought I must've been on the right track.
Rewrote all my UART bitbanging code, autobaud, delay_TStates, CPUFreq, etc. to account for that (recounting T-States and revising math in *numerous* libraries)...
And now it doesn't work.
Weird thing is, now autobaud and CPUFreq are measuring nearly the same clock frequency.... about 5.2MHz
What'd I do wrong...? Heh.
FYI: adding a wait-state to M1 cycles is apparently common-enough z80 practice as to be documented in the z80 datasheet. It makes for equal memory-access timings for all cycles, which is probably unnecessary with today's (or even TI-81-era) fast SRAMs, but makes sense that an era-VLSI like the T6A43 designed around a z80 might include it, since /adding/ it later isn't an option due to the lack of WAIT and M1 pins.
This document lists the T-State count for every z80 instruction, with and without an M1-wait.
Basically it amounts to adding a single T-State to every CPU instruction. But, of course, some assembly "instructions" are actually *two* CPU instructions under one name: e.g. using IX/IY is done by an instruction that basically says "for the next instruction, replace HL with IX." Thus the single assembly instruction is two CPU instructions, thus having two M1 cycles, thus, likely, two wait-states.
My thought is that there really is no reason to expect the T6A43 (or any other implementation) to deviate from this table, owing to the *purpose* behind adding an M1 wait. Though, I suppose it's /plausible/ the z80 core in the VLSI may differ in implementation slightly from the original z80 (e.g. maybe they figured out how to speed up an instruction, here or there, which they likely would NOT do on a z80 chip, for compatibiliy-sake, but might do-so in a z80 core intended for an embedded application... the Gameboy's slightly-different z80-alike comes to mind).
FYI2: I can't seem to find any other sources mentioning M1 wait states and TI calculators. I'd think, with so much assembly hacking done to them over the years, including /emulators/, there'd've been plenty of folk who've run into this. So, I'm a bit confused how it could've gone under the radar for so long.
[Zeroko] (the same) has also recently put up a wealth of information over at: https://wikiti.brandonw.net/index.php?title=86:ASIC and other pages, there. Much of which I've seen nowhere else (including /CS2 and /CS3!!!! And an /IOREQ?!) There he also mentions the M1 wait-state, but I see no references...
Unfortunately, I STILL haven't gotten to the FLASH-backup utility that, really, was planned to be my *first* project with the TI-86... yahknow... /exactly/ for moments like these. And the memory is full. So, reverting to the previous functional code is quite an ordeal at 0.1KB/s between the USB-Serial dongle connected to my blacklink...
Kinda a recurring chicken-egg problem. So, among many other things going on right now, I can't really verify the M1 Wait State finding (nor, really, continue with this project until I can).
Meanwhile... I've been vague, here, in the past, about the underlying goal of this bidir UART project... so here I'll explain:
My van has had some ongoing weirdness for some time... misfires, etc. were reported last I went to the parts store for an OBD scan. Well, that's *sorta* helpful, but would be *way* more helpful if I could actually see *when* these sorts of things happen... under what conditions.
So, THAT is what the goal was, a realtime OBD reader.
Frankly, this van has been having similar issues since I got it 5-6 years, now. She's really quite a trooper. I figured this to be a nice thing to do for her, but obviously not time-sensitive...
Until about a month ago.
She just wouldn't start.
It took five days, numerous jumpstarts/charges from considerate folk, and ultimately a tow truck to get her started...
And, well... since then I figured it was time to just do things the old-fashioned way... no realtime OBD at my disposal.
Cleaned the plugs, no effect. Though they were gnarly. Understatement. Still, no noticeable effect (how could that be?!)
Replaced the fuel filter. No effect, though it too was gnarly.
A few other such things...
Checked the coil-pack. Seems fine. Yet, the report (long ago) said the shared coil for the two gnarliest plugs wasn't doing its job... so, obviously it wasn't sparking 'cause it *couldn't* because of all the gunk between the plugs, right? But cleaning them had no effect. So, anyhow, next thought is it's just not getting the signal from the computer... a loose connection somewhere... actually a pretty easy thing to test with some LEDs I'd already rigged-up when she wouldn't start. But, then, i had so little juice in my battery, I couldn't keep cranking long enough to actually *watch* those LEDs.
And once I *finally* got her to a place with tools and workspace...?
(Limping, yet, under her own power! Such a great day after that fruitless week!)
A whole friggin' slew of *new* problems. Most of which have ziltch to do with starting, nor the ongoing issues.
Like, first, a coolant leak, which had been a months-long annoying drip requiring a gallon and a half of water every few days, had suddenly turned into a gush wherein that same gallon and a half left the system mere minutes after pouring it in.
Not an easy fix, but thankfuly not beyond me to find a workable solution a few days later. And... also fixed the drip! Which *also* fixed the intermittent heat! Blessing!
So, then, winter coming, might be time to put in antifreeze! Something I wasn't really sure about doing with the steady drip... now a reasonable consideration!
I watched it for a week to make sure the drip was gone... now just a *tiny* drip, about a quarter-gallon in a week, couldn't even locate it. Bought something supposedly guaranteed to block such a drip, put it in.. topped-up with antifreeze... idled for a bit to get it circulating... and, now a friggin' puddle. WTH. Friggin' dayglow green puddle, *exactly* what I'd been so friggin' cautious, watching everything for a week, to avoid. An o-ring, elsewhere in the system, aparently decided to crumble /that day/ instead of that whole week before?!
New things--completely unrelated to the ongoing issues I'd been finally working toward looking into--kept popping up, preventing me from getting to those other things...
So, e.g., it's entirely plausible I've been running on four of my six cylinders pretty much for the entire time I've had this. And, it's entirely plausible the only thing causing it may be as simple as a loose connection between the computer and the ignition coils. But, every time I, a friggin BSEE (yahknow, *wiring* and *circuitry* and LEDs and even writing an OBD program on a z80 are my jams... I'm not a mechanic!), try to install some friggin' LEDs to check something so friggin' simple, something new and completely unrelated has popped up that has to be dealt with immediately, in a realm I know comparatively darn near ziltch about, and have to fumble my way through learning as I go.
Thankfully, the mechanics in town have done an amazing job not showing, if they have, frustration at me picking their brains and only buying a few things at the counter in return, rather than allowing (paying!) them to do what they're good at. I owe many beers.
In the meantime, I guess, I'm putting off trying to decide on longer-term plausibilities... many folk suggest trying to fix her up is going to cost more than replacing her. I'm not entirely convinced. Thankfully, most of these new things have been rather cheap "hacks". Time-consuming, aggravating... they make me question my loyalty... and even worse, remind me of the fragility of my life"style." But, thankfully, not particularly expensive, and not outside my eventual discovery/repair.
But the ongoing issues I've not really been able to look into, lately, are still concerns, and some may be beyond me to DIY... and even those I can may be rather expensive. And some I know need doing are definitely not cheap. So, who knows.
She's really quite a trooper, though. Judging by those plugs, I'm guessing I've been running on four cylinders for years. Watching Semis pass you on mountain passes, then seeing they're pulling *two* trailers is a little humbling... And her scars from last year's ice-incident are hard to miss, and beyond my toolset/skillset/finances to repair. But she's never really let me down. It'd be a shame if I sent her to an early grave.
So, for now, I keep trying to motivate myself to look into the things I can... but mostly am just grateful when she limps along barely noticeably worse than she has for many years. (And now, with reliable heat!?!)
Maybe I'll try those LEDs today. Here's hoping nothing new suddenly interjects!
(Heh, oh right, I guess my M1 wait-state reimplementation, which took many days, and broke previously-functional code, is another such "something new interjected," though that's quite a bit different seeing as how /I/ did that, and it's *entirely* related to what I was working on!)