rUnCc Detween ite betweell data and addresses 22 List the he
rUnCc Detween ite betweell data and addresses.) 22. List the hexadecimal code for the following program (hand assemble it). Hex Address Label Instruction 100 101 102 103 LOAD A ADD ONE JUMP S1 ADD ONE S2
Solution
There are already defined hex codes for each operation which we are going to use below:
LOAD A: 3A, 23, 00 //loading A reg to mem location 0023 as mentioned by label A at 108H
//3A is the hex code for loading A reg to accumulator (00111010)
ADD ONE: 86, 01, 00 //86 is the hex code for loading a memory location content to accumulator (10000110)
JUMP S1: C3, 06, 01 //C3 is the hex code for jump and S1 label indicates 106H (11000011)
ADD ONE: 86, 01, 00
STORE A: 32, 23, 00 //32 is the hex code for storing contents of acc to mem location which is 0023H(00110010)
HALT: 76H
ADD A: 87H //instruction is 100000sss where sss indicates which reg to use i.e. 111 for A reg
JUMP S2: C3, 03, 01 //S2 indicates 103H
