Here\'s how the problem works: Assemble the following PSoC code into machine lan
ID: 3550143 • Letter: H
Question
Here's how the problem works:
Assemble the following PSoC code into machine language. Express each assembled line as: location, bytes for instruction. Use hexadecimal for all of the numbers. For example, the instruction ADD A, [6], starting at location 0x0102 becomes: 0102: 02 06.
LOOP: ADD A, 3 // this instruction begins at location 0x0100
ADC A, [X + 4]
MOV X, A
MOV A, REG[0x22]
INC A
CMP A, 0x14
JZ LOOP // be careful to use the appropriate relative addressing to express the value LOOP
Explanation / Answer
0x100 : 02 03 #LOOP: ADD A, 3 // this instruction begins at location 0x0100
0x102 : 0B 04 #ADC A, [X + 4]
0x104 : 5C #MOV X, A
0x105 : 5D 22 #MOV A, REG[0x22]
0x107 : 74 #INC A
0x108 : 39 14 #CMP A, 0x14
0x10A : AF F5 #JZ LOOP // jump 11 locations back -11 = 0xff5
all the opcodes are in hex.