ALGO TO ADD:
ALGO TO SUBTRACT:
OUTPUT: (ADD) 2000 01 2001 04 After execution of program: 2003 05 OUTPUT: (SUB) 2000 01 2001 04 After execution of program: 2003 03 Note the first number is stored at Reg B and the second one into Accumulator. Hence, when the SUB B command is executed, the first number is subtracted FROM the second number. The memory address states the location where we are entering the hexadecimal Opcode. After this, we supply the two inputs (to add) at 2000H and 2001H. (Say, 01 is entered at 2000H and maybe 04 is entered at 2001H). The location of the start of the program would be at 2500H) Execute the program at 2500H. And on execution, check the value at location 2002H. (Answer should be 05). Hexadecimal addition even allows the following: 0 B ( 0 11) 1 3 ( 1 03)
___
1 E
|