Previous page
Next page

11.3.1  An overview of the Watson Assembly Language

The Watson assembly language consists of 18 instructions, which can be divided into six groups.  These instructions are summarized in Figure 11.2.  Here I will provide a brief overview of these instructions.  The remainder of this section is devoted to exploring these instructions in much more depth and examining at how they can be used in simple assembly language programs.

The first group of Watson assembly instructions are the variable declaration statements: .BLOCK and .WORD.  These are both used to reserve memory locations for data storage.  They differ in that .WORD can reserve only a single word of memory, while .BLOCK can reserve multiple words.   Another difference is that .WORD can initialize its storage location to a specified value.  The .BLOCK command is not capable of initializing the memory locations it reserves.

The next group of instructions, the input and output instructions, are used to copy values between main memory and the general-purpose registers.  There are three “load” commands that copy information into registers: LOAD, LOADIMM, and LOADIND.  Two “store” commands, STORE and STOREIND, copy information from the registers into main memory.  The various forms of the load and store commands and the differences between them are examined below.

The math operations ADD and SUBTRACT form the next group of Watson assembly language instructions.  These instructions behave pretty much the way you would expect.  ADD adds the contents of two registers together and places the sum into a specified register.  SUBTRACT subtracts the contents of one register from another placing the result into a specified register.

Figure 11.2:  The Watson Assembly Language

Discussion of the next two groups of Watson assembly language instructions, the logic and shift operators, is deferred to Section 11.5.  The reason for doing so is that it is difficult to say much about these statements without some understanding of data representation at the machine level, which is covered in Section 11.4.

The final group of Watson assembly language instructions is the program control statements.  These commands determine which program instruction, if any, will be executed next.  HALT is the most straightforward statement of this group.  It causes program execution to terminate.  For this reason, HALT is normally the last statement executed by a program.  JUMP is pretty easy to understand as well.  It breaks out of the normal sequence of program execution and causes control to “jump” immediately to a specified instruction.  COMPARE and BRANCH are usually used together to implement a “conditional branch”.  Essentially, COMPARE will compare the values held in two registers and set the machine’s status bits.  BRANCH then examines these bits to determine whether a particular condition is true (e.g., A == B).  If the condition is true control is transferred to a specified instruction.  If the condition is not true the statement has no effect.  Conditional branches are the low level equivalent of the “if” statement.

Don’t be overly concerned if the behavior and usefulness of each of the above instructions isn’t immediately obvious.  We’re just “looking at the roadmap” here.  The details of each statement are presented throughout the remainder of this chapter.


Return to top