Tuesday, October 28, 2025

3809/2801: Drafts

2801
Drafted

Basic Addressing Modes for All
TOC

(You may find this chapter less dry than the previous few chapters. You may also find it a bit contrived -- and technical in a different sense. It's necessary for the plot.

I should point out that both Sapphire and Joe diverge even more significantly from the real world from this point.) 

When I entered the typing lab, Sapphire was sitting in the front row. The desk beside her had a book on it, and there was a pile of books on the next desk over. All the other desks nearby were occupied already. 

She looked up and waved her fingers, and said, "Hi, Joey."

I raised my hand in greeting and replied, "Hi, Sapphire," and turned my feet to the back.

But she was waving me over, pointing to the desk next to her, which was right in front of the teacher's desk where Ms. Wilson was working on something.

So I headed to the front row, after all. 

"But isn't Cyndy sitting here?" I asked.

"Those are her books," she said, indicating the pile of books on the next desk over, and I recognized Cyndy's notebook on the top. "She'll be back by the bell."

"Oh, well, thanks for saving me a place." I put my books down, feeling a little like the proverbial cat in the room full of rocking chairs, and picked up the book she had left on the desk to save my place.

The book cover looked a little old, but still clean. It was about as thick as two issues of Popular Science, but hardcover. Something about the book felt familiar. Curious, I opened it. 

And raised my eyebrows in surprise. "Your annual from our ninth grade year at Hood." I closed it, perhaps too quickly, and started to hand it to her.

"Do you remember what you wrote when you signed it?" 

"Yeah. I ... remember ..." I was stuck for words.

"Well, Mr. Reeves," Ms. Wilson interrupted. "Cyndy said you had something to use for typing practice today."

"Uh," I looked around. "Hi, Ms. Wilson." 

I looked back questioningly to Sapphire. She pulled her mouth to one side. "Hang onto that thought," she said. "And let's see your letter of inquiry."

"You know about that, too?"

"Cyndy had to drop her books off here, you know."

I set the annual down and dug it out of my notebook. "It's just a draft."

"Drafts often need to be typed up, too. Let's look at it," Ms. Wilson said.

I handed it to her and she started reading it.

Sapphire stood up and walked around Ms. Wilson's desk to read it over her shoulder. 

Ms. Wilson nodded. "Mmm. Uh, huh. Good. Mr. Mori knows what he's doing." She put the letter on her desk and get out her red pen. "But let's think about this. And this." She marked several points in red and wrote some comments. "These are other ways to word things. You can choose."

She handed it back to me. "It is a little advanced for your typing practice, but you can take time during the second half of class today to hunt and peck if you want."

"Thanks." 

"Cyndy and Sapphire seem to want to use it for practice, too," she added. "Do you think you'd mind? They'll see your phone number and address, of course."

"No problem. Cyndy's a friend of Hec's and she's already seen it anyway, and ..." Again, I was stuck for words.

"And it's not like it's something I don't know already," Sapphire smirked.

I swallowed.

Ms. Wilson smiled. "And if you wouldn't mind, I'd like to save it and maybe use it in a few weeks for the whole class," she suggested. "It'll be more interesting than the textbook examples. We'll leave a blank for name and address on the spirit master, of course."

I blinked at her. 

"You two could run down to the library and make me a copy."

"Sure. No problem. But," I looked at the clock.

"Hall passes," She grinned and pulled a couple of green cards from a drawer and held them out to me.

Sapphire picked up her annual. 

I said, "Thanks, Ms. Wilson," and grabbed the hall passes and the draft, and Sapphire and I headed for the door together.

"Don't dawdle, and if Cyndy is still in the library tell her to get back to class," Ms. Wilson called after us.

I turned and gave her a thumbs-up as we went through the door. 

"So," Sapphire said as we walked down the hall. "Look at what you wrote," She handed me the annual. "-- and let me see your draft."

I handed her the draft, but I hesitated at opening the annual. 

"I remember what I wrote." 

"Do you?" 

"I was a teenager."

"We are both still teenagers. I like this draft, by the way. Your writing has improved."

"Thanks. I had no idea what I was saying -- when I signed your annual, I mean."

"You had enough of an idea that you went to the trouble to write it in your code."

