News:

See the Forum Status page for any planned Forum maintenance or alerts on Forum outages.

Main Menu

Binary Computing

Started by Dirt Roads, February 02, 2026, 07:55:51 PM

Previous topic - Next topic

Dirt Roads

Quote from: Scott5114 on January 27, 2026, 01:07:43 AMgenerally every instruction sent to the processor contains a numeric data value and a numeric value called an "op code". The op codes mean something like "add this number", "subtract this number", "store this number" ... that's the basics.

Quote from: kphoger on January 27, 2026, 09:28:14 AMNo, because it still doesn't help me understand how the computer knows what to do with the op code.  How does it know that a particular op code means "add this number"?  There's something fundamental that still baffles me.  At some point, the computer still has to know what to do.

Quote from: kphoger on January 27, 2026, 10:14:09 AMExplain it to me like I'm a fifth grader.

Perhaps this isn't Fifth Grade level, but it ought to be simple enough:

Binary Computing, Part 1

At its most simplistic core, a computer process chip is comprised of several different sections that specialize in executing certain functions.  Binary functions tend to be easier and simpler than other functions.  I'll discuss this in more detail as we go along.

As you probably already know, most computers use 5-volt DC inputs in a "single-wire" arrangement.  Some of the pins on the processor chip are specifically used to transfer data onto and off of the databus within the chipset.  In binary, a 5-volt input is a "one" and no voltage is a "zero".  For safety-related processes, we take the "zeros" and shunt that pin to ground so that there is no way for a false voltage to jump onto the chip.

Some of the pins are specifically meant to activate certain commands to the various portions of the chip.  The most simplistic commands are "shift left logical" (SLL) and "shift right logical" (SRL) functions.  These allow a byte of data be changed so that each bit is pushed to the left or right; this is done simply by hitting that specific pin on the chip with 5 volts.  Those same circuits can be activated internally on the microprocessor chip by triggering the firmware to hit that same specific pin with a 5-volt shot.

Other more complex functions involve multiplexing the commands onto input multiple pins at the same time and using the internal electronics of microprocessor chip to activate the proper command.  The sections of the microprocessor chip that are specific to math and logic functions are called "registers", which will be discussed later.


Dirt Roads

For those who are just beginning this adventure for the first time, let's go back to the beginning:

Binary Computing, Part 2

Bits are "1"s or "0"s;  Bytes (words) are strings of bits.  Using an 8-bit word for simplicity:

          Decimal 001 = Binary 0000 0001
          Decimal 002 = Binary 0000 0010
          Decimal 004 = Binary 0000 0100
          Decimal 008 = Binary 0000 1000
          Decimal 016 = Binary 0001 0000 
          Decimal 032 = Binary 0010 0000 
          Decimal 064 = Binary 0100 0000 
          Decimal 128 = Binary 1000 0000 

As you can see, an 8-bit byte (word) doesn't hold much in the way of numbers.  The maximum was:

          Decimal 000 = Binary 0000 0000
          Decimal 255 = Binary 1111 1111

Dirt Roads

Binary Computing, Part 3

For a very simplistic computer using 8-bit words, the primary tool involved something we called Instruction Sets (more commonly, Instruction Set Architecture – ISA).  This set up the basic instructions for primitive commands in the computer.  But first, it is important to list the internal portions of the simple computer chipset:

  • memory (arrays upon arrays of individual bits)

  • registers (a type of storage that can has rapid function processing)

  • flags (registers designed to keep track of data status)

  • devices (critters inside the computer connected to the databus)

  • peripherals (critters outside the computer)

You'll see various lingo and actual command names related to the movement of data back-and-forth amongst these chipset entities.   Here's the lingo that I was raised on:

  • fetch (retrieving data from memory

  • store (sending data to memory)

  • stuff (placing data in a register)

  • set (changing the status in a flag)

  • clear (resetting a register or a flag to all zeroes)

  • read (retrieving data from a peripheral device)

  • write (sending data to a peripheral device)

Dirt Roads

Binary Computing, Part 4

It's not as important nowadays, but understanding how to convert numbers to alphabetic characters was key to communicating with the non-geek world back then.  In the beginning, there were lots of alphabetic protocols.  Fortunately, the American Standard Code for Information Interchange (ASCII) was originally developed as a 7-bit code to represent Latin-script alphabet and other control characters (by the way, I learned IBM's advanced version EBCDIC before I ever got fluent with ASCII).

          Upper Case "A" = Decimal 65 = Binary 0100 0001
          Upper Case "B" = Decimal 66 = Binary 0100 0010
          Upper Case "C" = Decimal 67 = Binary 0100 0011
          Upper Case "D" = Decimal 68 = Binary 0100 0100
          Upper Case "E" = Decimal 69 = Binary 0100 0101
          Upper Case "F" = Decimal 70 = Binary 0100 0110
                      . . . . .
          Upper Case "Z" = Decimal 90 = Binary 0101 1010

