PROJECT

Write an assembly language program to read a sequence of integers , add 10 to each one, printing out the sum each time. Assume 16 bit instructions and 16 bit integers. Stop when the input is -1.

Machine Language
Assembly Language
Address
Opcode
Operand
Label
Opcode
Operand
     .BEGIN 
000001101000000010100 LOOP:INTEMP
000100000000000010110  LOADNEG1
001000111000000010100  COMPARETEMP
001101010000000010010  JUMPEQEXIT
010000000000000010100  LOADTEMP
010100011000000011000  ADDTEN
011000001000000010100  STORETEMP
011101110000000010100  OUTTEMP
100001000000000000000  JUMPLOOP
100101111000000000000 EXIT:HALT 
101000000000000000000 TEMP:.DATA0
101101111111111111111 NEG1:.DATA-1
110000000000000001010 TEN:.DATA10
     .END 

 

 

NOTE: The "pseudo-code" or "declarative" operation codes that start with a period (.) These are NOT translated into operations but are instructions to the assembler to treat the information in the line differently.

NOTE: The "labels" that precede the instructions. These are identifiers that the assembler can use to link names in operand fields to memory locations.


CAVEAT EMPTOR
In the simulators used in the exercises that follow, we have chosen to restrict the operand portion of each instruction to four (4) bits, so that each instruction is contained in two bytes (one word) and data and instructions can be stored in sequentially addressed words.

[Prev] [Next]


CS1104 Main Page
Last Updated 2002/03/18
©J.A.N. Lee, 2000-2002.