When I was in seventh grade, one of my older brother's buddies at church had been called to a mission in Japan. I had read his letters to the congregation and noticed the return address written in Kanji, and that had spurred an interest in ciphers, crypts, and scripts. i had turned that interest into a simple substitution cipher using non-alphabetic symbols I made up -- probably inspired by something I read somewhere. And, somehow, I had had the social creativity to give her a copy of the key.

"And you took the time to decipher it."

She poked me with her elbow. "Yes. Didn't you want me to?" 

"I wasn't sure I expected you not to have thrown the key table away." 

"Okay," and she sighed before continuing. "I understand that. I had trouble letting you know I was interested in you. Too. So, do you have any better idea about what you meant, now?"

"I think I understand a little better. My sister and I were talking once, and she explained about crushes."

"Did she now." Not a question. 

We turned a corner. 

"How it's okay to have crushes and it isn't the same thing as what people get married for."

"Which of your sisters was it? I think I'm going to have to have a talk with her." 

"Uhm, ..." 

We stopped outside the library door and she fixed me with her gaze.

"Joey, it's a simple four-letter word. It starts with "L". It's not profane."

I blinked. 

She sighed and tilted her head and gave me a wistful look. "Just please look at the page where you signed my annual."

I couldn't deny her that. 

I opened the back cover. The book cover covered the edge where I had signed it a bit over two years back. I lifted the book cover away.

Beneath the mandatory, almost meaningful message about the past and the future, I'd confessed my ninth-grade feelings for her in that script cipher:

 

Under my confession, there was a line in her handwriting: "When will you tell me this in person?"

"Just so you know," she said, "I did not write that yesterday. I wrote that a couple of nights after the signature party, after I decoded it."

The ink didn't look new, at any rate. 

"We need to see if Cyndy's still here," I said.

"You're stalling."

I swallowed and looked at the floor. "Yeah, I guess I still have that huge crush."

"Crush." She sighed. "You guess."

"I get crushes easy."

"I remember. You could be a little scary that way. That's probably part of why I couldn't quite open up." 

"But, for what it's worth, I've been nursing this one at least since you encouraged me to do my algebra homework in 8th grade."

We turned and entered the library in silence.

"It's enough, I guess," she said quietly. "Two years I've waited." 

She grabbed my hand and dragged me into the stacks.

"Cyndy," she whispered.

Hec's head poked around a stack, followed by Cyndy's.

I chuckled at their expressions. 

Sapphire whispered, "You both look like a couple of cats that have gotten into the catnip. It's time to get to class."

Hec tried to suppress the overly happy look on his face and give me a puzzled look. Tried to.

"We gotta make a copy of my draft for Ms. Wilson," I explained in a whisper.

He grinned. "How Sapphire worked that, you're going to have to tell me some time."

"Maybe, if she and Cyndy tell me. You guys don't have hall passes."

"True. We'd better go." They hurried out of the stacks, holding hands.

"See you guys. Don't take too long," they chorused in normal voices, breaking the stillness of the library. 

The librarian peered around the end of the stack after they were gone. 

I held up the hall passes. "Came to make copies." 

"Right," she said. "I'll go warm up the copier," and disappeared. "Don't be long!" There was amusement in her voice.

Sapphire grabbed my hands, and looked me in the eyes. "And I still have my huge crush on you."

"Even though I'm scary."

"Since the seventh grade. You backed off when you could tell we were feeling creeped out. A lot of guys don't know how to back off." 

I could only nod. 

"I didn't know how to get your attention. You know how guys just seem to like me, and how I had a hard time saying no to the wrong guys at Hood. Anyway, you helped me start saying no. I know I can be trouble, but we need to talk. I need to talk. Two years worth of talk, at least."  

"Five years worth."

She nodded.  

"I'm sorry I didn't follow up. I tried to, but cheerleaders are scary, and I kept hanging up the phone before it could ring on your end because I didn't have any idea what I'd say."

"Cheerleaders are scary." She smirked, then turned serious. "We're often scared to death. You hung up?" She giggled. "I remember getting a few prank calls ..."

"Maybe I wasn't fast enough every time."

"Or, maybe, too fast?" 

I looked down, embarrassed.

She giggled again. "Oh, I know, you were shy."

"Still am." 

"Me, too. I guess we just hide our shyness differently."

We stood, holding hands, gazing into each others' eyes like the teenagers we were. 

