Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following Pep/9 program is legal one: hexo one,d two: deco two,i three: stro

ID: 3605176 • Letter: T

Question

The following Pep/9 program is legal one: hexo one,d two: deco two,i three: stro three,d stop .end To prove it, here is the listing file whe i is asembled. Object Addr code Symbol Mnemon Operand Comment 0000 410000 one: HEXO one, d 0003 380003 two: DECO two, i 0006 490006 three: STRO three, d 0009 00 STOP 000A .END When the program runs it outputs the following 410031 (a) why does hexo output 4100 and not some other integer? (b) why does deco output 3 and not some other integer? (c) why does stro output I and not some other string?

Explanation / Answer

Hexo, deco and stro are trap instruction which are slow compare to non-trap instruction. The appropriate action for these trapped instructions is:

HEXO-> outputs 4 hexadecimal digits

DECO->decimal output trap

STRO->outputs the characters in a null-terminated string

three: stro three, d

stop

.end

This program outputs I, because translation of this program is 49 00 00 00. When the program run string starting at location 0 that terminates with a null (zero) bytes, the 49 00 are first two bytes of the program in hex. The 49 (hex) is ASCII code for I.