Sunday, March 1, 2020

33209: Parameters

Chapter 9: Interviewing IBM

Chapter 10: Parameters


(As I mentioned already, the real me was not brave enough or something, and never got disk drives for the Micro Chroma 68. Maybe he was a bit lazy in his thinking. But he seems to have thought saving up for tuition at a university where he could get a full bachelor's degree was more important than getting and developing his tools. Or something. And he had some other faults in his thought processes, but it is not my purpose to make this a confessional. Everybody makes mistakes. And sometimes mistakes are not.)

Friday after classes and newspapers, I loaded my stuff in the Colt again and headed to Austin. Got there late but got a look at Denny's computer. He was just finishing the box when I arrived.

With my coming as motivation, he had gotten his computer put together about as far as mine, but his box was much nicer. He had a router and other woodworking tools which I did not, and he had more experience working wood than I did.

I set mine up while he installed the mainboard and other parts in his box, and we booted both up and compared notes.

"Ought to be able to get these boxes to talk to each other."

 I scratched my head. "Write something in assembly language for a test?"

Denny thumbed through the Micro Chroma 68 manual. "Or, have them both pretend to be the other's tape recorder? Cross connect their tape interfaces and set one loading, then punch from the other."

"Hmm. How likely would that be to burn something out?"

"Both input and output are designed for cassette recorders."

We both looked at the circuit.

"Capacitive decoupling."

"Give it a try?"

We did, and it worked, but it was a little finicky.

"If we had Flex running, ..."

"I called TSC last night,"

"Oh?"

"They said we should be able to run Mini Flex on these, given floppy drives that work. But Flex 2 requires 48K contiguous RAM from address zero."

"Yeah?"

"The kernel loads and runs from $A000 to $BFFF."

"Hmm. Now that you mention it, Brad mentioned that when he saw your circuit. Putting the kernel in ROM won't work?"

"Variables and stack space in the 4K block between $A000 and $AFFF."

"Yep. How hard would it be to just overlay the empty areas?"

"The load on the top address lines is close to the max anyway."

"Then your idea for exclusive-or-ing the deselection signals with switch bits?"

"It's probably be the cleanest approach. Either way I'm going to be gating the deselect signals."
While we worked on the computers and discussed plans for Saturday, Denise listened, not saying much. When we talked about ways to tune the cassette interfaces without an oscilloscope, I saw her grimace.

*****

In the morning, I squeezed design work 0n the new dynamic RAM addressing in between helping Denny and Denise.

Then Denise brought the boys and went with us to the surplus store.

"Got to make sure my husband doesn't spend too much money," she commented with a wry, knowing smile as we left the house.

The two of them exchanged glances, and Denise wrinkled her nose at Denny.

He chuckled resignedly. "I know what our budget is, honey. I can keep things within limits."

I kept out of it.

At the surplus store, Denise kept an eye on the boys while wandering the isles with us.

The first thing we picked up was EPROM erasers. Then we checked our budgets and looked at floppy disk drives.

"Those eight inchers are a real steal," John said as we passed them by. Denny and I exchanged glances.

I shook my head. "Well, if I wanted compatibility with the school's 8080 trainer system floppies, I guess they would be. Or if I wanted compatibility with IBM's old minicomputers and mainframes. At least, I guess they aren't IBM's recent high density format."

"No, only capable of a quarter of a megabyte. But I'll give you two for the price of one."

That was tempting.

(These days, such drives go at really good prices among the retro community. Of course, inflation means that that it would not have been a good financial investment, even of the small sort. If you worry about the monetary value of such things.)

Denny shook his head. "Maybe later, but I don't think I have space for two drives that big."

"Ah, well," John grinned. "I guess I'll just have to show you the five and a quarter inchers I got in last week. A little more expensive, but they have opposing heads for double-sided disks, and the heads are double-density capable. If you don't want those, I have single-sided, double-density five and a quarter inchers for cheap, too."

"None of these have circuit boards, Denny, dear." Denise was frowning as she examined the drives on the shelves in front of us.

Denny sighed. "It's hard to get surplus drives with electronics that works, honey."

John raised his eyebrows and nodded. "Electronics that doesn't work, yeah, that's fairly easy to get, but, unless you have manufacturing docs, that's not a good idea."

He chuckled. Denny and I nodded. Denise pursed her lips in an ironic half-smile.

I picked up one of the single-sided, double density drives to look at. "Maybe, depending on a lot of things, a pair of these SS-DD drives for Giselle's Color Computer would be worthwhile. I understand the models Radio Shack is selling for it are SS-DD. But I'd have to replicate their electronics, and their controller, blind. And I don't think I'm ready for that, yet."

I put it back down and picked up one of the double-sided, double-density drives. "But I can only afford one of the DS-DD drives today, if we go that way."

"I'm going to need one of the DS-DD drives," Denny said.

John nodded. "How about one of each, and the SS-DD at half price?"

I calculated the prices. "I have enough money to do that, and it's often useful to have two drives, even if they aren't the same size."

John cocked his head. "If you want to share your electronics when you get it working, I could stock and sell some boards for you."

Denny and I looked at each other and nodded.

"Yeah. We'll think about that," Denny said with a grin.

"These floppy prices are pretty good."  I picked up a box of DS-DD diskettes and a box of SS-DD diskettes. Split half-and-half with you?"

"Let's do that."

"So where is this oscilloscope you want to buy, honey?" Denise asked. "I need to see the price on it or we can't budget it."

Denny and I looked at each other in surprise, and Denise rolled her eyes at us.

"You need it, Honey, so we need to plan for it. Joe, I think you'd better be planning for one, too."

So she got a look at the scopes and wrote down the prices before we left.

*****

Back at their house, I rewired the dynamic RAM mapping and we tested it. I left the I/O area and boot ROM/reset vector area in the memory map as they were, planning to work out a way to work with them later. When we got mine working and tested, we rewired Denny's as well.

Denny looked through the TSC catalog I had brought. Denise agreed that it would be right to purchase official copies of what we were using, and Denny took down the order information.

Then I helped with some of the honey-does Denny had waiting, helping him finish the sanding and put down the sealer coat on the hand-made bunk beds for their kids. And we did some laundry and took care of lunch while Denise rested. With their third on its way, she was a bit tired after the trip to the surplus store.

While we worked, we talked about what the interface and control circuitry for the floppy drives would need. Denise listened distractedly to our conversation.

When we were done with the non-computer stuff, we sat down again with the computers, and I checked the patches for the official copies of the assembler and the debugging environment, then we burned both into ROMs and started figuring out how to use them.

Just for fun, we decided to burn some of the TSC games collection into an EPROM.

"Good for testing and demonstrations," I reasoned.
"Yeah. And for looking at the object code and stealing ideas from it."

"Ideas, only."

"Yeah."

And we wrote a menu program to select a program from the ROMs, to select and enable ROMs, and to execute programs in the ROMs we had.

TICTAC FDB $B008 ; START ADDRESS
      FCB $40 ; ROM select/enable bit (set only one bit!)
      FCC "TIC-TAC"
      FCB 0 ; NUL TERM

 "That looks like a good layout for the table of programs."

"Reasonably long label names is sure nice."

"Six characters is a lot better than BASIC's one or two character names."

"Now how do we pass the address of the program name to the routine to show it on the screen?"

"Put it in a global variable called STRADR?"

"Global. We don't need to worry about interrupts, but I sure don't want to remember to check whether there's something else allocated at the address."

"Push it on the stack."

"Where're the PSHX and PULX instructions?"

"This isn't 6801. They don't exist."

"That's awkward."

"We can use immediate mode to load the top half in an accumulator and push it, then repeat for the bottom half."

"That gets it on stack, but then we still need to get it into X in the called code. The only way is to use a global variable."

"How about a software stack pointer in a global variable?"

(The real Denny actually made a comment like this to the real me. The real me blew it off, thinking that the 6801 and the 6809 were just a design away, and then failed to do the design work to get there for either of the more powerful processors.)

"Hmm. And if all the software I write uses that software stack pointer, and saves and restores it on when switching tasks, we're actually golden."

(That was an important realization, okay? Maybe software from other people would make conflicting use of the memory location, but, when I wrote my own software, I could write it to recognize and use it.)

"The CPU registers themselves are also just fast globals everyone recognizes as global."

"True."

At some point in the evening, we hooked the SS-DD drives up to the power supplies and our computers' parallel ports, carefully using level adjusters, op amps, and other parts from Denny's parts boxes to avoid driving them with too much current, and Denny showed me how we could prove to ourselves that the drive motor, the stepper motor, and the head-load solenoids worked.

Of course, we made sure we had a floppy between the heads for padding before we tried getting them to load.

And of course we took notes of voltages and currents as we worked. The numbers we recorded would help me parameterize the drive's operation, and knowing the operating parameters would help me design the electronics.

Denise watched us work, and celebrated with us when the wormgear to move the heads between tracks moved and when the heads loaded.

"So we can believe these floppy drives will actually work some day!"

"Den, honey, just have a little faith."

"I do."

"Yeah, I guess I know."

I turned my head to let them have a kiss in peace.

*****

At the student ward on Sunday, I re-acquainted myself with some of the members I'd met the previous month, and spent some time finding out a little more about the university. Got home in time for the home ward's young adult home evening.

*****

On Monday, I took the computer and the single-sided drive in to school, and Dr. Brown coached me while I used a scope to repeat what Denny and I had done Saturday evening. With curves and signals, instead of just simple numbers from a meter, I was able to work out programming and hardware for a test rig.

Then I began trying to parameterize the heads themselves, but was not able to get reads and writes.

Dr. Brown suggested some resources to check at the library. So I stopped in the library on the way home and did some research, borrowing issues of some technical magazines and making copies from books the library would not let me check out.

*****

"Watcha readin'?"

I was in the living room, taking advantage of the sofa and the living room floor. "IEEE magazine. An article about group code recording."

"Group what?"

"A way to make sure you can get the data you put on a floppy disk back off."

Dad gave me a blank look. "Now I know one more thing I don't know."

Mom laughed.

Dad grinned. "That pile of magazines more of the same?"

"Yeah."

Dad grew serious. "You're working hard on this."

"It's educational."

"How does this writing on the disk work?"

"Well," I thought for a bit, then pulled out a piece of scratch paper and used the magazine table as a desk, and drew a line:
____

"Is that a one or a zero?"

Dad looked at it sideways. "Trick question, I assume."

"Right. Hard to tell, isn't it?" I added a bit to the left side of the diagram:

¯¯¯¯\____________

"Still looks like a trick question. Or one of those doodles, where the answer is something about mama bowling balls or sinking ships."

Mom and Dad chuckled. Giselle slipped quietly into the room and peeked at the paper

I grinned. "You can see a transition from high to low, right?"

Dad sat down beside me. "If I'm looking at it from the same angle as you, yeah, I can see it that way."

"But without the transition, you can't tell whether it's low or high, right?"

"If it were graph paper, ...," Giselle began, but didn't finish.

I nodded. "If it were labeled graphing paper, we wouldn't need the transition. Floppy disks are more like completely blank paper than labeled graphing paper."

"Can't they put rules and labels on them?"

"Engineers tend to do things as cheap as they can. Otherwise, it's hard to make a profit."

"Isn't that like, stupid?"

Dad grimaced, then grinned. "Sometimes, honey, getting things done is more important than doing them pretty or smart."

I nodded.

"Well!" Giselle huffed in exasperation, then came around and sat on the other side of me. "So, okay."

"So, let's see if there's a way to make it easier to read without grid lines."

I added a bit more:

¯¯¯¯\____________/¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\________/¯¯¯¯

"Could you see that as a 1, a 0, a 1, a 0, and a 1?"

Doubtful nods were what I got in response.

"How about as 1-0-0-0-1-1-1-1-1-0-0-1?"

"The length between?" Giselle asked.

"Very good. The problem is that length is hard to measure on the floppy."

"It's hard to measure on the paper you're writing on, honey." Mom shook her head.

"Exactly. So we limit the length, and instead of high being 1 and low being 0, a flip is a 1 and no flip is 0." I drew a new line:

¯\_/¯¯¯\___/¯¯¯\_/¯\_/¯\_/¯\_/¯\_/¯\___/¯¯¯\_/¯\

Giselle's face lit up in recognition. "It looks like a sound wave."

"Wave, yes. Electromagnetic waves are important with sensing magnetic fields. Hard to sense without them."

She counted. "1-0-0-0-1-1-1-1-1-0-0-1. It's the same."

"Right. Transitions where there are 1s and no transitions where there are 0s. And there's a transition at the end of each bit, so it's easier to track the length. It's essentially two frequencies, so this is called frequency modulated data recording, or FM. Or maybe it's Manchester encoding. I'm still not quite seeing how they are different."

"Son, I believe you." Dad grinned.

Mom and Giselle laughed.

"Well, this takes more space on the disk than people want it to, so IBM has a modified FM, or MFM, that is more compact. I thought I understood it when I was working with the fast cassette, but what I was doing was not what IBM calls MFM. And the microcomputer industry has several other ways called group coded recording, or GCR, that I'm trying to figure out now. And I'm trying to figure out which I'm going to do with these drives."

Mom smiled and nodded. "Which method does the floppies for Giselle's computer use?"

"Well, according to what I've read, it seems to be one of the more common GCR formats. But I'm not sure about that, either. I find conflicting information."

Dad looked at Mom and she raised her eyebrows and nodded.

"You think you'd have a better time of it if you had a working drive to compare it to?"

I looked at Dad and raised my eyebrows. "Yeah. I could definitely make more progress with more parameters known."

He frowned and tilted his head and nodded to Mom, and he and Mom went to Giselle's room, taking Giselle with them. I heard Giselle complain for a moment, then the three of them left. They returned some time later, when I was in my room doing some calculations on the Micro Chroma 68. Dad called me into Giselle's room, where together we worked out how to hook the new floppy disk drive they had bought up to her computer.

They had also bought the disk version of the word processing program, and we experimented with it.

"I think the ROM pack is easier to use," Giselle muttered under her breath.

"Definitely more commands to remember with the floppy drive," I agreed.

Dad and Mom nodded in agreement.

"But you can do a lot more with software loaded from a floppy, and you can make larger files," I added.

Mom frowned. "I wonder if it's worth it."

"Well, let's just try to avoid forcing things. Use what's easiest for now, and I'll help with the disk commands when you need help."

Dad wrinkled his forehead. "Can we save files from the tape to the disk?"

"I think so." I looked in the Disk BASIC manual that came with the disk controller, and tried using a small BASIC program to do that, and displayed the saved file names in the directory. The commands worked, and we succeeded in copying the files from tape to disk, and Dad and Giselle grinned in relief.

"Can I take the whole rig to the lab sometime this week?" I asked.

"Can I come with, and watch?" Giselle's response surprised us all.

*****

Thursday, I took Giselle with me, and we took both computers to school. She set her computer up in Dad's office and worked while I went to class.

When I finished classes and returned to Dad's office, Julia had come in to do some work for Dad, and Giselle was showing her how to use the computer. We packed her computer up and Dad wished us "Have a funny time!" as we left his office and headed to the electronics lab with both computers.

Julia dropped by the electronics lab after about an hour to watch.

With the clues I got from using the oscilloscope to watch what the Color Computer disk drive was doing, I was able to align the read/write heads on the drives and get the drives to see the data signal that the Color Computer wrote on the disks. I knew the alignment was not perfect, but it was close enough to allow me to proceed.

Next I worked out a way to read and write raw data by bit-banging, using a single bit of a parallel port under direct control of the CPU, writing and reading a track of 2500 bytes at an approximate 100 kilobaud. There were uneven gaps between bytes where the index register was updated to get the next byte from the buffer, but I adjusted the code with NOPs to make the timing for the read and write equal, and it sort-of worked.

That proved the heads worked, so I changed the circuit to use a shift register fed by the whole parallel port, with no stop, start, or parity bits. That allowed me to almost reliably write and read tracks with byte values that had easy bit patterns, at 150 Kilobaud. But it tended to drop bits on sequences of four or more bits the same, as I expected.

Just for fun, I inserted Giselle's and Julia's names in the data. The stream always lost sync from the "a" in Julia. That's ASCII code $61 in hexadecimal, or 01100001 in binary, four zeroes in a row.

Then I added a simple circuit between the output bit and the disk head, to FM encode the data on write, and to decode it on read, and I could get whole tracks with no dropped bytes, at 250 kilobaud.

"Cool." Giselle was impressed.

Julia shook her head. "I don't understand anything of what you just did, other than my name messing up your data."

"Only until I got the data properly FM encoded. It's a good test pattern."

"I can't even begin to understand what that means."

"Uhm," I started to get some scratch paper out.

"No, don't bother. I don't think it would help."

"Well, okay."

"I don't get it."

"What?"

"Why don't you just borrow the money and buy an Apple? Wouldn't that be faster and easier?"

"Ah, faster, yes." Dr. Brown nodded.

"But I wouldn't be learning nearly as much."

"And that's the down side of buying someone else's, besides having to pay the loan back." Dr. Brown took my side.

"I see." Julia pursed her lips with a frown.

Giselle refrained from saying anything, although she told me when we got home that now she could definitely understand why I hadn't fallen head over heels for Julia.

I have to admit, I still wasn't sure, myself.


Chapter 11.0: Headwinds -- IBM

[Backed up at https://joel-rees-economics.blogspot.com/2020/03/bk01-33209-parameters.html.
Earlier backup at https://joel-rees-economics.blogspot.com/2020/03/bk-33209-parameters.html.]

No comments:

Post a Comment

33209: Discovering the 6800 -- Parents and Polygamy

A Look at the 8080/TOC "Whoa, Merry, look who's here!" Jim said, sotto voce. He, Roderick, and I were at our lab table ...