She asked, "Can we study together tonight and maybe talk a little? Or a lot?"

"We could do that. Oh, wait, It's family home evening tonight."

She looked puzzled. "What's that?"

"Weekly family time. It's nothing spectacular, but you'd be welcome." 

She grinned. "I'd like that. Let's make this copy and get back to class."

Making three copies of the draft letter didn't take long. We held hands on the way back. Didn't talk much, didn't walk too fast. I was overloaded, couldn't think of anything to say. But I wasn't complaining. And neither was she.

Just outside the door, she held me back and said, "By the way, there's something Cyndy and I would like some help with. I think Hec's going to help. It's entirely up to you, though."

"I can't agree or disagree if I don't know what it is."

She looked in the door. "Uh, oh, Ms. Wilson's starting timed practices."

We hurried in. 

After twenty minutes of timed practices, Ms. Wilson let us do free practice. Cyndy and Sapphire and I worked quickly through Cyndy's notes and Hec's draft letter to RCA, and Cyndy created her own draft to Intel.

Cyndy commented, casually, "Hec says he can do the cheer dance club after school." 

Sapphire replied, "That's great." She looked up from Cyndy's draft. "Isn't it."

I raised my eyebrows and looked back down at the draft. "Sure. Sounds fun."

"Good." 

Ms. Wilson gave us some pointers, and Cyndy started typing her draft. I started in, trying to touch-type instead of one-fingering. 

And Sapphire typed a copy of my draft. 

"Are you really okay with helping us with the cheer dance club?" she asked quietly.

"You never found out how much I like to dance."

"Oh. Nice." 

 "But I get kind of wild."

 She snickered. "Now I'm trying to imagine that."

"And I'm not that good at line dancing."

"That's okay, we can practice." 

"I'm driving today, and there are newspapers waiting to be delivered at my house. How long is your practice?

"We keep it under forty-five minutes. Will Rick mind waiting? Street clothes are okay today."

I nodded. "We'll ask him."

Sapphire borrowed Cyndy's draft to type for more practice while Cyndy typed a copy of Hec's, and I continued typing on mine.

We were done a little before the bell.

Cyndy said, "We don't want to put too much pressure on Rick to join." 

"Oh, yeah, he claims he doesn't dance," I replied. "But let's ask. If he doesn't want to help, he'll say so." 

At the bell, Cyndy left quickly.

Sapphire waited for me to collect my books and we left together. 

Rick saw us in the hall and waited. 

Sapphire seemed to pick up on his pensive mood. 

"Hi, Rick," she said, cheerfully.

He grinned a little darkly. "Well, hello you two love-birds."

She grinned back, then gripped his upper arm. "Hmm. Yep. I think we should recruit you, too."

"Recruit? Me?" Rick took a step back.

"We are being drafted for cheer dance." I raised my hand to slow down the response I saw coming. "Cyndy and Sapphire kept talking about needing guys all during typing class, in between working on the drafts."

Sapphire turned and wrinkled her nose. "All during class."

I grinned back. "Okay, we did talk about a few other things."

She laughed, and Rick chuckled darkly.

"I'm not going to guess what else you were talking about. Shoot. I should give you my draft to type up. Tomorrow?"

"We can ask Ms. Wilson if we can do it again," Sapphire suggested. 

"So what about your newspapers, Joe?"

"I'll can the paper route sit for an hour."

"Just an hour." Rick's mood shifted somewhat.

"Forty-five minutes," Sapphire said, and turned back to me. "And you are sure that's okay?" 

I shrugged and gave her a lopsided smile. "I can do the route faster when I'm motivated, and they give us until 5:30." 

I turned back to Rick and said, "Are you okay with this? Won't be late for work?"

He thought for a moment, and measured his words. "I've got a little time before work. You're driving today. I guess I have to tag along."

"I can drop in on their practice tomorrow to check it out, and walk home."

"Yeah. No. I'm going to see this. Tomorrow will be tomorrow." 

He raised his fist for a hesitant bump, and I returned it, not putting too much energy in it.

He grumbled, "We can call this an adventure." 

(You thought fist bumps were a recent thing, didn't you? I don't remember knowing who Fred Carter was, but Joe seems to have found time to watch a bit of basketball on the little black and white TV he bought with newspaper money at sixteen.) 

TOC
Next
Where it starts




