We've got some tasks lined up for you. I've left an 8041 microprocessor on your desk. This thing is state of the art.
- Choose a task by typing its name into the left modem.
- Connect your 8041 to the modems by clicking on the ports
- Write a program to solve the task. Consult your x67 Assembly Programming Manual for this.
Assembly
Programming
Manual
Assembly
Programming
Manual
Contents
-
Concepts
- Values
- Instruction Set
Concepts
Features
The 8041 microprocessor features the following components:
- Two ports for input and output
- One register for holding intermediate values
- A display for editing code and observing its execution
- Two buttons to control execution
Each instruction begins with an opcode indicating which operation this is, followed by its operands, separated by spaces. The number and type of operands depends on the instruction. The different instructions are documented in the next section.
The instructions operate on values, which are numbers from -128 to 127. There are three types of operands:
- A source, representing a value that the operation will take as input
- A destination, representing a place where the operation will write a value
- A label, representing a point in the program
There are three types of sources:
- An immediate, which is a value written directly in the program. There are three ways to write an immediate:
-
-
In decimal, using the digits
0through9and possibly a minus sign -
In hexadecimal, beginning with a
0xprefix. The 16 hexadecimal digits are0through9followed byathroughf. -
In binary, beginning with a
0bprefix.
-
In decimal, using the digits
- A port, indicated by writing the name shown next to the port
- A register, indicated by writing the name of the register
A register is a circuit that stores a value. The 8041 has one register,
called ra. When the processor begins execution, the
registers are initialized to hold the value 0. There is
additionally the special register nil, which always holds
the value 0. Any values written to
nil are discarded.
A port allows the processor to communicate with other devices. When you read a value
from a port, the processor will block execution until a value is written to the connected port. Likewise, when you write a value to a port, execution will block until the value is read from the connected port.
A label is created by writing a name followed by a colon. The label can later be used as an operand by simply writing its name. As an example consider the following program which counts down from five, and then halts by entering an infinite loop:
mov 5 ra loop: mov ra out sub 1 ra jnz ra loop stop: jmp stop
Instruction Set
Data Movement
mov <src> <dst>
Reads the value at <src> and writes it to <dst>.
Arithmetic
add <src> <dst>
Reads the value at <src> and adds it to the value at
<dst>. This both reads and writes <dst>.
The rest of the arithmetic instructions follow a similar pattern, using
<src> to update <dst>.
sub <src> <dst>
Subtracts <src> from <dst>.
Control Flow
jmp <label>
Jumps to <label>, so that execution will continue from
there after this instruction.
jnz <src> <label>
Jumps to <label>, but only if <src> is
non-zero.
simpel
SIMPEL CORPORATION, 3065 Bowers Avenue, Santa Clara, CA 95051 (617) 615-1613Tasks
cp
- Reward: 1¢ / byte
The materials research group just bought some new tapes and they need help copying over their data. You can read the old tape through the `req` port, and then just write it as is to the `res` port. Should be a nice easy task to help you calibrate your equipment.
add
- Reward: 10¢
The nuclear research group is running some simulations and they need help with compute. They'll write two numbers to `req` and they just need you to add them up and write the sum to `res`.
mul
- Reward: 1$
They need help with multiplication too. This one's a little harder because your 8041 doesn't have a built in instruction to multiply two numbers. You're gonna have to implement the arithmetic yourself. I hear rumours that Simpel is gonna have a `mul` instruction on their next chip...
touppercase
- Reward: 10$ / name
Yesterday HR asked Evan Conrad to leave the premises because they thought he didn't work here. He does of course work here. What happened, it turns out, was they searched for him in the new employee database as `CONRAD`, but he was in the system as `Conrad`, so he didn't come up. We're gonna fix this by converting every name in the database to uppercase.
The names are represented using the ASCII text encoding. This assigns each 7 bit number from 0 to 127 to a character. The first 32 characters from 0x00 to 0x1f are called the control characters, and they do not represent visible text. The remaining 96 characters from 0x20 to 0x7f include the lowercase letters, the uppercase letters, the digits, and all the standard punctuation that you can see on your
standard American keyboard. The only control character you need to know about for now is 0x00, the null byte. All of our systems here at Cel Labs represent a piece of text as a null-terminated string, which just means a sequence of non-null bytes with one null byte at the end.
Here's a table of all the ASCII characters:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
| 0x0- | ␀ | ␁ | ␂ | ␃ | ␄ | ␅ | ␆ | ␇ | ␈ | ␉ | ␊ | ␋ | ␌ | ␍ | ␎ | ␏ |
| 0x1- | ␐ | ␑ | ␒ | ␓ | ␔ | ␕ | ␖ | ␗ | ␘ | ␙ | ␚ | ␛ | ␜ | ␝ | ␞ | ␟ |
| 0x2- | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / | |
| 0x3- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
| 0x4- | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
| 0x5- | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
| 0x6- | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
| 0x7- | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | ⌂ |
Here we've put in visible substitutes for the control characters (0x00-0x1f) and delete (0x7f). 0x20 is space, that's why you can't see it. With our punchcard systems
when we make a mistake we punch out all the holes in that row to indicate that it should be ignored. With our digital systems we could just overwrite the mistake, but ASCII kept 0x7f (seven 1's in binary) as the delete character for compatibility.
For this task, you can read the names from `req` as ASCII null-terminated strings. Then replace every lowercase letter with the corresponding uppercase letter, and write the result to `res`, again as an ASCII null-terminated string. Any other characters should be passed through unaltered.
Microwave
Shed
Electronics Catalog – Fall 1972
Product Selection Guide
Microprocessors
| Device | Clock (Hz) | Registers | Ports | Max LoC | Extensions | Price ($) |
| 8041 | 1 | 2 | 8 | 0.01 | ||
| 8067 | 0.25 | 1 | 3 | 8 | 0.15 | |
| 8069 | 2 | 2 | 3 | 10 | B | 1 |
| 80085 | 2 | 1 | 4 | 4 | D | |
| 8008135 | 4 | 1 | 4 | 6 | D |
| Device | Clock (Hz) | Registers | Ports | Max LoC |
| 8041 | 1 | 2 | 8 | |
| 80085 | 0.25 | 1 | 2 | 8 |
| 8008135 | 2 | 1 | 4 | 8 |
x67 Extensions
See the x67 Assembly Programming Manual for details on what features each extension adds.B
The bit manipulation extension. See the x67 Assembly Programming Manual for details.D
The 8067 Microcomputer is going to blow. your. mind.
You think you've seen a microcomputer before? Well you ain't seen jack. Do you have any idea how many transistors we fit in this bad boy? Yeah didn't think so. I'll tell you this much: it's a lot. And that's putting it nicely.
Free
Information
Service
BUSINESS REPLY MAIL
NO POSTAGE NECESSARY IF MAILED IN U.S.A.Microwave Shed
P.O. BOX 7842PHILADELPHIA, PA. 19101
Centipede.
|
This DP-11 got caught with its pants down. It was forgetting to carry the one in the 64s place. Chances are you wouldn't have noticed; Inspector Kurt Kroner did. There are 123,456 men at our Tainan factory with only one job: to inspect |
DP-11s at each stage of production.
Every register is tested (spot checking won't do), every operation is fuzzed. DP-11s have been rejected for scratches barely visible to the eye. We squash the centipedes; you get the caterpillars. |
Appendix A
Consider the number ...999, an infinite string of 9's repeating to the left. Obviously, this is ridiculous and there is no reason to consider it. It represents the sum 9 + 90 + 900 + ..., which is infinity, and you can't do anything interesting with infinity.
But dear reader, I know you are not so naive. Sure, strings of digits are meaningful because of the numbers they represent. You could add 243 to 324 by counting out 243 marbles and 324 marbles and putting them together. And if you tried to add 1 to ...999 using marbles, it would take weeks for the shipment to arrive with all the marbles you would need, and even then you still wouldn't have enough marbles. In fact, there is no amount of marbles you could have that would ever be enough.
But you would never add 243 and 324 using marbles. You would add them as decimal numbers, by adding the corresponding digits and carrying as needed. And if we try the same thing with 1 + ...999, then we find something surprising. In the ones place, 1+9 is 10, so we get a 0 and carry the 1. In the tens place, 1+9 is 10 again, so we get get another 0 and carry another 1. This continues forever, so we get a 0 in every place. So ...999 + 1 is ...000, which is just 0. So in this sense, ...999 = -1!