Machine Language Programming Cookbook Classic Sampler

Machine Language Programming Cookbook Classic Sampler

Loading Social Plug-ins...
Language: English
Save to myLibrary Download PDF
Go to Page # Page of 4

Description: A brief sampler of a classic early computer cookbook on machine language programming. It has been taken to "level II" by a combination of Acrobat X and my Gonzo Utilities, resulting in dramatic improvements in file size, text and image quality, full seaarchability, and web value added. The Level I eBook is found at < > and the level II sourcecode at < >.

Author: Don Lancaster (Fellow) | Visits: 3063 | Page Views: 3310
Domain:  High Tech Category: Business Subcategory: history 
Upload Date:
Short URL:

px *        px *

* Default width and height in pixels. Change it to your required dimensions.

-- SIX --

Addresses and Address Spaces

Have you ever been behind the scenes in a post office? There are lots of similiarities between what goes on there and what happens inside a typical microcomputer. Our postmaster acts the same way a micro's CPU does when it decides what mail goes where. Large banks of boxes are available where users can go to pick up their mail. Any particular box might be for a family, for a business, for a club, or for a church, just as any particular location in a micro's address space can have various uses. These locations can be used for temporary or permanent storage of data and programs, or they can let you input or output to the real world.


Some post office boxes may be empty or unrented. Others may be seldom used. Yet others will be very busy and may even overflow if they aren't continuously emptied. In the same way, some locations in a micro's address space will be extremely busy, while others will not be used at all or may rarely see any action. The rules at the post office say you have to use the postmaster to get something from one box to another. You aren't allowed to stuff something into someone else's box on your own. Most older microprocessors work the same way. Almost everything you do with a micro has to go through the CPU's "hands." Some of the newest micros do have very powerful "memory-to-memory" transfer features built into their architectures, but this is not yet common. We see that the postmaster also has several sorting bins that simplify handling mail. Most pieces of mail have to go through one or more of these temporary stashes to allow sorting, routing, or forwarding. Some of the stashes are simple bins that can be used any old way the postmaster wants. Others have one special use, such as the safe for registered mail. The CPU in a microprocessor also has its sorting bins. These are called the working registers of the micro. Working registers are involved in practically all micro actions. Some of these working registers are very general stashes that can be used any way you like. Others have one special use. Some microprocessors have lots of working registers. Others may have fewer working registers but will have very fancy ways of getting things between the registers and the address space. These fancy ways are called address modes, and we will see lots more on them shortly. Buzzwords...

ADDRESS SPACE � The "reach" of a microprocessor's CPU. The total number of available locations the CPU can communicate with. WORKING REGISTERS � Temporary stashes available inside the micro's CPU that involve themselves with practically everything the CPU does. ADDRESS MODES�Ways for the CPU to get something into or out of a working register of an address space location.


In most micros, the address space is outside the microprocessor chip and the CPU while the working registers are inside the microprocessor chip. This is similar to the user boxes, which are available to anyone from the lobby, compared to the sorting bins, which are available only to the postal employees. Some single-chip micros do include some or all of their address space internally, but in general, the address space area is separate and different from the working register area. Let's take a closer look at one of our post office boxes. We'll assume it's in a small western town where everybody goes to the post office to get their mail. A typical box looks like this...

Repeating, an address is a location, and data is what goes in that location. Each address in a microcomputer must be unique. No mixups can be allowed. The addresses in the address space are often identified by a hex number. The working registers are usually identified by name or by a single letter.


The user box in a post office is like a single location in a micro's address space. How much mail this box can hold depends on the micro. In a 4-bit micro, we could put only four letters in a single address location. In the more popular 8-bit microcomputers, and in many locations of the 8/16 hybrid micros, we can put eight different letters in a box. We could call a bill a zero and a check a one, and limit ourselves to letters that are only bills or checks. As we have seen, those eight bits of an 8-bit word have 256 different states, just as there will be 256 possible combinations of eight letters that could be bills or checks. We can put any meanings on these states we want. An address location might hold a computer command, a segment of data, an ASCII character, a door in an adventure file, or almost anything we like. So... THAT'S WHY

In a typical 8-bit micro, each location in the address space can hold one 8-bit word.


Unlike the post office, we never really remove the mail unless we are replacing it with something else. The process of reading an address takes a look at what is in the address and makes a copy of it to use somewhere else. The process of writing an address destroys whatever data was in that location and replaces it with something new...

READING�Checking an address location to see what it contains. A copy of the contents is taken somewhere else. Reading DOES NOT alter the contents of the location. WRITING � Changing the contents of an address location by taking new data and storing it there. The old data is destroyed and gone forever. Writing DOES alter the contents of a location.

Two obvious points here. First, there is no way to tell what is stashed in a location unless you previously put something there.