ODYSSEY2

COMPUTER INTRO

BY MAGNAVOX

Contents

2. In The Beginning

11. The World of the Computer

20. Creepy Crawler

28. Creepy Crawler Version II

29. The Roll Mode - Your Program Trouble Shooter

30. Addition*Program A

35. Addition*Program B

40. Addition*Program C

46. One Digit Multiplication

52. One Digit Division

62. Area Problems Using "Go to Subroutine" and "Return"

71. One Digit Addition Flash Card

74. Three Ways to Enter and Output a Letter

76. Six Letter Guess

80. Message

87. Operating Mode Review

92. Glossary of Frequently Used Computer Terms

100. Instruction Sets

104. Program Sheets

this gatefold will provide you with an electronic road map - please keep it

open as you work with your Odyssey2 computer

Key Codes

Key Hex Decimal

Code Code Equivalents

-------------------------

0 00 00

1 01 01

2 02 02

3 03 03

4 04 04

5 05 05

6 06 06

7 07 07

8 08 08

9 09 09

A 20 32

B 25 37

C 23 35

D 1A 26

E 12 18

F 1B 27

G 1C 28

H 1D 29

I 16 22

J 1E 30

K 1F 31

L 0E 14

M 26 38

N 2D 45

O 17 23

P 0F 15

Q 18 24

R 13 19

S 19 25

T 14 20

U 15 21

V 24 36

W 11 17

X 22 34

Y 2C 44

Z 21 32 [incorrect]

Blank 0C 12

: 0A 10

$ 0B 11

Clear 2E 46

? 0D 13

. 27 39

+ 10 16

- 28 40

* 29 41

./. 2A 42

= 2B 43

Enter 2F 47

Internal Flow

[Illustration shows a box labeled Control Unit, boxes hanging off it labeled

Accumulator, Program Counter, Subroutine Return Address Register, ALU, and

Registers 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. Also, arrows pointing to and from

the Control Unit and three boxes Labeled Memory (ROM) Instructions and

Constants, Keyboard, and Symbol/Sound Generator. Also, an arrow going from

Symbol/Sound Generator to a box labeled TV Screen.]

Keyboard

[Illustration of the keyboard]

Computer Intro is not for everyone - but if you're up for a rewarding mental

challenge, here is a fascinating entry point into a complex and highly

technical subject.

The cartridge turns your Odyssey2 into a very special kind of computer. It

won't balance your checkbook or do your income tax or plot the course of a

spaceship to Mars.

But it will giveyou some idea of how those computers do their work. You

will begin to understand how a computer "thinks" and even begin to think like

a computer "thinks."

The initial orientation and explanation are deliberately couched in the

most simplistic of terms. They don't assume anything more on your part than a

working knowledge of basic arithmetic.

After a brief explanation of how computers work and what they are made of -

you will start getting "hands on" experience and will learn by doing.

You will learn how to enter a program - the first stop in learning how to

actually write your own.

The gatefolds in the front and back of the manual provide you with

electronic road maps. Keep these references in front of you and you will

clearly understand what's going on and how computers really compute.

In The Beginning

In the beginning, there were ten fingers - then a prehistoric Einstein

discovered his toes and man could count up to twenty.

The oldest computing device we know of is the abacus. It was first used in

China in the sixth century B.C.

The very first digital computer was designed by Charles Babbage in the

1830's. It was more than a calculator. Babbage designed it to be

programmable, and it would have been able to perform any arithmetic or logic

calculation.

It was designed to use punched cards for entering data and instructing the

machine with mathematical commands.

[Illustration shows an abacus. Caption: Chinese Abacus]

[Illustration of a person using an abacus]

[Illustration of a Babbage computer. Caption: Babbage computer]

There were two problems.

Problem one. Babbage's elaborate drawings called for a building the size

of a Dickensian shoe factory to house his "analytical engine."

Problem two. Babbagge died before the machine could be built.

The first practical programmable computer was built in a basement at

Harvard University during World War II by IBM. It weighed 35 tons!

This machine used an exotic combination of electronic, electrical and

mechanical gear to do its arithmetic. The instruction program was stored on a

punched paper tape that unreeled automatically. Number were entered into the

machine on a panel covered with 1,440 dials!

The first all-electronic computer was built at the University of

Pennsylvania shortly after the war ended. ENIAC (Electronic Numerical

Integrator and Computer) was 1,000 times faster than its predecessor.

But it filled a room 30 feet wide and 50 feet long. Its 18,000 vacuum

tubes were connected by about a half-million soldering points.

Today, everything that ENIAC could do and far more is performed by a device

slightly smaller in size.

It is less than one quarter of an inch square - and can make more than one

million electronic decisions every second. It is called a semiconductor. It

is possible for one semiconductor in one of its newest forms - the

microprocessor - to account for more than 310 trillion separate functions.

[Illustration of a bunch of gears. Caption: Detail section of the Babbage

computer]

And this is only the beginning!

If computer technology continues to develop at its present rate, one of

these chips will be able to store about a quarter-million bits (the smallest

unit of computer information) in its memory within a few years.

Ten years from this point, there will be hips capable of remembering a

million bits of information.

By 1990, the number of logic or decision-making computer circuits on these

one quarter inch chips are expected to number a quarter of a million.

Today's large computers, selling in the one million dollar range and as big

as several filing cabinets, contain only about 10,000 logic circuits and a

main memory capacity of a few million bits.

[Picture of a circuit board]

[Picture of a few buttons, with one lit button labeled READY. Superimposed is

a green sine wave]

[Picture of a chip, with some forceps reaching to grab something.]

As microprocessor technology progresses, computers may be developed that

understand human speech.

It is even possible that they can be taught to read handwriting!

The microprocessor in your Odyssey2 is infinitely more sophisticated than

the mathematical marvels that were the state of the art in the forties and

fifties.

The technology of the microprocessor is unquestionably going to

revolutionize the way the world works - and the way you'll live. A computer

will control your car's automatic transmission and fuel injection system.

A computer will monitor fire and burglar alarm systems in your home.

The lights in your home will be computerized. So will the locks on the

doors and windows.

[Picture of another circuit board]

[Picture of a display tube with a hand operating a control on it]

A computer will even water the lawn.

A computer will do your shopping from the house - and pay your bills

without you writing checks.

Computers will simulate three dimensional space for architects to help them

mentally walk around their houses before they're built.

Computers will alert doctors to patient problems that would be

imperceptible under today's circumstances.

Computers will help composers hear their music as they're writing it - even

if it's too complicated for them to play.

Businessmen can have electronic simulations of their companies in their

attache cases.

We are really still just at the very beginning of the computer age. You

have picked a very good time to get involved.

[Picture of some sort of control panel, with an image of cars on a freeway

double exposed on top of it]

[Picture of a circuit board]

The World of the Computer Is Strange and Wondrous

Computers have already carried man to the moon - to Mars - and far beyond.

They lie at the heart of fearsome weapons systems.

They fly planes - monitor automobile engines - run factories - and even

translate languages.

All of these with the brain power of a good screwdriver.

Congratulations! You have just completed your first lesson.

You are much smarter than any computer at the present state of the art!

For all of its awesome capabilities, the computer is nothing more than a

rather simple-minded tool.

But once you learn how to use it, you'll have more power at your command

than Julius Caesar ever dreamed of.

A computer has few basic talents.

It can add - and it can move numbers around.

A computer never forgets - and computers don't make mistakes. (If a

computer churns out misinformation, there's a mistake in the program.

Computers are utterly faithful in following instructions.)

