



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Before starting this exercise, read Example 10 and work through it using the THRSim11 simulator. Then, read this exercise. You will notice that the present exercise is practically identical with this example, only that is uses different numbers, at times. 'Save As' this Word file in the personalized format indicated in the course pack. To complete the exercise, you will have to do the following: Type in text Insert screen/window captures from the THRSim11 simulator. The exercise has 15 sections. Do them in sequence.
This exercise has the following objectives: Introduce 8-bit binary numbers Introduce connection between 8-bit binary numbers and 2-digit hex numbers. Introduce 8-bit binary arithmetic Introduce binary 8-bit logic
You have to write .asm code to do the following: i) Represent numbers one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen in decimal, binary, and hex ii) Perform 5 + 4 = 9 in binary and hex using LDAA, LDAB, ABA iii) Perform 15 – 7 = 8 in binary and hex using LDAA, LDAB, SBA iv) Perform $1f + $01 = $ in binary and hex using LDAA, ADDA (bit 3 carry) v) Perform $20 -$01 = $ in binary and hex using LDAA, SUBA vi) Perform $ff + $01 = $ in binary and hex using LDAA, ADDA (MSB carry) vii) Perform $00 - $01 = $ in binary and hex using LDAA, SUBA viii) 0 AND 1 = using LDAA, ANDA ix) 0 OR 1 =using LDAA, ORAA x) 0 XOR 1 = using LDAA, EORA xi) 1 OR 1 =using LDAA, ORAA xii) 1 XOR 1 = using LDAA, EORA xiii) %00000000 NAND %11111111 = % using LDAA, ANDA, COMA xiv) %11111111 NOR %00000000 = % using LDAA, ORAA, COMA
xv) %10101110 AND %00001000 = % using LDAA, ANDA (masking) (Note: the NAND and NOR instructions do not exist in the MC6811 instruction set, but can be obtained by using the COM instruction after the AND and OR instructions .)
Open THRSim11. Maximize THRSim11 window. Close the Commands window. Open the template.asm file and save it with the personalized name LASTNAME_Firstname_Ex10 (Please respect the upper and lower conventions.). Type your program in the .asm window after the line saying *Begin typing your code. Assemble your file, tile the windows, set the breakpoint, and reset the registers.
HEX Reset accA. Place PC at the beginning of section i) of your code. Set display of accA to binary. Perform first step. Explain what happened during this operation. 4 point(s) Perform the rest of the steps. Step through the rest of the operations, incrementing each time accA by one. At each step, observe the binary representation, then switch to hex, then to decimal, and back to binary. When incrementing, observe how the binary bits either increment from 0 to 1, or increment from 1 to 0 with a binary carry to the left. While binary numbers experience a carry at each step, the decimal and hex numbers do not. Watch out for decimal and hex carries! You will only need to capture and paste below those situations when a decimal or a hex carry happened. Paste here your screen capture when a decimal carry happened. 10 point(s) Type in the decimal, binary and hex equivalents of the number in accA: Decimal:_________ binary:%____________ hex:$___________6 point(s) Paste here your screen capture when a hex carry happened. 10 point(s) Type in the decimal, binary and decimal equivalents of the number in accA: Decimal:_________ binary:%____________ hex:$___________6 point(s)
Perform the operation in the THRSIM11 simulator. Type in the binary and hex equivalents of the results: %______________________________________2 point(s) $_________ 2 point(s)
Predict the result of 0 AND 1 = _________2 point(s) Perform the operation in the THRSIM11 simulator. 0 AND 1 = ______2 point(s)
Predict the result of 0 OR 1 =___________2 point(s) Perform the operation in the THRSIM11 simulator. 0 OR 1 =___________2 point(s)
Predict the result of 0 XOR 1 =__________2 point(s) Perform the operation in the THRSIM11 simulator. 0 XOR 1 =__________2 point(s)
Predict the result of 1 OR 1 =__________2 point(s) Perform the operation in the THRSIM11 simulator. 1 OR 1 =__________2 point(s)
Predict the result of 1 XOR 1 =__________2 point(s) Perform the operation in the THRSIM11 simulator. 1 XOR 1 =__________2 point(s)
Predict the result of %00000000 NAND %11111111 = %____________________2 point(s) Perform the operation in the THRSIM11 simulator.
%00000000 NAND %11111111 = %____________________2 point(s)
Predict the result of %11111111 NOR %00000000 = %____________________2 point(s) Perform the operation in the THRSIM11 simulator. %11111111 NOR %00000000 = %____________________2 point(s)
Predict the result of %10101110 AND %00001000 = %____________________2 point(s) Perform the operation in the THRSIM11 simulator. %10101110 AND %00001000 = %____________________2 point(s)
In this exercise, you have learned: The 8-bit binary numbers The connection between 8-bit binary numbers and 2-digit hex numbers. The 8-bit binary arithmetic The 1-bit and 8-bit binary logic The fact that logic operations are performed bit-by-bit Boolean inversion using the complement opcode (e.g., COMA). Masking, i.e., the selection of bits using masks New words and notations: 8-bit binary arithmetic, 8-bit binary logic; complement opcode; masking, flags.