HW4 Exercise Quiz
Due Mar 14 at 11:59pm Points 40 Questions 20 Time Limit 180 Minutes Allowed Attempts 3
Attempt History
Attempt Time Score
KEPT Attempt 3 11 minutes 34 out of 40
LATEST Attempt 3 11 minutes 34 out of 40
Attempt 2 21 minutes 22 out of 40
Attempt 1 43 minutes 12 out of 40
Correct answers are hidden.
Score for this attempt: 34 out of 40 Submitted Mar 14 at 10:41pm
This attempt took 11 minutes.
Question 1
2 / 2 pts
Determine the first output, DECO ‘Q’,i, of the following Pep/8 assembly code. Submit only the first output with no extra spaces, commas, or comments.
DECO ‘Q’, i
CHARO ‘\n’,i
DECO 0xFFC3,i
CHARO ‘\n’,i
CHARO 0x007D,i
STOP
.END
81
The ASCII for Q is 51 (hex) which converts to 81 (decimal).
Incorrect
Question 2
0 / 2 pts
In the following code, write the object code suitable for Pep/8 in
hexadecimal.
Provide the hexadecimal bytes and the ending sentinel with a space in between each byte
this:
that:
theOther:
BR theOther
.word 17
.word 19
DECO this,d
DECO that, d
STOP
.END
0000 040007 BR theOther 0003 0011 this: .WORD 17 0005 0013 that:
———————————————————-
———————
Object
Addr code Symbol Mnemon Operand Comment
———————————————————-
———————
0000 040007 BR theOther
0003 0011 this: .WORD 17
0005 0013 that: .WORD 19
0007 390003 theOther:DECO this,d
000A 390005 DECO that,d
000D 00 STOP
000E .END
———————————————————-
———————
Symbol table
————————————–
Symbol Value Symbol Value
————————————–
that 0005 theOther 0007
this 0003
————————————–
Question 3
2 / 2 pts
Convert the assembly language pseudo-op, .ASCII “Bear\x00”, into hexadecimal machine language object code that is suitable for PEP/8. Separate each byte with a space.
42 65 61 72 00
Question 4
2 / 2 pts
In the following code, determine the value of the symbol this. Provide the hexadecimal value with no spaces, commas, or comments.
For example: 0A3F not 0A 3F
this:
that:
theOther:
BR theOther
.word 17
.word 19
DECO this,d
DECO that, d
STOP
.END
0003
The value of this is its memory location which is 0003.
The .ASCII pseudo-op generates contiguous bytes of ASCII characters and inserts them into the machine language program. You can put a newline character in your string by prefixing the letter n with a backslash, \n.
“Bear” generates 42 65 61 72 \n00 generates 00
Question 5
2 / 2 pts
Convert the assembly language instruction, ASLA into hexadecimal machine language object code suitable for running on PEP/8.
op code, (convert the mnemonic and addressing mode to the machine language op code) [OpCode]
operand specifier, (convert the hexadecimal constant to the machine language operand specifier)
Your answer will be one Pep/8 machine language instruction
Supply just the code for the instruction. Do not add anything . For example 2D not 2D 00 zz
1C
ASLA is Arithmetic Shift Left Accumulator 0001 110r r=0 for Accumulator
0001 1100
1C
Question 6
2 / 2 pts
Convert the assembly language instruction, CHARI 0x000F, s into hexadecimal machine language object code suitable for running on PEP/8.
op code, (convert the mnemonic and addressing mode to the machine language op code) [OpCode]
operand specifier, (convert the hexadecimal constant to the machine language operand specifier)
Your answer will be one Pep/8 machine language instruction
Question 7
2 / 2 pts
Convert the assembly language pseudo-op, .ASCII “Frog\x00”, into hexadecimal machine language object code suitable for PEP/8. Submit hexadecimal bytes separated by a space.
Example 50 30 29 17 not 50302917
46 72 6F 67 00
The .ASCII pseudo-op generates contiguous bytes of ASCII characters and inserts them into the machine language program.
“Frog” generates 46 72 6F 67 \x00 generates 00
Show the instruction only in a single line of hexadecimal with with a space between each byte.
Example F8 OA 3F not F8,OA,3F or F8 0A 3F 00 zz
4B 00 0F
CHARI instruction is 48-4F
Stack relative is 011
0100 1011 0000 0000 0000 1111 4B000F 4B 00 0F
Incorrect
Question 8
0 / 2 pts
Determine the output of the fifth line of code, CHARO 0x0026, i.
Provide only the output with no other words, spaces or comment
s.
DECO ‘m’, i
CHARO ‘\n’,i
DECO “mm”,i
CHARO ‘\n’,i
CHARO 0x0026,i
STOP
.END
38
The ASCII for 26 (hex) is &
Question 9
2 / 2 pts
Predict the output of the following assembly language program if the input is A.
CHARI 0x0010, d LDBYTEA 0x0010, d ANDA 0x0011, d
STBYTEA 0x0010, d CHARO 0x0010, d STOP
.BLOCK 1
.WORD 0x00DF
.END
Provide the case sensitive output with no extra characters, commas, or spaces.
A
Output is A when the input is A. The program converts a lowercase letter to its uppercase equivalent, but keeps uppercase letters the same. Uppercase and lowercase letters differ by a single bit, which is 0 for uppercase and 1 for the corresponding lowercase letter. The AND mask forces the bit to zero and leaves all other bits unchanged.
Question 10
2 / 2 pts
Convert the assembly language instruction, STR0 0x000D, sf, into hexadecimal machine language.
op code, (convert the mnenonic and addressing mode to the machine language op code) [OpCode]
operand specifier, (convert the hexadecimal constant to the machine language operand specifier)
Your answer will be one Pep/8 machine language instruction
44 00 0D
Question 11
2 / 2 pts
Predict the output of the following assembly language program. CHARO 0x0008, d
CHARO 0x0007,d
STOP
.ASCII “is” .END
si
CHARO 0x0008,d outputs before CHARO 0x0007,d Contents of 0x0008 is s
Contents of 0x0007 is i
44 00 0D (String output trap)
0100 0100 0000 0000 0000 1101
String output trap Stack-relative deferred addressing 0 00D
Question 12
2 / 2 pts
Convert the assembly language pseudo-op, .BYTE 0xF8, into hexadecimal machine language object code that is suitable for
Question 13
2 / 2 pts
Convert the assembly language instruction, BRNE 0x01E6, i into hexadecimal machine language.
op code, (convert the mnemonic and addressing mode to the machine language op code) [OpCode]
operand specifier, (convert the hexadecimal constant to the machine language operand specifier)
Your answer will be one Pep/8 machine language instruction
0C01E6
PEP/8. Separate each byte with a space.
F8
The .BYTE pseudo-op generates a byte that the programmer specifies. In this case, it generates F8
Question 14
2 / 2 pts
Convert the assembly language pseudo-op, .BYTE 13, into hexadecimal machine language object code suitable for PEP/8. Submit hexadecimal bytes separated by a space. Do not prefix a hex value with 0x.
0D
Question 15
2 / 2 pts
Predict the output of the following assembly language program. CHARO 0x000C, d
CHARO 0x000B,d
CHARO 0x000A, d
STOP .ASCII “gum” .END
mug
CHARO 0x000C,d outputs before CHARO 0x000B,d, which outputs before CHARO 0x000A,d
Contents of 0x000A is g (the ASCII value)
Contents of 0x000B is u (the ASCII value) Contents of 0x000C is m (the ASCII value)
The .BYTE pseudo-op generates a byte that the programmer specifies. In this case, it takes the decimal value 13 and coverts it to one byte of hex, 0D
Question 16
2 / 2 pts
Determine the output of the third line of code,DECO 0xFFC
3, i.
Provide only the output with no other words, spaces or comment
s.
DECO ‘Q’, i
CHARO ‘\n’,i
DECO 0xFFC3,i
CHARO ‘\n’,i
CHARO 0x007D,i
STOP
.END
-61
In two’s complement, FF C3 is -61 decimal
Question 17
2 / 2 pts
Convert the assembly language pseudo-op, .WORD -6, into hexadecimal machine language object code that is suitable for
PEP/8. Submit the bytes separated by a space. Do not prefix hex with 0x.
FFFA
Question 18
2 / 2 pts
In the following code, determine the output of assembly language pr
ogram.
this: DECO this, d
STOP .END
14592
The decimal output of the program is 14592 DECO is 39
this has a memory address of 0000
39 00 00
The first two byte are 39 00 (hex) which is 14592 (decimal)
.WORD generates two bytes for the loader. In this case -6 decimal is converted to FF FA hex. FF FA is the two’s complement of -6.
Question 19
2 / 2 pts
In the following code, determine the value of the symbol that.
Provide the hexadecimal value with no spaces, commas, or comments.
For example: 0A3F not 0A 3F
this:
that:
theOther:
BR theOther
.word 17
.word 19
DECO this,d
DECO that, d
STOP
.END
0005
The value of that is its memory location which is 0005.
nanswered
Question 20
0 / 2 pts
Predict the output of the program in Figure 5.13 if the dot commands are changed to:
.WORD 0xFE6C ; First
.BYTE 0x00 .BYTE ‘b’ .WORD 1401
; Second ; Third
; Fourth
U
Quiz Score: 34 out of 40
Provide your answer in order with single space between outputs -888 36 tim not -888, 36 tim