Section 9.3: An Example of a CSC-1 Assembler Program (Frame 10)                     [prev][home][     ]

Next, let's put 0 back into memory location 6, which is variable C:

>> m6=0

This is the way to store values into memory, by using the m command, followed by the address, then an equals sign, followed by the value. There should be no spaces anywhere. If you store a negative value, such as -1, the simulator converts it to the appropriate 2's complement bit pattern. Let's store -1 into location 10, which is unused for this program, and then inspect it:

>> m10=-1
>> m10
memory[  10]=    -1      (  65535)    1111111111111111

Notice that -1 is stored in 2's complement in 16 bits, so it comes out as all 1's. This is also the bit pattern that corresponds to 65535 if the value is considered unsigned.

Recall that all the memory words and all the registers are 16 bits long (except for the MAR, which is 12). In 16 bits, unsigned binary numbers that correspond to the decimal values 0 up to 65535 can be stored. Treating these bit patterns as 2's complement numbers instead, the values range from -32768 up to +32767. Since addresses are only 12 bit long, they can go from 0 up to 4095, and are never considered negative.