Monday, October 20, 2025

3809/2801: Basic Addressing Modes for All

2801
Basic Addressing Modes for All

Register Sets for 1802 and 9900
TOC

(Continuing the  dry technical stuff, but it's still important. Don't go away.) 

Mr. Mori continued his explanation, not yet putting anything on the whiteboard. 

"Every CPU needs to address its registers, so register addressing should be considered something every CPU has."

I volunteered, "Is the 1802 X register how it addresses its index register?"

"That's a good way of looking at it." He frowned approvingly and nodded before continuing. 

"Now, the register is often implicit in the instruction. For instance, the 6800 has an instruction to set the carry flag and another to clear it. The carry flag is explicit and inherent to the instruction, but the condition code register is implicit."

Chuck asked, "Is the stack register implicit in call instructions, then?"

Mr. raised both eyebrows approvingly. "You could say that. Yes, you could definitely say that." 

He paused and thought. "But maybe not exactly for the 1802." 

He tilted his head in thought. "Maybe."  

"Anyway, another mode pretty much every CPU has is called the immediate mode in the documentation for all five of the processors we are looking at. It can also be called literal mode, among other things. 

"A constant value in the instruction stream is used as the source of a load or move instruction. In some cases the constant might be in the instruction itself, in others, it will come immediately," he paused and began diagramming on the whiteboard, "after the instruction op-code, like this:"

He paused when he finished the diagram. 

"You know, for the instruction stream, it's natural to draw memory putting the lowest byte at top, but that will feel upside down for data." 

Barry asked, "So which way is it?" 

"Whichever way makes most sense."

"Oh. And how do we know which we makes sense?"

Mr. Mori didn't elucidate. Instead, he continued, "Where that immediate constant is used and what is done with it is determined by the instruction."

Hec volunteered, "Is the PC implicit in immediate mode instructions?" 

"Yeah." Mr. Mori shook his head in amusement. "I don't think I pay you guys enough to do my job for me."

He grinned as we all laughed.

"Note that immediate constants can also be two bytes in some cases." 

He drew this to the side: 

Bob asked, "Is byte 1 the low byte or the high byte?"

"Yes." Mr. Mori waited. 

But we didn't laugh.

He shrugged in mock disappointment, but continued. "It depends on whether the processor is less significant byte first, or little-endian, or more significant byte first, big-endian. In the 8080 and 6502, byte 1 will be the low byte, but in the 6800, byte 1 will be the high byte." 

Scott asked, "Isn't least significant first the canonical form?"

"I have read partially valid arguments for making either byte order canonical, but the best argument is just that everybody should do the same thing -- and that is usually actually a good argument to not do the same thing." 

Scott scratched his head.

Mr. Mori thought a moment, then added, "For what it's worth, IBM usually designs their processors most significant first. I suppose we should discuss the advantages and disadvantages and historical reasons at some point, along with other philosophical questions like Barry's. Can you wait for that?"

(Irony in history, but IBM did not design the CPU for the 5150, did they?) 

"Yeah, I guess."

"Thanks." Mr. Mori turned back to the board and erased and rewrote parts of the second diagram, then added to it: 

"Absolute mode is where the address of the operand in memory, not the operand itself, is part of the instruction stream. The CPU loads the address out of the instruction stream into a temporary register, then loads the operand from that address. In this case, I'm showing the data operand as a 2-byte operand, but the data could be one byte or three, or any length, really, depending on the instruction, and on the instructions that follow.

"This mode is also called extended mode, or external address mode, among other things."

Barry asked, "So it's kind of like immediate mode, but the immediate value is the address where the actual operand is?"

"That's one way of looking at it."

"How does the CPU know the difference?"

"Basically, by the instruction op-code. For example, if it's an ADD instruction, there will be different op-codes for ADD immediate mode and ADD absolute mode. The immediate mode op-code grabs the number in the instruction stream as the operand. The absolute mode op-code first grabs the address from the instruction stream, then grabs the actual operand from memory at the address it just grabbed. Either way, once it has the operand, it can ADD it."

He let us digest this, then he added, "There are some CPUs  that do things differently. For instance, in some, the operand itself says it's an address. But I don't want to talk about them, at least, not now. Likely to just confuse everyone. I don't know of any microprocessors that do that, anyway." 

