Sheet 01
Sheet 01
11. Identify the addressing mode for each of the following: a- STAA PORTB b- LDAA #$50 c- STAA $800 d- LDAA #0 e- CLRA f- ABA 12. Indicate the size of instruction for each of the following: a- STAA PORTB b- LDAA #$50 c- STAA $800 dLDAA #0 e- CLRA f- ABA
c) LDAA #$95 EORA #$AA d) LDAA #$5D ANDA #$78 e) LDAA #$C5 ORAA #$12 f) LDAA #$6A EORA #$6E g) LDAA #$37 ORAA #$26 28. Assume that MYREG = 85H. Indicate if it skips after compare is executed in each of the following cases: a) LDAA #$90 CMPA #$85 BHI OVER INA ADDA #$2 OVER b) LDAA #$70 CMPA #$85 BLO OVER INA ADDA #$2 OVER c) LDDA #$85 CMPA #$85 BLO NEXT INA ADDA $2 NEXT d) LDAA #$5D CMPA #$85 BHI NEXT INC A ADDA $2 NEXT
29. Find register A contents after each of the following is executed: a) LDAA #$65 CLC RORA RORA b) LDAA #$39 CLC ROLA ROLA c) CLC LDAA #$D4 RORA RORA RORA d) CLC LDAA #$A7 ROLA ROLA 30. Write a program that finds the number of the zeros in an 8-bit data item. 31. Write a program that finds the position of the first high in an 8-bit data item. The data is scanned from D0 to D7. Give the result for 68H. 32. Write a program that finds the position of the first high in an 8-bit data item. The data is scanned from D7 to D0. Give the result for 68H. 33. Write a program to convert the following packed BCD number to ASCII. Place the ASCII codes in data RAM locations starting at $840. 34. Write a program to convert the following ASCII numbers to a packed BCD. MYASC_1 EQU 8 MYASC_2 EQU 9
Most of problems in this sheet are copied from the text book: HCS12 Microcontroller and Embedded Systems: Using Assembly and C with Code Warrior, Muhammad Ali Mazidi, Janice Mazidi, Danny Causey, Pearson Prentice Hall ,2009.