!Program Design Description: !Given the following data, write a program that counts the number !of words before a zero value is reached. ! !0x0005 !0x0004 !0x0002 !0x0003 !0x0001 !0x0000 !0x0010 ! !Program Solution: ! org: 0x0000 !Start program here loopCheck: load RI=[zero] !Load array index with zero. load RB=[zero+RI] !Load register B with zero. load RI=[wordCount] !Load array index also wordCount. load RA=[data+RI] !Load data[wordCount]. add load RI=[zero] !Load register I with zero. load [temp+RI]=RC !Save data[wordCount] into temp. load RI=[temp] !Put data[wordCount] into register I. jz endLoop !Test data[wordCount] for zero. load RI=[zero] !Set register I to zero load RA=[wordCount+RI] !Load wordCount. inc !Increment wordCount by 1 load [wordCount+RI]=RC !Save wordCount jmp loopCheck !Next iteration endLoop: halt !Word tested as zero. Halt program. org: 0x0020 !Store variables here. zero: 0x0000 temp: 0x0000 wordCount: 0x0000 !Word count. Initialize to zero. org: 0x0028 !Store the given data here data: 0x0005 0x0004 0x0002 0x0003 0x0001 0x0000 0x0010