(No microprocessors that did that yet, anyway.) 

Cyndy asked, "So little-endian processors will have the low byte first for addresses, too, not just data?"

"Yep."

She asked another question, "Is there a single-byte form of absolute address?"

Mr. Mori grinned. "Thank you for bringing that up. The 6502's zero page mode and the 6800's direct page mode are just that, short absolute addresses in the first 256 bytes of memory." He wrinkled his forehead. "I don't need to draw that one for you all, do I? It's just a single byte following the op-code, and you the address unit concatenates zeros on top of that?"

Nobody asked him to.  

But Cyndy had one more question -- "Can you put addresses in registers?"

Mr. Mori mugged astonishment. "Cyndy, I'm beginning to feel threatened! That was just where I wanted to go next." Then he grinned. "Guys, is it time for talking about addresses in registers?"

Cyndy looked pleased with herself, and no one said no.

"You can, indeed, put addresses in registers. In fact, when any of these CPUs gets an absolute address and uses it, it stores it temporarily in a register or buffer that programmers can't access directly and puts it on the address bus from there. But we can also keep addresses in registers that we do have access to.

"Using a register like this is a mode that is often called register indirect mode. The instruction specifies a register, and the register contains the address. It feels a little superfluous to draw this, but we'll want to refer to the concepts in a moment:" 

Mr. Mori paused again. "Oh. This time it's data I'm diagramming with the high addresses on top." He picked up the eraser, hesitated, then put it back down. "Nah, Well go with this. There's a reason. Bear with me."

Bill chuckled. "I don't think any of us really knows enough to complain." 

Mr. Mori grinned again and continued.

"The 8080 has limitations, as I've mentioned, about which register pairs can be used with which instructions. But the 1802 and 9900 allow any register to be used to point to memory. The 6800 and 6502 are a bit special, but, again, as I've mentioned, they use their index registers to do this.

"But before I talk about register indirection on the 6800 and the 6502, I want to talk some about indexed mode addressing. I'm going to erase and rewrite parts of this diagram. You probably want to draw a second diagram instead in your notes."

Cyndy had already started making her second diagram as Mr. Mori altered the one on the board. 

"We start with a register pointing to something in memory, in this case we'll make it a name with a length byte. I'm showing the ASCII character codes in decimal here. 

"The base register points to the length of the name. But say we want to take a look at each letter in the name. We can add one to the pointer and look at the 'M', then add one again and look at the 'o', then add one again and look at the 'r'." He indicated each location in memory as he spoke. "But if we now want to look at the length again, we have to back up." He pointed back. "We have to subtract three, if we remember that's how far we've bumped."  

"Or we can keep the original, copy it to another register, and bump that register up and down to look at the letters one at a time. That way we don't forget where the name is. And that's the two registers I'm showing in this diagram.

"Adding and subtracting one are so common that, in most CPUs, they have their own op-codes, mnemonically named INC and DEC or something similar, for INCrement and DECrement." 

"Now, what if we want to jump directly to the score that comes after the name? Does everyone see how to do that?"

I waited for somebody else to say it, but no one did, so I said it. "Make another copy of the base address, load the length in from memory where it's pointing, and add the length to the copy?"

Mr. Mori nodded. "That's one way. Good catch about getting the length from the string itself. A common beginner's mistake would be to just load it as the immediate value 4. That would work with my name, but not yours. 

"By the way, this technique of adding an offset to a base address in registers requires multiple instructions on all of our microprocessors." 

