While an assembly language has no explicit data types, there are rules for how the data is accessed and stored. This section defines the rules for data access.
In this CPU, a word is 16 bits. All memory locations are 16 bits wide, and words, not bytes, are addressable. Thus the value at the address 0 is contained in bits 0...15, the value at address 1 is contained in the bits 16...31, etc.
Each address refers to a 2-byte quantity or word. If that memory location is in data memory the value is an integer number; if the address is in text memory it is a 2-byte instruction.
There are a total of 256 memory locations (addressable words) in both the data memory and the text (program) memory. The addresses for both of these memories start at 0 and run to 255, which corresponds to an 8-bit unsigned value. Though the memory addresses overlap, the context of the request will determine which memory to use. Only the $pc will be used to access text memory, and all other addresses will refer to data memory.
When referencing values in instructions (immediate values and addresses) an 8 bit value is used. This 8-bit value can either be given as a numeric value, or as a valid label to an address somewhere in the program. When used as an address, this 8-bit value will be is unsigned, and refers to a number between 0...255. For the instructions
stor, this is an addresses in the data segment. For branch instructions,
beqz, the 8-bit address refers to the text segment.
For immediate instructions,
subi, the value of the operand is an 8-bit integer value, and has a value from -128...127.