In the case of cathode ray tube (CRT) monitors such as a small television screen being used to display alphabetic characters, a typical screen size was 320 X 200 (width by height).  The entire array-upon-array of pixels was assigned to a specific section of memory, and if you wanted color pixels you had to assign full 8-bit words for each pixel.  This took up a lot of your onboard computer memory in the olden days.

For the computers that I was first exposed to, you also had to keep close track of the location on the screen.  The XY grid origin (0000 0000, 0000 0000) was usually located at the bottom right corner.  But when writing in English, you have to work exactly backwards (top-down and left-to-right).

Dirt Roads

Binary Computing, Part 5

After a byte is stuffed into the proper register, the programmer can initiate certain functions on the byte (in this case, an 8-bit word).  For the most part, we think of math functions:

Addition:  Register 0000 0001 plus Register 0000 0001 equals Register 0000 0010.
Subtraction:  Register 0000 0100 minus Register 0000 0010 equals Register 0000 0010.

Surprisingly, multiplication and division are much simpler.  Multiplication involves shifting bits in the register to the left;  Division involves shifting bits in the register to the right:

Multiplication:  Register 0000 0010 times Register 0000 0010 equals Register 0000 0100.
         Register 0000 0010 times Register 0000 0100 equals Register 0000 1000.
Division:  Register 0000 1000 divided by Register 0000 0010 equals Register 0000 0100.
         Register 0000 0100 divided by Register 0000 0010 equals Register 0000 0010.

In the first example, the registers are shifted one bit to the left to multiply by decimal 2; in the second, registers are shifted two bits to the left to multiply by decimal 4.

In the third example, the registers are shifted one bit to the right to divided by decimal 2; in the second, registers are shifted two bits to the right to divide by decimal 4.

There were/are plenty of other functions, including logical function like "and", "or", "exclusive or", etc.  And sometimes we had functions that split words into half-words and other chunk-outs.  Those are probably way more important nowadays.

Amazingly, almost everything imaginable can be broken down into a monotonous series of simple math problems that can be executed with registers.  Here is a list of notable exceptions, many of which were much easier to perform with a old-fashioned slide rule:

  • calculation of the mathematical constant π

  • logarithms

  • calculation of cube roots

On the other hand, the integration of circular geometry problems and the integration of calculus problems was made significantly easier except that you couldn't get to the final answer very quickly.  Each iteration required a monotonous series of "fetch", "stuff", then calculate and "store" to keep track of the innumerable answers for each iteration.

Dirt Roads

Binary Computing, Part 6

Lets switch over to memory.  Computers didn't have very much memory back in those days.  When the IBM Peanut (PCJr.) was introduced in 1983, most of them only had 64KB of memory, but you could pay up to 128KB. 

There were several different types of computer memory back in those days:

  • read-only memory (ROM), typically housing what is now called "firmware"

  • sequential access memory (SAM)

  • random-access memory (RAM)

  • eraseable programmable read-only memory (EPROMs)

ROMs were mainly used for internal computer programs such as the assembler for instructions written in machine language.  But if you were lucky, you could add an EPROM and assist the assembler with your own code to simplify or optimize certain functions. 

SAM was a generic term for types of memory that needed to fed sequentially; the most common form was reel-to-reel magnetic tape drives.  The problem with sequential access was that you always needed to start from the beginning and physically work your way through the storage device, byte by byte, until you arrived at the location that needed to be fetched or stored. 

RAM was intended to be a generic term for any form of memory storage that permitted data access by requesting at specific byte location; the term soon became synonymous with memory chips.  Early version only had a handful of circuit pins on the chips so as to transfer one bit at a time.

Programmable read-only memory (PROMs) were blank memory chips that could be programmed only once; the ones that most of used were manually plugged into a socket board and could easily be removed.  EPROMs allowed the chip to be completely erased with a strong ultraviolet lamp and reprogrammed.  EPROMs were mostly used to supplement the computer with user-specific "firmware" that could be changed from time-to-time.

1995hoo

I had a high school teacher I didn't like who required us to maintain a grade sheet tracking every grade she gave us, so I kept mine in binary notation. She was decidedly not pleased by it, and I don't think I improved her mood when I offered her my calculator if she wanted to check my work (it was capable of binary and hexadecimal calculation and conversion up to a certain point).
"You know, you never have a guaranteed spot until you have a spot guaranteed."
—Olaf Kolzig, as quoted in the Washington Times on March 28, 2003,
commenting on the Capitals clinching a playoff spot.

"That sounded stupid, didn't it?"
—Kolzig, to the same reporter a few seconds later.

kalvado

I guess that still doesn't answer any original questions. "decode", "enable pin" ,  "third state"..
And 5V was 1980s logic standard... Below 1v today