(This would change, of course, with the 68000 and 6809, but that's down the road a ways.)

"This practice of pointing at parts of objects in memory at offsets from the base of the object is called indexing, essentially from the concept of indexing into an array or table. Or from matrix algebra. 

"While we can do it in steps like we've been talking about, the 9900 provides a short-cut indexed addressing mode for arrays when their location is a constant known beforehand, where the instruction stream provides a constant absolute base address and a register provides an offset. This mode doesn't help if you have both the base and offset in registers." 

He took some time to draw the following: 

"Base address literal in the instruction stream points to the base of the name, and the register gives the offset to the letter." 

Karl complained, "I'm not seeing why that has any advantage over just putting the address in the register and adding."

Mr. Mori pursed his lips and nodded before replying. "You do have a point. But you can do this addressing in a single instruction. And sometimes, you're short of registers. And sometimes, you're more interested in keeping the offset as a variable than in having the addresses themselves. 

"Now, in fact, this only works when the base address is known in advance, so you do have a point or two."

"But I don't know what point I have," Karl laughed, and most of us laughed, too. 

"More things we need to talk about later," Mr. Mori answered.

"One useful case we can talk about might be when making an identical copy of something. The 9900 also has auto-increment and auto-decrement modes which can be used, but maybe you can see that the same offset in the register can be used with with the base offset of each array. I will need to show you some concrete copying examples, later."

"But for now," he erased and rewrote parts the diagram, "I want to point out that the 9900 indexed mode is just adding numbers, so we can also do indexing like this:" 

"Using the indexed mode this way, the register points to the object in memory, and the instruction stream contains a constant offset. We can see that this can be useful if we know in advance that a constant offset directly accesses the test score for records of a certain type -- which would not really be the case above. But diagramming a case that would apply would require more explanation than I want to dig into now.

"Can I skip that for the moment?"

Silence.

"Nobody says no, so we'll come back to it. As I say, this mode can help make the 9900 a bit faster than it otherwise would be, because what would take several instructions on, say, the 8080 or the 1802, can be done in one on the 9900. 

"Now the 6800 has a similar mode using the X index register, but the constant in the instruction stream is limited to a single byte. This works well in the mode I just showed you, where X points to the object and the instruction specifies a small constant offset.

"But if you want the constant part in the instruction stream to address the base of an array, and the X register to contain the offset, on the 6800 the array has to start in the direct page."

I raised my hand. "Hang on. So the constant offset is a byte. I think I can see that. But you can use that byte as a short address in the first 256 bytes of memory, and then use the X register to hold the offset."

"Correct."

(Again, if constant base + variable index mode is interesting, but the 6809 and 68000 are overkill, check out the addressing modes of the 6805, which, as I say, would not be introduced for another couple of years.) 

"Okay, I think I'm following this."

Cyndy looked at me. "I'm glad you are."

Chuckling again. 

"We'll go over this more carefully later. Does anyone else want to stop to think out loud or ask questions?"

We didn't. 

"By the way, for the 6800, register indirect is provided by using a zero offset in the indexed mode. This feels wasteful, but it allows the 6800 to provide indexed mode addressing in addition to register indirect for all general operators, which the 8080 and 1802 do not. There are lots of trade-offs in CPU design.  

"And again providing this mode actually does help make up for the dearth of registers."

He paused, took a breath, and looked around at us.

"Uhm, the 6502 does things sort of similar to the 6800, but different, and it gets really confusing. I'm afraid I'm losing too many of you, so let's take a breather."

We all leaned back and some of us stretched.

I raised my hand. "Rick and I are going to write and ask for documentation, like you suggested, and, I think, about whether they can make prototyping kits available to students."

Rick interjected, "I'm actually more interested in that computer kit from Southwest Technical."

"You've got that kind of money?" Hec asked.

"I was about to say," began Mr. Mori.

Rick responded, "Maybe, from the part-time job I'm working. Or maybe I can talk Joe into pooling money with me. Anyway, I want to ask about it." 

(I know. I'm stretching belief here. But it's necessary for the story.)

"Okay," Mr. Mori turned the projector back on and got out some blank transparencies. "Let's talk a little bit about how to word technical inquiries, and what information to include. That's actually an important technical skill." 

Mr. Mori prompted us through the basics of writing letters of inquiry about engineering documentation and equipment, letting us do as much of the writing as we would. As a class we came up with lots of good ideas. 

In the process, several of us put together draft inquiries. 

Mr. Mori also gave us his contact information at the school to include in the letters.

Cyndy took lots of useful notes about inquiry letters, and Mr. Mori came over to check them.

"Can I commandeer these notes and type them up for the ditto machine for the whole class?" 

"I want to use my notes for typing practice," she replied.

"But can I get a photocopy?" 

Cyndy twirled a curl, and said, "Sure. I'll bring them by after school."

And the bell rang. 

"By the way, since you're students, hand-written letters of inquiry for documentation will be okay, if your writing is legible. We'll pick up the addressing overview again tomorrow. I think you guys need some time to let what we've covered sit and simmer a bit, anyway." 

(Did I mention that, if Mr. Mori had both the knowledge and wisdom he is demonstrating here, he would have been head-hunted away from the high school into engineering management by any one of a dozen companies at this time?) 

Cyndy gathered her books, glanced quickly at Rick and me, and left. 

Hec looked at Rick and me, too. "Uhm, I've got to go, guys, okay if we check notes later?"

Rick and I nodded, and Hec left, after which we finished touching up our notes.

"Looks like your letter is pretty complete," Rick commented as we left.

"I might be able to use it for typing practice today, if you don't mind waiting."

"I can do that. If I don't see you after the bell, I'll come to the typing lab."

"Sounds good." 

He turned in to his class and I headed to the typing lab. 

TOC
Drafts
Where it starts


Sunday, October 12, 2025

3809/2801: Register Sets for 1802 and 9900

2801
Register Sets for
1802 and 9900

Register Sets for 8080, 6800, 6502
TOC

(More dry technical stuff, but please stay with me. I promise, it's important.) 

Mr. Mori waited a moment for the student talk to die down after the bell. "Some of you guys," he began, "were looking at the materials up here. That's what they're here for. But these are from my personal library, and I'd appreciate you not destroying them. They're not that expensive, but they are a little hard to replace. I am trying to get our school library to order some of the magazines, but no luck yet.

"And the spec sheets and data sheets aren't really that hard to replace, but requesting them takes time. If you want a copy, let me know and you can run down to the library and make photocopies. Or I can show you how to write and request materials from the manufacturers."

Back then, the 3 cents a page that copies cost at the library was about half, maybe a third of the price of a candy bar. You could buy lunch for the cost of copying a complete twenty-page datasheet. So it really would not have been cheap to make copies of all the datasheets for everyone.

"Or, if some of you get ambitious and work up some good notes and type them up, we can make dittos." 

Spirit copying was definitely less expensive than photocopying back then. 

There were some doubtful chuckles, and glances towards our table.

Cyndy ignored the glances, and I did, too.

Mr. Mori turned on the overhead and placed a transparency on it. 

"The COSMAC Data Processor CDP1802 has an interesting architecture. I've been reading the documentation a bit at a time, and it kind of bends my mind. I'll show you what I understand, but don't sue me if I get something wrong"

More chuckling. 

"The 1802 has an 8-bit data register D, which is more or less like the accumulators of the 8080 and 6800. The D register is where you do your math, and it has a carry and borrow flag, called 'DF'. 

"It has 16 general purpose 16-bit registers, which is a nice amount. But accessing the registers feels a little weird to me, a bit like they were making registers that behave like the 6502's page zero, but don't show up in the external address space. Kinda weird.

"What I mean by weird is that the 4-bit P register over here points to whichever register you want to be your current program counter. It's actually a kind of a nifty idea for handling interrupts and context switches, which we will talk about later. But it is unusual."

I don't think any of us understood enough yet to understand why we would think it was weird. 

"And the X register there below the P register in the diagram points to whichever is your current index register. So you can switch between X pointing to your stack pointer and pointing to a register pointing to data in memory fairly easily. But you have to remember to switch."

A few of us might have picked up some weirdness in that. 

"T, between them on the diagram, holds the old X:P pair after a subroutine call or an interrupt, and then your program code can save it from there. This is part of what makes this work, by the way." 

I know I didn't understand as much as I thought I understood about that. Nobody else volunteered to admit understanding it.

"I and N are used for decoding instructions, and are not directly accessible. I is the nominal instruction selector, and N is the nominal register selector for the instruction, and is part of the instruction when the only register is pointed to by X or P. Or something."

He paused for thought. 

"I don't really know if I understand enough more about it to explain further without giving instruction examples, and I want to save the instruction examples for later."

And he paused again, before continuing. "So I think I should let you guys ask a few questions, instead of randomly continuing to tell you more about what I'm not sure of."

"That looks like a lot of weird stuff. Why would they do all that?" Karl asked, with a tone that could have been sarcastic or petulant, maybe both.

"RCA apparently didn't intend to get into producing microprocessors. One of their engineers, Joseph Weisbecker, decided to build a computer out of transistor-transistor logic at home as a hobby project. He designed it as something he could build within his capabilities and resources. I understand he started with transistors, not integrated circuits. That's why the 1802 operates at a lower level than the three we've already talked about.

"His daughter thought it was a fun thing to program, and then he showed it to his managers, and some of them recognized there was a product in it, and others did not -- standard management not knowing what's going on. If they had taken it seriously, it's quite possible that RCA would have had a working 1802 microprocessor before Intel had a working 8080, and maybe even the two-chip 1801 before Intel's multi-chip 8008."

Barry asked, "Is it slow?" 

"I understand it's not as fast as the 8080 or 6800, but it shouldn't be that much slower -- maybe about a fifth their speed, maybe even as fast as a half their speed, depending on what your code is doing and how well you can program for each architecture. But the design works well in low-power CMOS manufacturing processes. They can make the processor very power efficient, and that is a big selling point. Apparently you can run an actual small 1802-based computer for a decent amount of time on a 9 volt radio battery if you use RCA's CMOS RAM." 

"Pocket calculator!" Hec, enthused, and I took note, too. 

My pocket calculator had just recently died.

Bill asked, "How about the size of the object code?" 

"I think object code size should be comparable to the 8080 and 6800, maybe better, depending on the programmer and the kind of problem being solved. But I'm not sure."

Cyndy asked, "Can you show us some of this code?"

"I'm not confident of the examples I have, and I'd like to show you the registers for the 9900 first."

He waited for a moment, but no one else spoke. 

"Are we okay on the 1802 registers? Should we move on?"

Everyone seemed to be okay with moving on.

"Okay, let's warp our minds some more and look at the Texas Instrument's TMS9900 register model."

He swapped transparencies.  

Again, there were random expressions of surprise. More than a few of the guys said, "No way!" or some equivalent.

Mr. Mori grinned. "Okay, let's try this." 

And he swapped for another transparency:

After a moment, Hec said, "So all the working registers are in memory."

"Hec's got it." 

"Is R0 the accumulator?"

"Pretty much any register can receive the result of operators."

"Any register can be used as an accumulator?"

"As I understand it, pretty much." 

"So it writes each result out to external RAM?", Bob asked for conformation.

"Yeah, that would be right." 

"That means it's going to be slow?"

"Maybe," Mr. Mori gave him a sideways grin. "TI apparently didn't want to use enough transistors to make a write-through cache for the registers, and there is still the question of how fast a CPU can be compared to RAM. 

"But it's a more recent, higher-level design. Overall, many TMS9900 instructions are going to do more than any single instructions on the others, so there is some performance gain from that. I do have the impression it is going to be a little slower than the 8080 or 6800 with similar memory clock speeds, but not much. Any more questions?" 

Karl asked, "How much of this all is going to be on the exams?"

There were groans and someone said, "Don't give him ideas!"

Mr. Mori smiled wryly and raised his eyebrows. "We'll see. If the class goes well, we may not need to put any of it on a test. If we find out you guys aren't really understanding any of this, I may need to review it all and give you a quiz."

There were grunts and general comments indicating more that we didn't want a quiz than that we understood. 

Cyndy laughed quietly at all the complaints. 

"So, no more questions about the 9900?" Mr. Mori checked again.

I said, "If I understood what you mean by high-level and low-level, I might have questions."

"High-level means easier to understand and use."

"Well, yeah, but I'm going to need something concrete." 

Mr. Mori nodded his head. "Anybody else? Or about the register sets of any of the other four?" 

Rick agreed with me. "I think we need to look at something more practical."

Mr. Mori grinned. "Okay, then I guess we should move on to addressing modes, already. Hang on a minute." Mr. Mori turned off the projector and turned his attention to the data sheets we had been looking at during break, muttering to himself a little.

"So, Hector," Cyndy spoke so quietly I could barely hear. "Can we talk?" 

"I'd like to."

I ignored them. 

"Okay, I think I know how I want to approach addressing," Mr. Mori announced, picking up a marker in one hand and approaching the whiteboard with several datasheets in the other. 

"After class?" Cyndy asked, even less audibly.

Mr. Mori continued, "The first addressing mode I want to talk about is register mode."

Hec said something too low for me to hear and gave her a nod that would have been barely perceptible even if I hadn't been watching out of the corner of my eye. 

I turned my full attention to the whiteboard.

TOC
Basic Addressing Modes for All
Where it starts


3809/2801: Drafts

2801 Drafted Basic Addressing Modes for All TOC (You may find this ...