{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Dale - Computer Science Illuminated 239

Dale - Computer Science Illuminated 239 - R6–" h#0,d...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
212 Chapter 7 Low-Level Programming Languages Program 1 enhanced version Now let’s code the enhanced version of the program, where we read in an initial and write it out following ‘ 6788. ’. Rather than enhance the immediate-addressing-mode version, let’s use the direct-addressing-mode version previously shown. We need to insert a R6–"I instruction and a R6–" instruction before the ST P . This means that the characters to be printed must be moved two instructions further down in memory, changing the address of each by 6 bytes. Thus the operands of the R6–" statements must be increased by 6. The only tricky part is to remember that 14 plus 6 is 1A, not 20.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: R6–" h#0!,d ; utput ’6’ R6–" h#0_,d ; utput ’7’ R6–" h#0>,d ; utput ’8’ R6–" h#09,d ; utput ’8’ R6–" h#0–,d ; utput ’.’ R6–"I h#0C,d ;Input an initia8 R6–" h#11,i ; utput initia8 ST P *–SRII /6788./ ;St.r7 ’6788.’ int. pr.p7r p8ac7s *)ND Screen shots of the assembler listing and the machine-language program are shown below. Compare the machine code generated with the machine code for the enhanced version. The output is the same, but the programs are different. Be sure that you understand why they are different....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online