ASSIGNMENT-3
CHAPTER-4: ADVANCED ASSEMBLY PROGRAMMING
4.14 EXERCISES:
E4.6: The label array_x is the starting address of an array of 100 8bit elements.
Trace the following code sequence and describe what the subroutine sub_x does: ldx #array_x ldaa #100 jsr sub_x
...
Sub_x deca ldab 0,x inx loop cmpb 0,x ble next ldab 0,x next inx deca bne loop rts E4.10: Draw the stack frame and enter the value of each stack slot (if it is known) at the End of the following instruction sequence: lease -2,sp clrb ldaa #20 psha ldaa #$E0 psha ldaa #$E0 psha ldx #$7000 pshx jsr sub_abc
...
pshd leas -12,sp
...
E4.15: Write a subroutine to convert an 8-bit signed integer into an ASC11 string that represents a decimal number. The 8-bit integer and the pointer to the buffer to hold the ASC11 string are passed to this subroutine in accumulator B and index register X,respectively.
E4.16: Give an instruction sequence to call the out4hex () function to output the
16bit integer stored in memory location $1000-$1001.
E4.19: Write an instruction sequence to configure port A and port B for input and output respectively, read the value of port A and output the value to port B.
E4.20: Give an instruction to configure the pins 7, 5, 1, and 0 of port B for output and the remaining pins for input..yes ENGG 3640
ASSIGNMENT-3
CHAPTER-4: ADVANCED ASSEMBLY PROGRAMMING
4.14 EXERCISES:
E4.6: The label array_x is the starting address of an array of 100 8bit elements.
Trace the following code sequence and describe what the subroutine sub_x does: ldx #array_x ldaa #100 jsr sub_x
...
Sub_x deca ldab 0,x inx loop cmpb 0,x ble next ldab 0,x next inx deca bne loop rts E4.10: Draw the stack frame and enter the value of each stack slot (if it is known) at the End of the following instruction sequence: lease -2,sp clrb ldaa #20 psha ldaa #$E0 psha ldaa #$E0 psha ldx #$7000 pshx jsr sub_abc
...
pshd leas -12,sp