20 likes | 99 Views
CMPE12c Homework #5 Spring 2003. 1) (20 pts) Write an HC11 procedure that calculates the factorial of the number stored in accumulator A. It needs to be recursive and the end number needs to be returned in the accumulator D. fact: cmpa #1 blt no_fact psha deca jsr fact pula
E N D
CMPE12c Homework #5 Spring 2003 1) (20 pts) Write an HC11 procedure that calculates the factorial of the number stored in accumulator A. It needs to be recursive and the end number needs to be returned in the accumulator D fact: cmpa #1 blt no_fact psha deca jsr fact pula mul rts no_fact: ldd #1 rts Assuming only works to fact(6)=720, and not 16 bits for the result. 2) (10 pts) Write an HC11 code to implement the following “C” type code. Assume that a, b, i, and count are all “words” declared already in the .data section. for (i=0; i<=10; i++) begin if (a < b) a = a + 1; if (a == 3 || b =5) count = count - 1; end ldab #0 loop: ldx a cpx b bge no_add inx stx a no_add: cpx #3 beq yes_sub ldx b cpx #5 beq yes_sub bra no_sub ldx count dex stx count no_sub: incb cmpb #10 ble loop clra std i
3) (20 pts) Research and list 5 different microcontrollers and their configurations (speed, RAM, EEPROM, IO, ADC, etc) for different manufactures. Motorola, Intel, Zilog, Amtel, TI, NI, Microchip, Rabbit, ect.