Dirt Roads

Quote from: kalvado on February 02, 2026, 08:19:51 PMAnd 5V was 1980s logic standard... Below 1v today

Yep, the last microprocessor that I really got focused on was the Intel 80186 (ergo, the 186) and it did come in the 3V version but we never used it because most of our interface circuit boards designed in the late 1960s and early 1970s.  To this day, I still think in terms of a 55-msec clock cycle.  When the 186 first came out in the early 1980s, the 6 MHz processor was considered pretty fast and way more than what we needed (or wanted).  Intel accomplished that by taking a slower clock oscillator speed and running it through multiple "doubler" boards to chop the clock signals into increasingly smaller cycles.  Some of the hardware guys at my (then) employer were convinced that Intel was still using an 18.18 hertz clock and "chopping the signal to death".

kphoger

Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMPerhaps this isn't Fifth Grade level



Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMbut it ought to be simple enough

I'm a fairly intelligent fellow.  But almost all of that was still over my head.

Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMAs you probably already know, most computers use 5-volt DC inputs in a "single-wire" arrangement.

Is that sort of thing common knowledge?  I certainly didn't already know it.

Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMSome of the pins are specifically meant to activate certain commands to the various portions of the chip.  The most simplistic commands are "shift left logical" (SLL) and "shift right logical" (SRL) functions.  These allow a byte of data be changed so that each bit is pushed to the left or right; this is done simply by hitting that specific pin on the chip with 5 volts.  Those same circuits can be activated internally on the microprocessor chip by triggering the firmware to hit that same specific pin with a 5-volt shot.

I get the vague impression that this is probably pretty close to the fundamental thing I don't understand.  But alas, I still don't get it.  I don't know what "shifting left" even means in this context.

Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMThe sections of the microprocessor chip that are specific to math and logic functions are called "registers", which will be discussed later.
Quote from: Dirt Roads on February 02, 2026, 07:58:46 PMregisters (a type of storage that can has rapid function processing)

stuff (placing data in a register)
Quote from: Dirt Roads on February 02, 2026, 08:00:59 PMAfter a byte is stuffed into the proper register ...

I don't understand how a bit or a byte can be moved or placed anywhere.  In my mind, it's not a physical object that can be put somewhere.  This probably sounds stupid to you, but I really don't understand that.

He Is Already Here! Let's Go, Flamingo!
Dost thou understand the graveness of the circumstances?
Deut 23:13
Male pronouns, please.

Quote from: PKDIf you can control the meaning of words, you can control the people who must use them.

kalvado

