Write a program which adds consecutively each number of the following sequence o
ID: 2250193 • Letter: W
Question
Write a program which adds consecutively each number of the following sequence of hexadecimal numbers: 21, B5, 37, 08, 5C, 84, A1, 1D, 72, FF, F6, 43, 03, A9, D4, 19, 31, D9, 47, 82, 14, 52, 07, CA, 04. When your current sum becomes equal to zero, your program should store into the memory the last number added, display this number, and eventually stop.see the following instruction sets
Symbol 0 E1 Description RI AND ADD STA BUN BSA o0 Isz Oxxx 8xxx AND memory word to AC 1xxx 9xxx Add memory word to AC 2xxx Axxx Load memory word to AC 3xxx Bxx Store content of AC in memory 4xxx Cxxx Branch unconditionally 5xxx Dxxx Branch and save return address 6xxx Exxx Increment and skip if zero RRI CLA CLE CMA CME CIR CIL INC SPA SNA SZA SZE HLT 7800 7400 7200 7100 7080 7040 7020 7010 7008 7004 7002 7001 Clear AC Clear E Complement AC Complement E Circulate right AC and E Circulate left AC and E Increment AC Skip next instruction if AC positive Skip next instruction if AC negative Skip next instruction if AC zero Skip next instruction if E is O Halt computer IOI INP UT SKI SKO ION IOP F800 Input character to AC F400 Output character from AC F200 Skip on input flag F100 Skip on output flag F080 Interrupt on F040 Interrupt off 10Explanation / Answer
All the 25 numbers are loaded into memory location starting from 2000H
Output will be stored in 2600H
Code:
100 CLA 'Clear AC '
101 LDA 2000H 'Load the value to Accumulator'
103 BSA 2001H
104 ADD 2001H 'Increment value of register C'
107 SZA 'Skip if AC zero'
108 BUN 103
10B MOV 'Store the value of Accumulator (SUM).'
10E STA 2600 'Move content of register C to Acc.'
10F OUT 'Store the value of Accumulator (CARRY)'
200 HLT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.