Big deal. Computers can't multiply, divide, or even subtract the way you

do. But what a computer does do, it accomplishes with absolutely astonishing

speed.

Your Odyssey2 can make over 100,000 electronic decisions every second - and

there are computers around that are more than ten times faster than that!

To multiply, Odyssey2 simply adds number together at an incredible speed.

To subtract, it moves numbers around in a special way so that adding them

together will give the correct answer. This sounds like doing it the long way

- but when you're that fast at addition, the juggling act becomes worthwhile.

It's not all that hard to talk with a computer. It only understands two

words. Yes - and no. Yes - means that an electrical pulse is tickling the

computer's sensitivities. No - means that no electrical pulse is going

through.

The symbol for "yes" in computer language is 1.

The symbol for "no" is 0.

Once you have memorized 0 and 1, you have memorized the entire alphabet of

the only language computers speak in any country of the world.

This is called a binary system because there are only two symbols involved.

It's sort of a code. Here's the key.

Binary Numbers and Their Decimal Equivalents.

1=0001 5=0101 9=1001 13=1101

2=0010 6=0110 10=1010 14=1110

3=0011 7=0111 11=1011 15=1111

4=0100 8=1000 12=1100 16=0001 0000

Letters of the Alphabet and Their Binary Code Equivalents.

Keyboard

Letter Binary Decimal Hexidecimal

A 0010 0000 32 20

B 0010 0101 37 25

C 0010 0011 35 23

D 0001 1010 26 1A

E 0001 0010 18 12

F 0001 1011 27 1B

G 0001 1100 28 1C

H 0001 1101 29 1D

I 0001 0110 22 16

J 0001 1110 30 1E

K 0001 1111 31 1F

L 0000 1110 14 0E

M 0010 0110 38 26

N 0010 1101 45 2D

O 0001 0111 23 17

P 0000 1111 15 0F

Q 0001 1000 24 18

R 0001 0011 19 13

S 0001 1001 25 19

T 0001 0100 20 14

U 0001 0101 21 15

V 0010 0100 36 24

W 0001 0001 17 11

X 0010 0010 34 22

Y 0010 1100 44 2C

Z 0010 0001 32[BAD] 21

Working with endless daisy chains of 0's and 1's would be more than tedious

for the human brain - but the computer is really good at it.

The inside of a computer is mainly a series of little electronic gates. 0

- the absence of an electrical pulse - leaves the gate open. 1 - the presence

of an electrical pulse - closes the gate. And remember - the electronic gates

in your Odyssey2 computer are opening and closing at the rate of 100,000 times

every second.

You will enter programs in your Odyssey2 through either the hexidecimal or

assembler language (these will be explained later). The Odyssey2 will then

