Micro T3
Micro T3
d) What are the data memory addressing modes? explain with examples?
Q2__ Please mark the following statements if correct ( ) or incorrect ( X ) and write the correct
statement if not correct:
d) The instructions that use 1/O direct addressing mode are IN and OUT:
OUT stores data from a source GPR (Rr) into an 1/0 register.
e) The instructions LDS is used in the 1/0 addressing mode, and it contain immediate values.
f) LDI XL, Ox31 ------------ > is the same as "LDI R27, Ox31"
g) The instructions that use data memory indirect addressing mode are 32-bit instructions
h) LDI R20, OxFF
Q3__Write instructions that initialize Y register to points to the data memory location 300 (in decimal),
and then:
Q4__Write a program to store the value 0x55 into memory locations 0x140 through 0x144 using:
c) loop.
Q5__Write assembly code to store 0x95 into the memory location 0x52E.
Q6__ Write assembly code that loads data from PIN registers of port C and port D into GPRs, perform a
subtraction, and store the result in a destination register.
Q7__ Write assembly code that adds the contents of three continuous locations of data space (0x0200,
0x0201 and 0x0202) and stores the result in the first two locations (0x0200, Ox0201). Firstly initialize the
Z register to point to the memory location Ox0200.
Q8__ Assume that RAM locations 0x90 - 0x94 have a string of ASCHI data, as shown below.
0x90 = ('H') 0x91 = ('E') 0x92 = ('L') 0x93 = (L') 0x94 = (0) Write assembly program to get (read) each
character and send it to Port D; one byte at a time. Show the program using:
Q9__Write a program to clear 16 memory locations starting at data memory address 0x60. Use the
following:
Q11__Assume that data memory locations 0x240-0x243 have the following hex data
Write a program to add the contents of theses memory locations and place the result in locations 0x220
and 0x221.
Q12 __Write assembly code to subtract two 16-bit numbers: 0x3512 - Ox2ECA.
-Store the 0x1F2B in the two memory locations 0x15A and 0x15B.
-Subtract an immediate value OxC439 from the contents of locations 0x15A and 0x15B, and then stores
the result in the same locations.
Q15__ Write a program that multiply the two numbers 0x25 and 0x65.
Q16__ write a program to send the value 0xE3 to port D and then toggle this value on port D forever.
Q17__write assembly instructions to mask the upper 4bits of the memory location 0x151 (i.e.4C) and
store the result in the same location.
Q18__write a code to set the bit number of the memory location 0x124 (i.e. 0x18), and store the result
in the memory location 0x25A.
Q19__ Write code that reads a number from port D and compares it to the value OxFA using EOR
instruction. If they are equal the AGAIN loop will be broke. Otherwise, read another number from port D
and repeat the comparison.
Q20__Read and test PORTB to see whether it has the value OxC2. If it does, send OxEE to
PORTC; otherwise, it is cleared
Q21__ Write assembly program that use the zero flag and BRNE to:
A)Clear R17.
Q23__ write a program that checks continuously a value from the input port B (PINB) until it has a value
other than 0.
Q24 __Write assembly program that find the sum of the values 0x88, OxA4, and OxF3. Put the low byte
of the sum into R18 and the high byte into R19.
If so, store the value 0x2C into the memory location 0x300.
If it isn't equal zero, store the value 0x3F into the memory location 0x300
Q26__ Toggle all the bits of Port B by sending to it the values 0x55 and OxAA continuously. Put a time
delay between each changing of data of Port B
Q27__write assembly program that finds the number of 1s in a given byte (0xC6).
Q28__Follow the instructions below and write the output of each one
CBI PORTD, 6
SBI PORTC, 2
SEC
ROL R20
ROL R20
ROL R20