Starting from chapter 4 of the story:
There is a circuit called "trigger" -actually a variety of those, but whatever -  which can exist in 1 of 2 stable states, outputing 0 volt ("0" value, or value of  "1" - high voltage (which used to be 5V, but is often below 1 volt today).
State of the trigger can be changed by applying some signals on the input, but would not change otherwise.
An array of 8 (16, 32....) such circuits can be called "register", holding 8 (16, 32...) 0 or 1 values


Scott5114

#11
Quote from: kphoger on February 03, 2026, 08:21:30 PMI don't know what "shifting left" even means in this context.

Shifting left means shifting all of the digits leftward one place.

If I have "00001000" and I shift it left, I have "00010000". This is equivalent to multiplying by two (BIN 00001000 = DEC 8 and BIN 00010000 = DEC 16), the same way that when you "left-shift" a decimal number (e.g. 65 going to 650) you multiply it by ten.

Quote from: kphoger on February 03, 2026, 08:21:30 PMI don't understand how a bit or a byte can be moved or placed anywhere.  In my mind, it's not a physical object that can be put somewhere.  This probably sounds stupid to you, but I really don't understand that.

He's talking about memory addresses. A computer's main memory—its RAM—is divided up by the operating system into a number of memory locations. These more or less act like cells in a spreadsheet. I assume you can imagine placing the number 128 in a spreadsheet cell or moving it to a different cell. Likewise, you can put the number 128 in a memory location or move it to a different one.

A byte is eight bits. Eight bits can hold the numbers 00000000 through 11111111, which is to say, in decimal terms, the numbers 0 through 255. So when he says "stuff a byte into a register", he means "store a number with a value of up to 255 in a register".

And it actually is kind of a physical object you're putting there, since that bit pattern corresponds to a physical pattern of electricity inside the RAM chips! (And, as it turns out, a spreadsheet is actually using one or more memory locations to store the contents of each cell, so when you type "128" into a spreadsheet cell, you are actually physically stuffing a very tiny electric number 128 into the part of the RAM chip that corresponds to that spreadsheet cell!)

A register is a special memory location administered directly by the processor for use as its working memory—the OS has no say in how the processor uses these memory locations, like how your boss has spreadsheets you can't put numbers in. What I mean by "working memory" is when the processor is told "Left shift the number in memory cell E75", copies the number from E75 into its register, does the requested shift to the register, then stores the result somewhere (possibly back in E75, possibly somewhere else; the programmer specifies this).
uncontrollable freak sardine salad chef

Dirt Roads

#12
Quote from: kphoger on February 03, 2026, 08:21:30 PMI get the vague impression that this is probably pretty close to the fundamental thing I don't understand.  But alas, I still don't get it.  I don't know what "shifting left" even means in this context.

Oops.  I missed the top part of the reply from <Scott5114> where he points this out eloquently.

Sorry, I mixed the metaphors between multiplication (which I wrote early on last week) and "shift left" (which I wrote most recently).

Shifting left:  Decimal 4 = Binary 0000 0100  >shifted left>  Binary 0000 1000 = Decimal 8 (same as multiplied by 2)
Shifting right  Decimal 32 = Binary 0010 0000  >shifted right>  Binary 0001 0000 = Decimal 16 (same as divided by 2)

Hopefully, that makes way more sense now.  And the circuits inside the process register are fairly simple.  There is something called a "flip-flop" which turns a Binary 0 into a Binary 1 and vice versa.  In combination with a few well-placed "Logical Or" circuits, the internal part of the shift left (binary multiply) and shift right (binary divide) functions become the most simplistic of all of the ISA functions.  Most of the others involve doing some level of numeric math or logical math using more than one register as inputs to an equation.

By the way, all of this IS technically Fifth Grade logic in many cultures (sadly, not in America).

Dirt Roads

Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMAs you probably already know, most computers use 5-volt DC inputs in a "single-wire" arrangement.

Quote from: kphoger on February 03, 2026, 08:21:30 PMIs that sort of thing common knowledge?  I certainly didn't already know it.

For comparison, an old-fashioned transistor radio and most types of walkie-talkies use 9-volt DC inputs in a "single-wire" arrangement, whereas most of the same type of electronics in an old car use 12-volt DC inputs in a "two-wire" arrangement.  The main difference is that the negative from the 9-volt battery in a transistor radio is simply jumpered to the frame and mistakenly called ground.  The same practice was used on old-time computers, except the computer frame is also attached to the neutral on your 240VAC/125VAC power feed.

The takeaway here is that every electrical pin on your old computer processor was a positive 5-volt input, except for those connected to the frame and called "ground".  Once the transistor technology got to the point where the total electrical current on the chip was low enough, then only one pin to ground was needed.

Dirt Roads

Quote from: Dirt Roads on February 04, 2026, 07:31:23 AM
Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMAs you probably already know, most computers use 5-volt DC inputs in a "single-wire" arrangement.

Quote from: kphoger on February 03, 2026, 08:21:30 PMIs that sort of thing common knowledge?  I certainly didn't already know it.

For comparison, an old-fashioned transistor radio and most types of walkie-talkies use 9-volt DC inputs in a "single-wire" arrangement, whereas most of the same type of electronics in an old car use 12-volt DC inputs in a "two-wire" arrangement.  The main difference is that the negative from the 9-volt battery in a transistor radio is simply jumpered to the frame and mistakenly called ground.  The same practice was used on old-time computers, except the computer frame is also attached to the neutral on your 240VAC/125VAC power feed.

The takeaway here is that every electrical pin on your old computer processor was a positive 5-volt input, except for those connected to the frame and called "ground".  Once the transistor technology got to the point where the total electrical current on the chip was low enough, then only one pin to ground was needed.

And it is funny that we are talking about this now, as I've had a fuse blown out twice on an HVAC circuit board in the past two days.  Something is causing a computer circuit to draw too much power.

kalvado

Quote from: Dirt Roads on February 04, 2026, 07:31:23 AM
Quote from: Dirt Roads on February 02, 2026, 07:55:51 PMAs you probably already know, most computers use 5-volt DC inputs in a "single-wire" arrangement.

Quote from: kphoger on February 03, 2026, 08:21:30 PMIs that sort of thing common knowledge?  I certainly didn't already know it.

For comparison, an old-fashioned transistor radio and most types of walkie-talkies use 9-volt DC inputs in a "single-wire" arrangement, whereas most of the same type of electronics in an old car use 12-volt DC inputs in a "two-wire" arrangement.  The main difference is that the negative from the 9-volt battery in a transistor radio is simply jumpered to the frame and mistakenly called ground.  The same practice was used on old-time computers, except the computer frame is also attached to the neutral on your 240VAC/125VAC power feed.

The takeaway here is that every electrical pin on your old computer processor was a positive 5-volt input, except for those connected to the frame and called "ground".  Once the transistor technology got to the point where the total electrical current on the chip was low enough, then only one pin to ground was needed.
You don't remember tube radios, young man? Nor anode batteries?
And connecting things to neutral is a big no-no. Most outlets these days carry a third ground wire for that.

And processors have a shitload of ground (Intel's term) pins. 200W at 1.4 V is a lot of amps... Basically if you need a radiator, one ground pin is too weak..

Dirt Roads

Quote from: kphoger on February 03, 2026, 08:21:30 PMI don't understand how a bit or a byte can be moved or placed anywhere.  In my mind, it's not a physical object that can be put somewhere.  This probably sounds stupid to you, but I really don't understand that.

Quote from: Scott5114 on February 03, 2026, 10:04:40 PMHe's talking about memory addresses. A computer's main memory—its RAM—is divided up by the operating system into a number of memory locations. These more or less act like cells in a spreadsheet. I assume you can imagine placing the number 128 in a spreadsheet cell or moving it to a different cell. Likewise, you can put the number 128 in a memory location or move it to a different one.

A byte is eight bits. Eight bits can hold the numbers 00000000 through 11111111, which is to say, in decimal terms, the numbers 0 through 255. So when he says "stuff a byte into a register", he means "store a number with a value of up to 255 in a register".

And it actually is kind of a physical object you're putting there, since that bit pattern corresponds to a physical pattern of electricity inside the RAM chips!

Perhaps it would help to go way back in time and describe all of the steps to get an 8-bit byte of data off of a tape drive and stuff it into a register.  The clock speed for a Zilog Z-80 was 2.5 Mhz; thus the clock cycle was 0.4 msec.  For simplicity, let's assume that the tape speed is fast enough to read one bit during 2 clock cycles.

My computer request is to read the second byte on the tape and fetch it to the primary register.

When I make the request to read a byte of information, I was supposed to set a register flag to indicate that the read process way initiated.  I'm pretty sure that if I forgot to do this, that flag would automatically get set by the tape drive anyway.

  •    Clock Cycle   0001   >   Time   0000.4   msec   Turn power on to motor on the tape drive   
  •    Clock Cycle   0002   >   Time   0000.8   msec   Fast forward to Byte 1   
  •    Clock Cycle   0003   >   Time   0001.2   msec   Fast forward to Byte 1   
  •    Clock Cycle   0004   >   Time   0001.6   msec   Fast forward to Byte 1   

           . . . . .               

  •    Clock Cycle   4997   >   Time   1998.8   msec   Slowing tape speed down to access Byte 1   
  •    Clock Cycle   4998   >   Time   1999.2   msec   Slowing tape speed down to access Byte 1   
  •    Clock Cycle   4999   >   Time   1999.6   msec   Slowing tape speed down to access Byte 1   
  •    Clock Cycle   5000   >   Time   2000.0   msec   Tape head arriving at Byte 1   
  •    Clock Cycle   5001   >   Time   2000.4   msec   Read    1st    bit in   Byte    0001   
                                             
  •    Clock Cycle   5002   >   Time   2000.8   msec   Read    2nd    bit in   Byte    0001   
  •    Clock Cycle   5002   >   Time   2000.8   msec   Ignore   1st    bit in   Byte    0001   
                                             
  •    Clock Cycle   5003   >   Time   2001.2   msec   Read    3rd    bit in   Byte    0001   
  •    Clock Cycle   5003   >   Time   2001.2   msec   Ignore   2nd    bit in   Byte    0001   
                                             
  •    Clock Cycle   5004   >   Time   2001.6   msec   Read    4th    bit in   Byte    0001   
  •    Clock Cycle   5004   >   Time   2001.6   msec   Ignore   3rd    bit in   Byte    0001   
                                             
  •    Clock Cycle   5005   >   Time   2002.0   msec   Read    5th    bit in   Byte    0001   
  •    Clock Cycle   5005   >   Time   2002.0   msec   Ignore   4th    bit in   Byte    0001   
                                             
  •    Clock Cycle   5006   >   Time   2002.4   msec   Read    6th    bit in   Byte    0001   
  •    Clock Cycle   5006   >   Time   2002.4   msec   Ignore   5th    bit in   Byte    0001   
                                             
  •    Clock Cycle   5007   >   Time   2002.8   msec   Read    7th    bit in   Byte    0001   
  •    Clock Cycle   5007   >   Time   2002.8   msec   Ignore   6th    bit in   Byte    0001   
                                             
  •    Clock Cycle   5008   >   Time   2003.2   msec   Read    8th    bit in   Byte    0001   
  •    Clock Cycle   5008   >   Time   2003.2   msec   Ignore   7th    bit in   Byte    0001   
                                          
At this point, we are starting to actually ready the first bit from the second byte.

The tape drive will automatically change the flag for the read function to basically indicate that the it is only reading one bit at time and that the processor must wait for this byte to be completely read from the tape.

  •    Clock Cycle   5009   >   Time   2003.6   msec   Read    1st    bit in   Byte    0002   
  •    Clock Cycle   5009   >   Time   2003.6   msec   Ignore   8th    bit in   Byte    0001   
                                          
At this point, we have read each of the bits in the second byte.  Time to start storing to memory, still one bit at a time.

My mind is a little fuzzy in this step.  I want to say that each bit is added to an "accumulator" until the entire byte is filled with the data coming off of the tape drive.  For the Z-80, the term "accumulator" is used to mean a certain type of register used for math functions.  Also, I'm not clear whether the tape drive was stored left-to-right (highest binary digit first) or right-to-left (lowest binary digit first), and quite frankly we don't care as long as the computer puts the digits in the right places.

Anywhoosit, during the next phase individual bits are added to the appropriate type of memory.  For computers that needed to access lots of memory, a special memory chip called "cache memory" was added to allow the tape deck to run before the "read" and "fetch" commands were ever initiated.

  •    Clock Cycle   5010   >   Time   2004.0   msec   Read    2nd    bit in   Byte    0002   
  •    Clock Cycle   5010   >   Time   2004.0   msec   Store   1st    bit in   Byte    0002   
                                             
  •    Clock Cycle   5011   >   Time   2004.4   msec   Read    3rd    bit in   Byte    0002   
  •    Clock Cycle   5011   >   Time   2004.4   msec   Store   2nd    bit in   Byte    0002   
                                             
  •    Clock Cycle   5012   >   Time   2004.8   msec   Read    4th    bit in   Byte    0002   
  •    Clock Cycle   5012   >   Time   2004.8   msec   Store   3rd    bit in   Byte    0002   
                                             
  •    Clock Cycle   5013   >   Time   2005.2   msec   Read    5th    bit in   Byte    0002   
  •    Clock Cycle   5013   >   Time   2005.2   msec   Store   4th    bit in   Byte    0002   
                                             
  •    Clock Cycle   5014   >   Time   2005.6   msec   Read    6th    bit in   Byte    0002   
  •    Clock Cycle   5014   >   Time   2005.6   msec   Store   5th    bit in   Byte    0002   
                                             
  •    Clock Cycle   5015   >   Time   2006.0   msec   Read    7th    bit in   Byte    0002   
  •    Clock Cycle   5015   >   Time   2006.0   msec   Store   6th    bit in   Byte    0002   
                                             
  •    Clock Cycle   5016   >   Time   2006.4   msec   Read    8th    bit in   Byte    0002   
  •    Clock Cycle   5016   >   Time   2006.4   msec   Store   7th    bit in   Byte    0002   
                                             
  •    Clock Cycle   5017   >   Time   2006.8   msec   Store   8th    bit in   Byte    0002   
      
Now that the last bit has been read into memory, the tape drive will automatically trigger the computer to set the flag to indicate that the byte is complete and ready.  By this time in computer history (the Z-80 was introduced in 1976), the computer is smart enough to automatically initiate the "fetch" command on the register that you actually requested some 2.0068 seconds ago.  In the first generation of computers, the programmer had to check the flag each step of the way and initiate the "fetch" command only after the flag indicated "ready".
                                    
Now that we have stored an entire byte in memory and the flag set to ready, we can fetch it to the register.

Now that the "fetch" function has started, the computer electronically connects all eight of the "byte output" pins of the memory chip to the external databus and simultaneously connects all the "byte input" pins of the processor chip to the external databus.  Whatever bits are energized on the databus is what gets "fetched".

At the same time, we electronically connect all eight of the "byte input" pins of process chip to an internal databus, and also connect all of the bits of the primary register to the internal databus.  Also, the computer energizes an internal circuit on the processor chip for what I would call the "fetch pin" of the register to command the entire byte to be retained in the register.

  •    Clock Cycle   5018   >   Time   2007.2   msec   Fetch         All 8 bits in   Byte    0002   

At this point the "fetch pin" of the register would automatically be turned off after the entire byte has been uploaded.

Now that the entire byte of data has been "fetched" into the register, you can execute any of the instruction set commands.

Now, if you want to add two numbers together, you would first need to store the second byte into a secondary register before adding the two of them together.  The Zilog Z-80 was so simple that it didn't have a special set of registers to handle what I would call calculator functions.  Thus, there were a bunch of crazy tricks to store and fetch large floating-point decimal numbers and perform math functions while not dropping digits.

I might not have all of the details correct, but we are in the ballpark.  It's been a long, long time ago, in a place far, far way.

Fun fact:  In certain conditions, the tape would not read properly.  The tape drives were programmed to go back-and-forth until the flag indicated a full read of the byte.  We called this a "shoe-shine".

MikieTimT

Quote from: kalvado on February 02, 2026, 08:19:51 PMI guess that still doesn't answer any original questions. "decode", "enable pin" ,  "third state"..
And 5V was 1980s logic standard... Below 1v today

Yeah, we're not exactly dealing with TTL chips and wires on a breadboard these days.  Ah, the memories from the Digital Techniques class back in the 90's...

kalvado

Quote from: MikieTimT on February 04, 2026, 10:19:24 AM
Quote from: kalvado on February 02, 2026, 08:19:51 PMI guess that still doesn't answer any original questions. "decode", "enable pin" ,  "third state"..
And 5V was 1980s logic standard... Below 1v today

Yeah, we're not exactly dealing with TTL chips and wires on a breadboard these days.  Ah, the memories from the Digital Techniques class back in the 90's...
As stupid as it sounds, it's exact problem I am facing right now. I need to run some relays off a microcontroller, but even likes of Raspberry Pi pico or ESP32 are 3.3 V these days - and relay modules are mostly 5V..

Dirt Roads

Quote from: kphoger on February 03, 2026, 08:21:30 PMI don't understand how a bit or a byte can be moved or placed anywhere.  In my mind, it's not a physical object that can be put somewhere.  This probably sounds stupid to you, but I really don't understand that.

Maybe this illustration will help you visualize better.  Here's a simple "computer" that you are certainly familiar with:  the piano player.  The original piano players could only play 65 notes on the piano, almost entirely centered upon the Middle C note. 

A metallic reel was punched with digital "bits" with punch holes ("one's") indicating which of the 65 notes on the keyboard would be played.  (The punch reels were a development from the original "punch cards" used for knitting loom programming that was developed back in the early 1700s).  Irrespective of what you see on Wikipedia or a common primer for computer logic, the term "bit" was used with respect to punch cards and punch reels long before the development of electronic accounting machines (predecessor to modern-day computers).  IBM called the holes in punch cards "chips"; the voter machine industry called them "chads".

The early player pianos (Pianola's) used foot-peddles connected to bellows to create compressed air that operated both the roller for the programmed punchrole and also blew air through the holes to find the proper notes.  The compressed air pumped that gets pumped through the roller needs to be amplified in order to have sufficient pressure to activate the piano keys.  The similarities of this to the early carousel organs are striking  (stay tuned). 

It wasn't very long until piano player manufacturers started introducing other programming techniques into the code.  The first was split-stack controls, which allowed one half of the keyboard (or the other half, or both haves) to be dampened.  Next came programming for all 88 keys; phrasing to allow rhythm and tempo to be added to the melody; theme control to add emphasis or de-emphasis to certain notes, and even dynamics and expression (sforzando!).

Modern day pipe organs use an interesting mix of telegraph technology and early railroad signal technology to activate the notes with all sorts of different pitches.  (Much of the early railroad technology used forced pneumatics to both control railway switch mechanisms and to detect their positions and the status of locking mechanisms).  The non-vital portions of old-fashioned railroad data transmission system use reed relays (or similar) that are commonly used for control of pneumatic valves in a pipe organ.  For this reason, there are many railroad signal engineers who are also skilled in the maintenance of pipe organs (and quite a few of those were talented at playing the organ as well).  I could only wish for such skills.

Reed relays are so named because they were traditionally used to activate the pneumatic reeds in player pianos and pipe organs.  But reed relays were developed by Bell Labs in the 1930s in order to miniaturize (so to say) and simplify telephone switching equipment.  Both the railroads and the keyboard industries took this technology from Ma Bell, since it was inexpensive.  By the way, relays that have both front contacts and back contacts can be used backwards from what railroads do in order to construct a simple "exclusive or" logic circuit (either this input or that input).

Now to the concept of carousel organs, which are similar to player pianos but do so much more.  There are stacks and stacks of punched rollers handling everything from notes, registration (stops), tubular flexibility, and various ranks and pitches.  The indoor versions of these machines also included piano notes, percussion instruments and other kinds of wind instruments and stringed instruments.  Each roll carries the programming of a different tune.  All that the carnie has to do is turn the knob to the desired background music and hit the start button for the carousel ride (or whatever is the main attraction there).

All of this is handled with simple binary programming techniques, not unlike what we have been talking about with computers.  On the flip side, modern-day computers are being used to both automate and accentuate the operation of both pianos and pipe organs.  I've got a friend who uses his cell phone to program the music onto either the church organ (preferred) or the church piano, while he plays the other instrument by hand (or does he?).


noelbotevera

I have no intelligent contribution to make here except that this was an entire college course. Except that delved into the minutiae of instructions (fetch! decode! execute! writeback!)and I was utterly lost by the end.

Also took a microprocessor class where all of this stuff was ramped up to 11 because you had to keep track of memory addresses practically by hand (okay, you could read the memory map and set watchpoints, but it was up to you to know whether an address should have a byte. Have fun debugging!)

I'll share a fun tidbit by mentioning that ASCII is more than the English uppercase and lowercase alphabet (plus punctuation). There are 33 control codes. We only use 3 of them today: carriage return (new line), line feed (also a...new line, for some reason), and tab. The latter code has caused many a Linux user great headaches when using Vim. The other 30 are there for laughs at this point, because I don't know what they do and I think nobody else knows.
Pleased to meet you
Hope you guessed my name

(Recently hacked. A human operates this account now!)

Scott5114

Quote from: noelbotevera on February 04, 2026, 10:40:16 PMcarriage return (new line), line feed (also a...new line, for some reason)

ASCII was originally created for use with teletypes, which were electronically-controllable typewriters. Line feed would advance the page to the next line, then carriage return would return the carriage to the left.

These were more annoying at one point in time for Linux users—On Windows, a new line is typically encoded as a carriage return followed by a line feed. On Unix, it's just a line feed. This meant that sending text files back and forth between the two OSes tended to garble the newlines. However, from day one browsers had to deal with files from both OSes, so they silently translate the newlines to the preferred newline regimen of the user's OS. These days, it's rare enough for a file to go from one OS to the other without passing through a browser that it's rare that anyone even notices.

(I want to say Mac OS classic used just carriage return, but converted to line feed when it became Unix-based.)
uncontrollable freak sardine salad chef

noelbotevera

#22
Quote from: Scott5114 on February 05, 2026, 02:23:07 AMThese days, it's rare enough for a file to go from one OS to the other without passing through a browser that it's rare that anyone even notices.
Actually I wonder if this would crop up if I created a text file in Windows and sent it to you, a Linux user, through P2P file sharing (or physical media like a USB drive to exacerbate the point). Not sure if you meant "browser = internet browser" or if this is handled by, say, the terminal itself.

Now has Vim (or the Linux toolchain in general) finally agreed on whether TAB equals 4 spaces or no?
Pleased to meet you
Hope you guessed my name

(Recently hacked. A human operates this account now!)

kalvado

Quote from: Scott5114 on February 05, 2026, 02:23:07 AM
Quote from: noelbotevera on February 04, 2026, 10:40:16 PMcarriage return (new line), line feed (also a...new line, for some reason)

ASCII was originally created for use with teletypes, which were electronically-controllable typewriters. Line feed would advance the page to the next line, then carriage return would return the carriage to the left.

These were more annoying at one point in time for Linux users—On Windows, a new line is typically encoded as a carriage return followed by a line feed. On Unix, it's just a line feed. This meant that sending text files back and forth between the two OSes tended to garble the newlines. However, from day one browsers had to deal with files from both OSes, so they silently translate the newlines to the preferred newline regimen of the user's OS. These days, it's rare enough for a file to go from one OS to the other without passing through a browser that it's rare that anyone even notices.

(I want to say Mac OS classic used just carriage return, but converted to line feed when it became Unix-based.)
Plain text files are a rarity outside of some configuration these days, and even those are getting more involved.
HTML does relay on tags for new lines, and moreso text processor files like . docx

Scott5114

#24
Quote from: noelbotevera on February 05, 2026, 02:37:25 AM
Quote from: Scott5114 on February 05, 2026, 02:23:07 AMThese days, it's rare enough for a file to go from one OS to the other without passing through a browser that it's rare that anyone even notices.

Actually I wonder if this would crop up if I created a text file in Windows and sent it to you, a Linux user, through P2P file sharing (or physical media like a USB drive to exacerbate the point). Not sure if you meant "browser = internet browser" or if this is handled by, say, the terminal itself.

By browser I meant internet browser specifically. In general, this has always been handled fine on the Linux end, since it can just ignore the extraneous LFs (and Linux software is typically written to work around the braindead practices of other OS's software assuming they are the only OS in the universe). The problem is more with Windows software which has no idea how to handle bare CRs.

Quote from: noelbotevera on February 05, 2026, 02:37:25 AMNow has Vim (or the Linux toolchain in general) finally agreed on whether TAB equals 4 spaces or no?

No, because \t (the tab character) has semantic meaning that four spaces doesn't—when you copy a range of cells out of, say, Google Sheets, a string is saved to the clipboard with \t-separations between the cells. The Makefile language (used in building C and C++ software) also uses \t for semantic purposes, which replacing with spaces would break. Because these and other uses exist for the \t character, it cannot be obsoleted, so there must always be a way to generate one on purpose.

The Kate editor, my editor of choice, inserts spaces when I hit Tab, but there is a hotkey (which I always forget) to insert a literal \t character. It displays tab characters with a small grey chevron so that one doesn't misinterpret them as being spaces.

Quote from: kalvado on February 05, 2026, 07:34:40 AMPlain text files are a rarity outside of some configuration these days

This is almost certainly the wrongest post made on the forum this year—even .docx, which you mention in your post, is just a bunch of plain text files in a .zip wrapper!
uncontrollable freak sardine salad chef