change the data and instruction sets entered into binary language (1's and

0's) and store that information in the Memory and in the registers.

The actual computing is done by the computer's Central Processing Unit

(CPU). The CPU in your Odyssey2 is composed of the Accumulator (a working

register which stores data temporarily); the Program Counter (a working

register which locates and identifies the instruction sets and keeps them in

order); the Registers (in which data, implemented by the programmer, is

stored); the Sub-Routine Return Register (which is used with a certain

instruction set); the Arithmetic Logic Unit (ALU); and the Control Unit.

The Control Unit directs the flood of electronic traffic traveling through

the computer and controls the data flow between the different components of

the computer. For example, it regulates the flow of information between the

Memory and Arithmetic Logic sections and also orders processed data to move

from the Memory to the Output terminal. The Output terminal of your Odyssey2

computer is the screen of your television set.

The Arithmetic Logic Unit is where the computer teaches numbers to tap

dance. Its nickname is "number cruncher." It acts on the binary data fed

into the computer's memory and registers - and then changes them according to

the programmed instructions.

Now, you're ready to learn by doing. You're going to enter a program into

your computer. Open the fold-out at the front of the book and you'll see what

happens to everything along the way.

Important point. The neat thing about computers is that they will always

follow your instructions with unflagging good faith. The dumb thing about

computers is that they will only do what you have instructed them to do.

It's very important to make sure that you enter every step and do it right.

If you make an error, the computer is going to make an error.

Be sure that the power to your Odyssey2 console is turned off. Insert the

COMPUTER INTRO cartridge into the console. Be sure the label side is facing

the alpha-numeric keyboard. Now, turn on the power.

You're going to be talking with your Odyssey2 computer through the

keyboard. It will talk back to you over your television screen.

[Illustration of the Odyssey2 keyboard]

Let's take a brief trip around the keyboard. It has forty-eight keys.

Each key has been encoded in the computer languages we're going to be using.

You'll find this code on the gatefold at the front of the book.

The keyboard also contains some surprises - four games that have been

pre-programmed in the cartridge.

Press 2 on the alpha-numeric keyboard. A FLASH CARD addition game will

appear on your television set. An unsolved addition problem flashes on your

screen. You enter the solution through the keyboard. If the answer is less

tha 10, preface the number with a 0. (Important! Always use the numeral 0 at

the top of the keyboard when entering a 0.) If you give a wrong answer, an

angry NO will appear on the screen. If you give a correct answer, it will

appear in its proper position. To bring another problem to the screen, summon

it from the computer by pressing any key.

Adding numbers is no big deal until you see how many addition problems you

can solve in one minute. If you keep trying to beat your own record or

another player, you can't help but sharpen your skills.

Press RESET, then press 3 on the alpha-numeric keyboard and you're into

COMPUTER TELEPATHY! It's a high-low game. The computer secretly chooses a

number between 00 and 99. The secret number won't appear on the screen - but

a question mark will. You make a guess at the correct number and enter it

into the computer. Your guess will appear on the screen. It will be followed

by an H if it is higher than the computer's secret number - or an L if it is

lower. If you guess correctly, the number will be followed by an X. Play

against an opponent and see who can guess the computer's secret number in the

fewest number of guesses.

Now, press RESET, then press 4 on the alpha-numeric keyboard. BETWEEN THE

SHEETS appears on the screen. You'll see three sets of numbers. Example: 03

07 00.

The first two numbers are the sheets. The computer has thought of another

number which it is keeping to itself. The last number is your score. If you

think the computers secret number is between 03 and 07 press YES on the

alpha-numeric keyboard. If you don't think it falls between 3 and 7, press

NO. If you are correct, you score a point and the number will apear between

the 3 and 7. If you are wrong, the computer rewards you with a couple of

BEEPS right in the ear and your score remains the same.

Press RESET, then press 1 and a series of blocks appears on the screen.

The blocks flashes in random order and are accompanied by a buzzing sound. We

call this spooky effect "THE CREEPY CRAWLER." You can call it anything you

want.

We can re-program The Creepy Crawler to display other symbols on the

screen. There is a large selection of graphics in the memory of your

Odyssey2. You'll find the complete collection in the fold-out at the back of

the book.

The Creepy Crawler program is quite short and represents a good starting

point. We're going to follow this and succeeding programs with a sort of road

map so you can see where your input goes and what the various parts of the

computer do with it.

There are two ways you can program your computer. You can speak

HEXIDECIMAL code (machine language). An instruction would look like this: 60.

Your computer takes 60 and converts it into its binary equivalent: 0110

0000. Notice that this binary translation has eight digits. These are called

BITS. Bits are handled by the computer in groups of eight. One group is

called a BYTE. A byte is the smallest piece of information a computer can

work with.

In Odyssey2 Hexidecimal language, 60 means "Load a value into Register 0."

(A register is a place where a computer stores information. There are sixteen

registers in your Odyssey2. Each register has room for one byte of

information.)

The second computer language your Odyssey2 understands in called ASSEMBLER.

Assembler uses alpha-numeric symbols to input binary code instructions. An

instruction in Assembler is more phonetic than Hex - but it is also longer.

Example: LDV.0.38 means - Load a value into register 0 - and that value is

38. (Important: Be sure to enter the periods in the assembler instructions or

the computer will not know what you're talking about.)

In the back of the book, you'll find a complete chart of Instruction Sets

for your Odyssey2.

INSTRUCTION SETS are the codes that tell your computer what you want it to

do with the data you're going to give it.

Also Important: "0" is the equivalent of zero in the numeric section of

your keyboard. "O" is the letter of the alphabet.

Now, open the gatefold at the back of the book. You'll find a flow chart

that tells you how to get into the various operating modes of your Odyssey2.

These modes are for displaying data in the registers, entering and executing a

program, rolling through a program to check data and much more.

Leave the front and back gatefolds open. You'll have your reference

material right in front of you.

We are now ready to re-program the fearsome Creepy Crawler. First, we'll

enter in Hex - and then we'll do a variation in Assembler.

Creepy Crawler

Press the POWER BUTTON OFF and ON to clear the computer.

Press RESET "Command" appears on your screen. Your computer is in the COMMAND

mode and ready to accept instructions. It knows you want it to do something

but doesn't yet know what.

Press P "Program" appears on the screen. "Aha," thinks the computer.

"Somebody wants to enter a program! I wonder what language this person will

speak!"

Press M "Hex Input" appears on the screen. The computer now knows you will be

communicating in HEX. You're going to be using the Hexidecimal Operational

Code (OP CODE).

Press I Step 00 appears on the screen and the computer is ready and waiting to

accept data.

00

Press 60 This is Op code for Load Register 0. Register 0 is one of sixteen

registers in your Odyssey2 that make up part of its Random Access Memory

(RAM). Each register is a small memory divide that provides temporary storage

for data and instructions which will eventually be needed by the ARITHMETIC

LOGIC UNIT (ALU) - the place where all simple reasoning and arithmetic

operations are performed. Look at the registers in the computer as sixteen in

and out boxes on a desk that is shared by both you and the Arithmetic Logic

Unit.

Press ENTER Program Step 01 appears on the screen. Register 0 has now been

activated to accept your entry upon execution of the program. (The program

steps you enter into the computer do not actually become functional until you

press E [EXECUTE] at the completion of the program.)

01

Press 3A You have just selected an electronic figure from your computer's

gallery of electronic art and symbols, which are stored in the symbol/sound

generator. You'll find the entire gallery in the fold-out at the back of the

book. We've selected the little man as an example, but you can actually use

any of the figures or symbols for this program. They have been permanently

stored in your computer.

There are two parts to the memory unit in your computer. The ROM (Read Only

Memory) contains the instruction sets and constants to be used in programming.

(The constants may be repetitive numbers needed for mathematical computation

by the ALU - Arithmetic Logic Unit, or they may be letters, numbers, or

symbols which you have entered into the Odyssey21 in a program which will

remain the same throughout the program. See the program "Message.") The

other part of the computer's memory is called RAM (RANDOM ACCESS MEMORY).

This memory component is like a blackboard. Programs, instruction sets and

constants can be entered and later erased so that new data can be entered.

You're writing this program on the RAM component of the microprocessor in your

Odyssey2.

Press ENTER Program step 02 appears on the screen. The little man will be

loaded into Register 0.

02

Press 61 This is Op Code for LOAD REGISTER 1. It tells your computer you

want to give input to that data storage unit.

Press ENTER Program step 03 appears on the screen - and the door to Register 1

will open to receive data

03

Press 0C This is Op Code for a blank like the space between words in a

sentence.

Press ENTER Program step 04 appears on your screen. The blank will be loaded

in to Register 1.

04

Press 6B This is Op Code for positioning. You are opening the door to

Register B and telling it you want it to display the little man at a certain

place on the screen upon execution of the program. You'll let it know where.

Press ENTER Program step 05 appears. The door to Register B will open.

05

Press 00 This entry tells the computer you will want it to display the little

man at the furthest left position on the screen.

Press ENTER Program step 06 appears on your screen. The positioning

information will be loaded into Register B.

Register B is the register that positions symbols or characters on the screen.

It has been given eleven positions. 00 is the furthest left. 0A is the

furthest right. When Register B outputs on the screen, it automatically

increments or advances by one. If we output a symbol in 00 (position one),

the symbol will appear in the first position and Register B will then advance

automatically to position 2 (01). If Register B outputs in the last position

(0A), it automatically resets itself back to the first position (00) on the

next step. Whatever data was in that first position will be replaced by the

new input.

06

Press C0 This is the Op Code that tells the computer you are going to want to

bring that little man to the screen. You have given him a way to get out of

Register B.

Press ENTER Program Step 07 appears on the screen.

07

Press C1 This is Op Code for telling the computer you want to bring that

blank in Register 1 to the screen.

Press ENTER Program step 08 appears on your screen to tell you everything is

going along smoothly.

08

Press 05 It's sound effects time. This is an Op Code that tells the computer

you will want to hear a one second buzz.

Press ENTER Program step 09 appears.

09

Press 08 This Op Code tells the computer you want it to come with an

unlimited sequence of random numbers. The computers that encipher and

decipher secret messages for governments do this everyday. In the old days,

crypt keys remained constant and could be broken easily. Today, they change

constantly and at random. Today, it takes one computer to break another's

cipher.

Press ENTER The random number instructions are entered into your computer.

Program step 10 appears on the screen.

10

Press BB This is Op Code for UNPACK Register B. This is the Register we use

to position our little man on the screen. This unpacking instruction takes

the random two digit number selected by the Accumulator and places one digit

in Register B (we are unpacking Register B, thus the Op Code BB) and the other

digit in the Register immediately following B, which is Register C. The digit

in Register C is ignored. Another example of unpacking - If we had unpacked

Register 0, the Op Code would have been B0, and one digit on the random number

would have been placed in Register 0 and the second digit in Register 1.

To look at it another way, think of the Accumulator as a suitcase and the

registers as a tall dresser with 16 drawers. You unpack two items from your

suitcase and put the first away in a drawer. The second item will

automatically go to the drawer just below it.

At the end of the Creepy Crawler program, a variation is written explaining

how to use the second digit of the random number which was loaded into

Register C, along with numerous figures to execute a random display of figures

on the screen.

Through this unpacking instruction, the positioning Register (Register B) is

loaded from the Accumulator with a random number. It is this instruction

which will cause our little man to travel to unpredictable places on the

screen. (The Accumulator is a small memory device in the CPU that provides

temporary storage for the Arithmetic Logic Unit. It can store the result of

an ALU operation or serve as an operation source [OPERAND] for the ALU.)

Press ENTER The unpacking instruction is entered and programm step 11 appears

on your screen.

11

Press 12 This OP Code tells your computer you're going to want it to return

to a previously programmed step.

Press ENTER Program step 12 appears on the screen and the computer wonders

which program steps you wish repeated.

12

Press 06 You have just told the computer you want it ot go through the

motions and always return to program step 06. This was the place you wanted

the little man positioned on the screen which was subsequently combined with a

random number to change the positioning on the screen. In effect, you have

now "looped" part of your program. It will do its thing endlessly with

endless variations.

Press ENTER The computer salutes and will do as you ordered. Program step 13

appears.

Press RESET The program is stored and you are back in the COMMAND mode.

"Command" appears on your screen.

Press E You have instructed the computer to execute your instructions. The

fearsome Creepy Crawler appears on your screen. The little man or whatever

symbol you have chosen will flash and buzz in different positions on the

screen.

Forever.

Or, until you turn it off.

Or, change the program.

Whichever comes first.

Important! The power switch on your console is your program eraser. Turn it

off and the program is cleared from the unit automatically. Turn it on -

and you're ready to enter a new program.

Now that you've entered Creepy Crawler in HEX, Try entering this variation in

ASSEMBLER language. We will call this program Creepy Crawler with an All-Star

Cast of Thousands.

First, turn the power off and on to erase any previous programming. Now,

check the fold-out Operational Flow Chart to see how to get into the Assembler

Input Mode.

Press RESET

Press P

Press A

Press I

You are now in the Assembler Mode at program step 00 and ready to go. One

thing. Be sure to enter the periods as well as the letters and numbers.

Press L

Press D

Press V

Press .

Press 2

Press .

Press 1

Press 3

Press enter

We are now at Program step 02. Continue entering in Assembler until you get

to Program step 13. At this step you will begin entering a variety of symbols

in HEX. There is no Assembler equivalent for them - so after Program step 12,

switch over to the HEX Input Mode. Check the Operational Flow Chart and then

-

Press CLEAR

Press ROLL

Press CLEAR

Press M

Press I

After you finish entering the program, press RESET to store the program - then

press E (EXECUTE) and watch what happens!

Creepy Crawler Version II

Hex Assembler

Step Code Code Byte Remarks

------------------------------------------------------------------------

00 62 13 LDV.2.13 2 Load Reg. 2 with 13

02 08 RND 1 Accum. selects a random number

03 BB UNP.B 1 Unpack the random number into Reg. B and C

04 9C LDA.C 1 Load the Accum. from Reg. C

05 E2 ADD.2 1 Add the contents of Reg. 2 to the Accum.

06 AC STO.C 1 Store the contents of the Accum. in Reg. C

07 09 MOV 1 Load Accum. from a Program step

08 0B OTA 1 Output from Accum. to screen

09 05 SIG 1 One second buzz

10 00 NOP 1 No operation (used as pause)

11 12 02 GTO.02 2 Instructs Odyssey2 to go to Program step

02 and repeat program

13 32 1 Must enter Hex Mode (see page 27)

14 33 1

15 3A 1

16 34 1

17 35 1 Hex codes for various symbols. These

18 37 1 symbols with their Hex Code equivalents

19 3D 1 are shown at the front of the book.

20 3E 1

21 36 1

22 3C 1

The Roll Mode - Your Program Trouble Shooter

The Roll Mode is for checking a program step to be sure it contains the

correct data. It is also for making a change in a program step without having

to erase and re-enter an entire program.

To enter the Roll Mode, press R if you are in either the Assember or HEX

input modes. If you are in the EXECUTION mode, press RESET, the P, the M

(HEX) or A (ASSEMBLER) - and then press R.

Then, press U to display the program steps upward (00-99) - or press D to

display the program steps downward (99-00). The Roll Mode will always display

its information in HEX - even if you have been entering in Assembler.

If everything checks out, roll to the last program step entered and press

CLEAR to re-enter the Assembler or HEX input mode.

If you wish to make a change, press CLEAR at the program step you wish to

change. The data will be cleared.

Enter M for HEX or A for Assembler, depending on the code you have been

using.

Press I - the program step number you wish to change will appear on the

screen.

Enter the new data.

Press RESET You will be back in the COMMAND Mode and are ready to go on

with the program.

The following series of programs will be presented with a running

commentary that will tell you exactly where the data is going and what is

happening to it. These programs are written in HEX code. At the end of each

program, you'll find a summary written in HEX as well as Assembler, so you can

enter each program in either language.

Addition - Program A

This program will add two one digit numbers and display the total. Press the

POWER BUTTON off and on to clear the computer.

Press RESET "Command" appears on your screen. Your computer is ready to

accept instruction.

Press P "Program" appears on the screen.

Press M "Hex Input" appears on the screen. You have told the computer you

will be using the Hexidecimal Operational Code (Op Code).

Press I Step 00 appears on the screen. The computer is ready to accept data.

00

Press 70 Press ENTER You have told the computer you are going to input the

first number into Register 0.

01

Press 04 Press ENTER You instruct the computer to feed the second number of

the addition problems in to the Accumulator. Remember, the Accumulator

provides temporary storage for the ALU where the numbers are going to be

crunched.

02

Press E0 Press ENTER This instructs the computer to add the contents of

Register 0 to the contents of the Accumulator and to store the sum in the

Accumulator.

03

Press B1 Press ENTER This Op Code is an unpacking instruction. It tells the

computer to unpack the sum which has been stored in the Accumulator into

Register 1 and Register 2.

04

Press 6B Press ENTER This starts a positioning instruction.

05

Press 00 Press ENTER This Op Code tells the computer to display subsequent

information at the 00 position on your TV screen.

06

Press C1 Press ENTER You tell the computer you will want to output the

information in Register 1 (first digit sum).

07

Press C2 Press ENTER You also want to output the data in Register 2 (Second

digit sum).

08

Press 12 Press ENTER This tells the computer you want it always to return to

a certain step and repeat the program from that point.

09

Press 00 Press ENTER 00 is the step you want the computer to return to and

repeat. Now, the computer will perform a continuous series of addition

problems.

The program is now completed.

Press RESET The program is now stored in the computer's memory and you are

back in the COMMAND Mode.

Press E The computer executes your program. A question mark appears on the

screen. The computer is asking for two 1 digit numbers to add.

Enter the First Number. Press any digit from 0 through 9. You will hear a

beep confirming entry. The number will not appear on the screen. That

instruction was not included in this program.

Enter the Second Number. Press any digit 0 through 9 and the sum total of the

two entered numbers will immediately appear on the screen.

To enter a new problem, press any single digit number. Then, press the other

single digit number.

The previous sum will be replaced by the answer of the new addition problem as

soon as you have entered the second number of the new problem.

Now, here is the addition problem you have just entered expressed in both HEX

and ASSEMBLER codes. Note the following points.

Important: Remember to get into the proper input mode for the language you are

using.

Press PMI for HEX.

Press PAI for Assembler.

Very Important: Look at Program step 04. It is a two Byte instruction.

Remember, in Binary each byte is composed of eight bits.

6B (HEX = 0110 1011 (BINARY). 00 (HEX) = 0000 0000 (BINARY). Therefore,

6B 00 is a two byte instruction. If you are in the HEX mode, each Byte must

be entered separately.

Press 6B

Press ENTER

Press 00

Press ENTER

If you are in the Assembler mode, both Bytes are fed into the computer with

one entry.

Press L

Press D

Press V

Press .

Press B

Press .

Press 0

Press 0

Press ENTER

In either language, you will see Program step 06 on the screen after the data

is entered. Now, push the Power Button to erase any previous data...choose

one of the input codes...and enter the program. Be sure to press ENTER after

each step.

Addition - Program A

Hex Assembler

Step Code Code Byte Remarks

------------------------------------------------------------------

00 70 INP.0 1 Input Reg. 0 with 1st number

01 04 INA 1 Input Accum. with 2nd number

02 E0 ADD.0 1 Add Reg. 0 to Accum.

03 B1 UNP.1 1 Unpack Accum. into REg. 1 and Reg. 2

04 6B 00 LDV.B.00 2 Set output position to 00

06 C1 OUT.1 1 Output Reg. 1, 1st digit sum

07 C2 OUT.2 1 Output Reg. 2, 2nd digit sum

08 12 00 GTO.00 2 Go to step 00 and repeat

Addition - Program B

This program will also add two one digit number. However, this time when you

enter the second number, the entire problem will appear on the screen.

(Example: 2+4=6). You will be entering + and = signes in this program.

First, press the POWER BUTTON off and on to clear the computer. Then -

Press RESET "Command" will appear on your screen, and your computer is all

ears.

Press P "Program" appears on your screen.

Press M "Hex Input" appears on your screen. The computer knows you will be

using Op COde (Hexidecimal Operation Code).

Press I Step 00 appears on the screen. You are ready to input data.

00

Press 70 Press ENTER You tell the computer the first number will be entered

into Register 0. 01 appears on your screen.

01

Press 04 Press ENTER You tell the computer to accept the second number into

the Accumulator. 02 appears on the screen.

02

Press 6B Press ENTER This starts an output position entry.

03

Press 00 Press ENTER The output position is set at 00 at the far left of the

screen.

04

Press C0 Press ENTER The output channel from Register 0 will open for the

first number of the addition problem.

05

Press 63 Press ENTER The input channel to Register 3 will open.

06

Press 10 Press ENTER 10 will be loaded into Register 3. 10 is Op Code for

the (+) sign.

07

Press C3 Press ENTER The output channel from Register 3 will open so the (+)

sign can be displayed on the screen.

08

Press 0B Press ENTER The output channel of the Accumulator will open so that

the second number can be displayed on the screen.

09

Press 63 Press ENTER The input channel to Register 3 will open.

10

Press 2B Press ENTER 2B will be loaded into Register 3. 2B is Op Code for

the (=) sign.

11

Press C3 Press ENTER The output channel from Register 3 is opened so the (=)

sign may be displayed on the screen.

12

Press E0 Press ENTER This instruction adds the contents of Register 0 to the

contents of the Accumulator and stores the result in the Accumulator.

Remember, Register 0 contained the first number of the addition problem. The

Accumulator held the second number.

13

Press B1 Press ENTER This program step unpacks the contents of the

Accumulator storing the first digit of the sum in Register 1 and the second

digit of the sum in Register 2.

14

Press C1 Press ENTER The output channel from Register 1 will open to let the

first digit sum be displayed on the screen.

15

Press C2 Press ENTER The output channel from Register 2 will open to let the

second digit sum be displayed on the screen.

16

Press 12 Press ENTER This begins an instruction to return to a previous

step.

17

Press 00 Press ENTER The computer is instructed to return to step 00 and be

ready to solve a new addition problem. The old problemm will not erase from

the screen until both digits of the new problem are entered.

Press RESET The program is now stored in the computer.

Press E The computer is ready to execute the program. A question mark

appears on the screen asking for input.

Press any single digit number. Nothing appears on the screen.

Press a second single digit number. The entire problem and the solution

appear on the screen. Both will remain there until two new digits are

entered.

Addition - Program B

Hex Assembler

Step Code Code Byte Remarks

------------------------------------------------------------------

00 70 INP.0 1 Input Reg. 0 with 1st number

01 04 INA 1 Input Accum. with 2nd number

02 6B 00 LDV.B.00 2 Set output position

04 C0 OUT.0 1 Output 1st number from Reg. 0

05 63 10 LDV.3.10 2 Load Reg. 3 with (+) sign

07 C3 OUT.3 1 Out Reg. 3, (/) + on screen

08 0B OTA 1 Output 2nd number

09 63 2B LDV.3.2B 2 Load Reg. 3 with (=) sign

11 C3 OUT.3 1 Output Reg. 3, (/) = on screen

12 E0 ADD.0 1 Add Reg. 0 to Accum.

13 B1 UNP.1 1 Unpack Accum. into Reg. 1 and Reg. 2

14 C1 OUT.1 1 Output Reg. 1, 1st digit sum

15 C2 OUT.2 1 Output Reg. 2, 2nd digit sum

16 12 00 GTO.00 2 Go to step 00 and repeat

Addition - Program C

After you enter this program a question mark on the screen asks you to press

in two one digit numbers for the computer to add. The first number appears on

the screen followed by (+) sign. When you press the second number, it appears

on the screen followed by a (=) sign and the answer. When the first digit of

the next addition problem is entered, the first problem will disappear from

the screen. To begin, turn off the power to erase the previous program.

Press RESET You[sic] computer is in the "Command" Mode and ready to accept

instructions.

Press P The computer enters the "Program" Mode.

Press M "Hex Input" appears on the screen. The computer is ready to accept

instructions in Op Code.

Press I Step 00 appears on the screen and the computer is ready for the

program.

00

Press 6B Press ENTER You are setting the output position of Register B.

01

Press 00 Press ENTER That output position is 00 at the far left of the

screen.

02

Press 70 Press ENTER You tell the computer that the first number of the

addition problem will be stored in Register 0.

03

Press C0 Press ENTER This tells the computer you will want it to output the

contents of Register 0.

04

Press 63 Press ENTER You are preparing Register 3 to accept data.

05

Press 10 Press ENTER Register 3 will be loaded with a 10 - the code for a

(+) sign. You will find the complete code for all of the graphics stored in

your computer on the fold-out at the back of the book.

06

Press C3 Press ENTER This will open the way to output the (+) sign from

Register 3.

07

Press 04 Press ENTER This will open the Accumulator for future input.

08

Press 0B Press ENTER The output channel of the Accumulator is set to open.

09

Press 63 Press ENTER You want to laod a value into Register 3.

10

Press 2B Press ENTER That value is 2B - the code for the (=) sign.

11

Press C3 Press ENTER This will open the way to output the (=) sign from

Register 3.

12

Press E0 Press ENTER The computer will then add the contents of Register 0

to the Accumulator. Register 0 has already been instructed to accept the

first number in the addition problem (Step 02) - and the Accumulator has been

instructetd to accept the second number.

13

Press B1 Press ENTER This Op Code will unpack the contents of the

Accumulator (which contains the sum) into Register 1 and Register 2.

14

Press C1 Press ENTER This will open the output channel of Register 1.

15

Press C2 Press ENTER This will open the output channel of Register 2.

16

Press 70 Press ENTER This input is a pause operation. It tells the computer

to leave the first problem on the screen until another problem is entered.

17

Press 6C Press ENTER Register C will be opened for loading.

18

Press 0B Press ENTER Register C will be loaded with 0B - the Op Code for the

decimal number 11, which is exactly the number of positions available on the

screen.

19

Press 67 Press ENTER Register 7 will be ready for loading.

20

Press 0C Press ENTER 0C is Op Code for blank spaces as indicated in the

computer graphics section in the fold-out at the back of the book. Register 7

will be loaded with blank spaces. The computer will use these blank spaces to

erase the old problem on the screen when the first digit of the new problem is

entered.

21

Press 9C Press ENTER The Accumulator will be loaded with the contents of

Register C - the decimal number 11.

22

Press 64 Press ENTER This will open Register 4 to accept data.

23

Press 00 Press ENTER Register 4 will be loaded with 00.

24

Press 02 Press ENTER The amount in the Accumulator (11 - the number of

positions on the screen) will be decremented (subtracted) by one each time

this step is reached.

25

Press C7 Press ENTER Register 1 will output its blank spaces.

26

Press 24 Press ENTER This is a branch instruction - sort of a fork in the

electronic road. The computer is instructed to continue on to the next

program step if the number in the Accumulator equals the number in Register 4

(00).

27

Press 24 Press ENTER The computer is instructted to return to step 24 if

the number in Register 4 is not equal to the Accumulator. Step 24 will

decrement the contents of the Accumulator (which originally was 11) by 1 each

time until the Accumulator is reset at 00 to match Register 4. Program steps

16 through 27 demonstrate how a computer erases by outputting blank spaces to

the screen.

28

Press 6B Press ENTER We are resetting Register B to return to its original

output position once the Accumulator is equal to Register 4.

29

Press 00 Press ENTER The output position of Register B is set at the extreme

left position of the screen.

30

Press 12 Press ENTER This Op Code instructs the computer to branch to

another program step when the amount in the Accumulator equals 00.

31

Press 03 Press ENTER The step the cocmputer returns to is 03. Now, you are

able to enter and solve repeated addition problems.

Press RESET The program is stored.

Press E The program is executed. See the beginning of the program for use

instructions.

Addition - Program C

Hex Assembler

Step Code Code Byte Remarks

----------------------------------------------------------------

00 6B 00 LDV.B.00 2 Set output position to 00

02 70 INP.0 1 Input 1st number to Reg. 0

03 C0 OUT.0 1 Output Reg. 0

04 63 10 LDV.3.10 2 Load Reg. with (+) sign

06 C3 OUT.3 1 Output (+) sign from Reg. 3

07 04 INA 1 Input to Accum. (second number)

08 0B OTA 1 Output from Accum.

09 63 2B LDV.3.2B 2 Load Reg. 3 with (=) sign

11 C3 OUT.3 1 Output (=) sign from Reg. 3

12 E0 ADD.0 1 Add Reg. 0 to Accum.

13 B1 UNP.1 1 Unpack Accum. to Reg. 1 and Reg. 2

14 C1 OUT.1 1 Output Reg. 1

15 C2 OUT.2 1 Output Reg. 2

16 70 INP.0 1 This is used as a pause operation

17 6C 0B LDV.C.0B 2 Load Reg. C with Hex 0B (#11)

19 6C 0C LDV.7.0C 2 Load Reg. 7 with blank spaces

21 9C LDA.C 1 Load Accum. from Reg. C

22 64 00 LDV.4.00 2 Load Reg. 4 with 00

24 02 DEC 1 Subtract 1 from Accum.

25 C7 OUT.7 1 Output Reg. 7 (blank spaces)

26 24 24 BNE.4.24 2 Branch if Accum. does not = Reg. 4

28 6B 00 LDV.B.00 2 Set output position to 00

30 12 03 GTO.03 2 Go to step 03 and repeat

One Digit Multiplication

After you enter this program, a question mark will appear on the screen asking

for input. The first digit entered is the number you wish to multiply (the

nultiplicand). It appears on the screen with an (X) sign. The second digit

entered is the multiplier. The complete problem will now appear on the screen

along with the answer. Odyssey2 solves multiplication through an addition

process. If the problem is 3 X 7, the computer will arrive at the answer by

adding 7+7+7. Program steps 00 through 11 are instructions which allow the

problem to be displayed on the screen. The mathematical operational sequence

begins with step 12.

First, press the POWER BUTTON off and on to erase the previous program.

Press RESET You are in the "Command" Mode.

Press P You enter the "Program" Mode.

Press M "Hex Input" appears on the screen. The computer is ready for Op Code

instructions.

Press I Step 00 appears on the screen and the computer is ready for the

program.

00

Press 6B Press ENTER The output position of Register B is ready for setting.

01

Press 00 Press ENTER You set the output of Register B for the far left of

the screen.

02

Press 70 Press ENTER The multiplicand is directed to be stored in Register

0.

03

Press C0 Press ENTER Register 0 is given an output channel.

04

Press 66 Press ENTER The door will be opened to Register 6.

05

Press 29 Press ENTER An (X) sign will be entered into Register 6.

06

Press C6 Press ENTER Register 6 is given an output channel.

07

Press 71 Press ENTER The multiplier will be stored into Register 1.

08

Press C1 Press ENTER The multiplier is given a way out of Register 1.

09

Press 67 Press ENTER The door to Register 7 is instructed to open.

10

Press 2B Press ENTER 2B is Op Code for (=). The (=) sign will be loaded

into Register 7.

11

Press C7 Press ENTER This will provide an output channel for Register 7.

12

Press 90 Press ENTER The Accumulator is instructed to be ready to accept data

from Register 0. This is the Register that holds the number you want to

multiply. The Accumulator will be loaded with the same value as the contents

of Register 0 - however, Register 0 will continue to retain its data.

13

Press E0 Press ENTER The computer is instructed to add the contents of the

Accumulator to Register 0. Remember, that Odyssey2 multiplies by a series of

addition steps. This is the first addition step.

14

Press A2 Press ENTER The sum of the digits from the Accumulator and Register

0 will be stored in Register 2.

15

Press 91 Press ENTER The Accumulator will be loaded from Register 1 which

holds the multiplier. The Accumulator will now know the number of addition

steps it must perform to arrive at an answer.

16

Press 02 Press ENTER This step will decrement the Accumulator which contains

the multiplier by 1 so that the computer can keep track of how many addition

steps have been made.

17

Press A1 Press ENTER The difference will be stored in Register 1.

18

Press 63 Press ENTER The door to Register 3 will open.

19

Press 01 Press ENTER 01 will be stored in Register 3. This will give the

computer a reference point which will halt the addition process. When the

Accumulator contains the contents of Register 1 (the multiplier), it is

compared to the contents of Register 3 (which is 01). If the contents in

Register 1, which is now in the Accumulator, and Register 3 coincide, the

computer will stop adding. If they are not equal, the computer will loop back

and continue the addition process.

20

Press 33 Press ENTER This starts a branch operation.

21

Press 25 Press ENTER The computer is instructed to branch to step 25 if the

contents of the Accumulator and Register 3 are equal. In which case, the

answer will be unpacked and displayed on the screen.

22

Press 92 Press ENTER The Accumulator will be loaded with the information in

Register 2, which contains the data fed in Program Step 14.

23

Press 12 Press ENTER The computer is instructed to return to a previous step

in the program if the conditions in program step 19 have not been met.

24

Press 13 Press ENTER The computer is instructed to return to step 13 and

once aggain add the contents of Register 0 to the Accumulator. (Register 0

holds the multiplicand.)

25

Press 92 Press ENTER The Accumulator will be loaded with the contents of

Register 2 which contains the sum of the addition operations. We are almost

at the end of the tunnel. This operation is performed when the contents of

the Accumulator and Register 3 are equal.

26

Press B4 Press ENTER This is a two digit unpacking operation, which has been

explained in Addition Program A.

27

Press C4 Press ENTER An output channel for Register 4.

28

Press C5 Press ENTER An output channel for Register 5.

29

Press 12 Press ENTER You instruct the computer to return to a previous

program step.

30

Press 00 Press ENTER That step is 00. The computer will now be ready to

accept a new multiplication problem.

Press RESET The program is stored.

Press E The program is executed.

One Digit Multiplication

Hex Assembler

Step Code Code Byte Remarks

--------------------------------------------------------------

00 6B 00 LDV.B.00 2 Set output position

02 70 INP.0 1 Multiplicand stored in Reg. 0

03 C0 OUT.0 1 Output multiplicand

04 66 29 LDV.6.29 2 Symbol (X) stored in Reg. 6

06 C6 OUT.6 1 Output Reg. 6; Reg.6=(X)

07 71 INP.1 1 Multiplier stored in Reg. 1

08 C1 OUT.1 1 Output Multiplier

09 67 2B LDV.7.2B 2 Symbol (=) stored in Reg. 7

11 C7 OUT.7 1 Output Reg. 7

12 90 LDA.0 1 Load Accum. from Reg. 0

13 E0 ADD.0 1 Add Accum. to Reg. 0

14 A2 STO.2 1 Store sum in Reg. 2

15 91 LDA.1 1 Load Accum. from Reg. 1

16 02 DEC 1 Decrement Accum. by 1

17 A1 STO.1 1 Store difference in Reg. 1

18 63 01 LDV.3.01 2 Load Reg. 3 with 01

20 33 25 BEQ.3.25 2 Go to step 25 if Accum. = Reg. 3

22 92 LDA.2 1 Load Accum. from Reg. 2

23 12 13 GTO.13 2 Go to step 13

25 92 LDA.2 1 Load Accum. from Reg. 2

26 B4 UNP.4 1 Unpack two digits

27 C4 OUT.4 1 Output Reg. 4

28 C5 OUT.5 1 Output Reg. 5

29 12 00 GTO.00 2 Go to step 00 and repeat

One Digit Division

A question mark will appear on the screen. The first number entered will be

the dividend and it will be followed by a (./.) sign. The second number

entered will be the divisor. It will appear on the screen along with an (=)

sign and the answer. Your Odyssey2 computer accomplishes division by a series

of subtractions. It's the Odyssey2 multiplication process in reverse.

Note: There are two conditions in division that must be provided. The first

condition is when the divisor can be divided into the dividend equally.

Example: 6/2 = 3. The second condition is when the divisor cannot be divided

into the dividend equally and there is a remainder. Example: 9/2=4+R. Your

Odyssey2 has been instructed to display (+R) if there is a remainder. This

program provides branching instructions to satisfy both conditions.

To begin, turn the POWER BUTTON off and on to erase any previous program.

Press RESET You are in the "Command" mode.

Press P You have entered the "Program" mode.

Press M "Hex Input" appears on the screen. The computer is ready to accept

instructions in Op Code.

Press I Step 00 appears on the screen, and you are ready to enter the

program.

00

Press 63 Press ENTER The door to Register 3 will be opened.

01

Press 00 Press ENTER We call this "initialization" - a step to insure that

Register 3 is set at absolute zero value after each problem is solved.

Register 3 will contain the sum of the subtraction operations Odyssey2 will

perform to find the quotient.

02

Press 6B Press ENTER The door to Register B will be opened.

03

Press 00 Press ENTER Register B will be positioned to output at the far left

of the screen.

04

Press 70 Press ENTER The number to be divided (the dividend) will go into

Register 0 the dividend must always be larger than the divisor.

05

Press C0 Press ENTER The output channel to Register 0 is set to open.

06

Press 69 Press ENTER Register 9 will be opened for input.

07

Press 2A Press ENTER 2A is Op Code for (./.). The division sign will go

into Register 9.

08

Press C9 Press ENTER The output channel of Register 9 is set to open.

09

Press 71 Press ENTER The divisor will be loaded into Register 1.

10

Press C1 Press ENTER The output channel of Register 1 is instructed to open.

11

Press 6A Press ENTER The door to Register A will be opened.

12

Press 2B Press ENTER 2B is Op Code for (=). The equal sign will go into

Register A.

13

Press CA Press ENTER The Register A output channel is instructed to open.

14

Press 91 Press ENTER The Accumulator will be loaded with the contents of

Register 1 which contains the divisor. We are going to use a sample problem

so the explanation will be easier (6/2=3). The Accumulator will be loaded

with the divisor (2).

15

Press D0 Press ENTER The contents of the Accumulator will be subtracted from

the contents of Register 0 which contains the dividend (6).

16

Press A0 Press ENTER The difference (4) between the dividend and the divisor

(6-2=4) will be stored in Register 0.

17

Press 93 Press ENTER The Accumulator will be loaded with the contents of

Register 3. This is the Register that was "initialized" at 00 so that we

could keep track of the number of times we subtracted.

18

Press 03 Press ENTER A 1 will then be added to the Accumulator. This is

called an increment.

19

Press A3 Press ENTER The sum of the Accumulator is then stored in Register

3. This Register now contains 01.

20

Press 90 Press ENTER The Accumulator will be loaded with the contents of

Register 0. Register 0 has been loaded with a value of 4, the difference

between the dividend and the divisor. The value was loaded into Register 0 in

Program step 16.

21

Press 13 Press ENTER This will be the start of a branch operation.

22

Press 40 Press ENTER The computer wil branch to step 40 if the Accumulator

equals 0. Once the Accumulator equals 0, the problem is finished and Program

step 40 will unpack the answer and it will be displayed on the screen.

23

Press 91 Press ENTER If the Accumulator does not equal 0, it will go to this

program step. The Accumulator will be loaded with the contents of Register 1

which contains the divisor (2).

24

Press 50 Press ENTER Another branch operation will be started.

25

Press 28 Press ENTER The computer will be instructed to branch to program

step 28 if Register 0 which contains the dividend (4) is less than the

Accumulator which contains the divisor (2) from Register 1.

26

Press 12 Press ENTER This tells the computer to return to a previous step if

Register 0 is not less than the Accumulator.

27

Press 15 Press ENTER This completes the return instructions. The computer

is programmed to return to step 15. This step begins the subtraction

operations which will continue until Register 0 is loaded into the Accumulator

at step 21 and, the Accumulator equals 0 in this example. When this condition

is met, Odyssey2 will loop to Program step 40.

28

Press 93 Press ENTER This is the step your computer will branch to if a

remainder is included. The branching instructions were given in steps 24 and

25. They programmed the computer to branch to step 28 if Register 0 which

contains the dividend is less than the Accumulator which at this point,

contains the divisor. We will use 9/2=4+R as our sample problem. All

programsteps have been the same up to this point. The computer has looped to

step 15 several times. Register 0 now contains 01 and the Accumulator

contains 02. This step will load the Accumulator from Register 3 which

contains the number of times (2) has been subtracted from (9) which is (4).

29

Press B4 Press ENTER This instruction will unpack the answer.

30

Press C4 Press ENTER The first digit, stored in Register 4, will be

displayed on the screen.

31

Press C5 Press ENTER The second digit, stored in Register 5, will be

displayed on the screen.

32

Press 66 Press ENTER Register 6 will open.

33

Press 10 Press ENTER 10 will be loaded into Register 6. 10 is the Op Code

for (./.).

34

Press 67 Press ENTER Register 7 will be opened.

35

Press 13 Press ENTER 13 will be loaded into Register 7. 13 is the Op Code

for (R).

36

Press C6 Press ENTER The output channel for the (./.) sign will be opened.

37

Press C7 Press ENTER The output channel for (R) will open.

38

Press 12 Press ENTER The computer is instructed to return to a previous

step.

39

Press 00 Press ENTER The computer will return to step 00 and be ready to

solve a new problem. Our program ends at this point if we have solved a

problem that contains a remainder. If not, as in our first example (6/2=3),

we would have jumped from Program step 21 to Program step 40.

40

Press 93 Press ENTER The Accumulator will be loaded with the contents of

Register 3. It will contain the number of times the divisor has been

subtracted from the dividend. In step 21 the computer was programmed to

branch to this step when the contents of the Accumulator equaled 0. We were

using 6/2 as our example so at this point Register 3 contains (3) ---the

number of times (2) has been subtracted from (6).

41

Press B4 Press ENTER This unpacking operation will convert the answer from

binary into decimal.

42

Press C4 Press ENTER The output channel of Register 4 will be opened for the

first digit.

43

Press C5 Press ENTER The output channel of Register 5 will be opened for the

second digit.

44

Press 66 Press ENTER Register 6 will open.

45

Press 0C Press ENTER Register 6 will be loaded with 0C which is Op Code for

a blank space.

46

Press 67 Press ENTER Register 7 will open.

47

Press 0C Press ENTER Register 7 will be loaded with a blank space.

Registers 6 and 7 have been loaded with blanks so that (+R) will not be

displayed on the screen when this branch of the program is employed by the

computer.

48

Press C6 Press ENTER The output channel from Register 6 will open.

49

Press C7 Press ENTER The output channel from Register 7 will open.

50

Press 12 Press ENTER The computer is instructed to return to a previous

step.

51

Press 00 Press ENTER The computer is instructed to return to step 00 and be

ready to solve another problem.

Press RESET The program is stored.

Press E The program is executed.

One Digit Division

Hex Assembler

Step Code Code Byte Remarks

-----------------------------------------------------------------------------

00 63 00 LDV.3.00 2 Reg. 3 = 00 (initialization)

02 6B 00 LDV.B.00 2 Reg. B = 00 (positioning)

04 70 INP.0 1 Dividend stored in Reg. 0

05 C0 OUT.0 1 Output Reg. 0

06 69 2A LDV.9.2A 2 Symbol (./.) stored in Reg. 9

08 C9 OUT.9 1 Output Reg. 9

09 71 INP.1 1 Divisor stored in Reg. 1

10 C1 OUT.1 1 Output Reg. 1

11 6A 2B LDV.A.2B 2 Symbol (=) stored in Reg. A

13 CA OUT.A 1 Output Reg. A

14 91 LDA.1 1 Load Accum. from Reg. 1

15 D0 SUB.0 1 Sub Accum. from Reg. 0

16 A0 STO.0 1 Store difference in Reg. 0

17 93 LDA.3 1 Load Accum. from Reg. 3

18 03 INC 1 Add 1 to the Accum.

19 A3 STO.3 1 Store sum in Reg. 3

20 90 LDA.0 1 Load Accum. from Reg. 0

21 13 40 BRZ.40 2 Branch to step 40 if Accum. equals 0

23 91 LDA.1 1 Load Accum. from Reg. 1

24 50 28 BLS.0.28 2 Branch to step 28 if Reg. 0 is less than Accum.

26 12 15 GTO.15 2 Go to step 15

28 93 LDA.3 1 Load Accum. from Reg. 3

29 B4 UNP.4 1 Unpack two digits

30 C4 OUT.4 1 Output 1st digit which is stored in Reg. 4

31 C5 OUT.5 1 Output 2nd digit which is stored in Reg. 5

32 66 10 LDV.6.10 2 Symbol (+) stored in Reg. 6

34 67 13 LDV.7.13 2 Symbol (R) stored in Reg. 7

36 C6 OUT.6 1 Output (+) sign

37 C7 OUT.7 1 Output (R)

38 12 00 GTO.00 2 Go to step 00

40 93 LDA.3 1 Load Accum. from Reg. 3

41 B4 UNP.4 1 Unpack two digits

42 C4 OUT.4 1 Output 1st digit from Reg. 4

43 C5 OUT.5 1 Output 2nd digit from Reg. 5

44 66 0C LDV.6.0C 2 A blank is stored in Reg. 6

46 67 0C LDV.7.0C 2 A blank is stored in Reg. 7

48 C6 OUT.6 1 Output blank

49 C7 OUT.7 1 Output blank

50 12 00 GTO.00 2 Branch to step 00

Area Problems Using "Go to Subroutine" and "Return"

This program gives you an example of how and when to use the instructions "Go

to Subroutine" and "Return".

A "Go to Subroutine" instruction tells the computer to branch to a specific

program step which contains an operation you may wish to use several times in

one program. You can use the same operation several times without having to

rewrite it. When writing a prgram using this instruction, the next program

step after the "Go to Subroutine" instruction must be reserved for returning

from the Subroutine.

A program having a "Go to Subroutine" instruction must have a "Return from

Subroutine" instruction as well.

After you enter this program, you will be able to find the area of a rectangle

or the area of a triange. First, enter the base measurement - then, enter the

height measurement. Press 1 to find the area of a rectangle. (Base * Height

= Area). Press 2 to find the area of a triangle. (Base * Height / 2 = Area).

Before entering this program, refer to the program on pages 69 and 70 while we

explain how it works.

Program steps 00 through 08 will be the same for both problems.

(00 through 08) Step 08 programs your selection of 1) rectangle area problem,

or 2) triangle area problem to be loaded into the Accumulator. First, we'll

see what happens when 1 is loaded into the Accumulator.

(09 and 10) Steps 09 and 10 instruct the computer to branch to Program step 13

if the Accumulator (which contains 01) equals the contents of Register 1

(which is 01). If we had entered a 2, the computer would have proceeded from

Program step 08 to Program steps 11 and 12.

(13 and 14) Program steps 13 and 14 instruct the computer to go to step 66

which starts the multiplication subroutine. (Base * Height = Area of

Rectangle)

(66) Program step 66 loads the Accumulator with the contents of Register 3

which contains the base (Step 06). We'll use 8 as our example of the base

measurement.

(67) Program step 67 adds the contents of Register 3 (which contains the base

measurement of 8 in our example) to the contents of the Accumulator which now

also contains 8.

(68) The contents of the Accumulator (8+8=16) are stored in Register 5.

(69) The Accumulator is loaded with the contents of Register 4 which contains

the height. We'll use 3 as our example. This data was entered into Register

4 in Program step 07.

(70) In Program step 70, the Accumulator is decremented by 1. (Remember, in

multiplying, the multiplier is decremented by 1 with each addition operation

until the multiplier equals 01).

(71) The contents of the Accumulator (now 2) are loaded into Register 4.

(72 through 73) These instructions tell the computer to branch to Program

step 77 if the contents of the Accumulator are equal to the contents of

Register 1. (Register 1 = 01). This was accomplished in Program step 02.

(74) If the Accumulator does not equal 01 at Program step 72, the Accumulator

will move to Program step 75 and be loaded from Register 6 which contains 16.

(75 and 76) Go to step 67. The addition process is repeated until the amount

in the Accumulator is equal to the value of Register 1. When this condition

is achieved, the computer will branch to Program step 77 as instructed by

Program steps 72 and 73.

(77) The Accumulator is loaded from Register 5. (Register 5 now equals 24

which is the answer.)

(78) Program step 78 instructs the computer to return from subroutine.

This returns the computer to program step 15 which unpacks the contents of

Register 5.

Program steps 16 and 17 output the answer to the screen.

Program step 18 tells the computer to go to the blanking operation at program

step 58.

Program steps 58 through 63 output blank spaces that erase the old problem and

make room for a new one.

Program step 64 tells the computer to return to step 00 and to get ready to

solve a new problem.

Now we'll see how this program computes the area of a triangle (Base * Height

/ 2 = Area of Triangle) For our example, we'll use 6 as the base and 2 as the

height.

This time we will choose 2 (triangle routine) at Program step 08 to load into

the Accumulator. Since Program steps 09 and 10 do not apply, the computer

will jump to Program step 11.

Program step 11 instructs the Odyssey2 to branch to program step 20 for the

triangle routine.

Program 20 instructs the Odyssey2 to branch to step 66 for the multiply

routine.

Program steps 66 through 75 perf