

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Computer Systems&Assembly Lang; Subject: Elect Engr & Computer Science; University: University of Kansas; Term: Unknown 2009;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Due: March 4 Problems from textbook Q1: Page 70: Challenging โ 7 (20 points) Write a program segment starting at $C100 that checks bits 0 and 2 of address $D000 and jumps to $C0CC if both bits are clear. This task is easily accomplished using the BRCLR instruction. We are interested in bits 0 and 2, which gives us the 8-bit mask 00000101 ($05). Therefore: ORG $C LDX #$D BRCLR 0,X,$05,$C0CC SWI Q2: Page 116: Advanced โ 3 (25 points) Write a program using a subroutine to copy a table from one location to another. A partially completed program is given next. Write a program by filling in locations where only comments appear. Note 1: when we save the CPU registers, we have to make sure to restore them in reverse order to align the values properly and to make sure they go back to their proper places. Note 2: FDB and FCB are not identical to EQU; when you load the values into a register, you do not use the immediate operator โ#โ.
COPYT PSHD ; save the CPU registers onto the stack PSHX PSHY PSHC AGAIN TSTA ; check the counter value BEQ DONE ; if zero jump to the end LDAB 1,X+ ; note the use of accumulator B STAB 1,Y+ SUBA #$01 ; adjust the counter and target addresses BRA AGAIN ; continue the loop DONE PULC ; restore the CPU registers PULY PULX PULD RTS ; IMPORTANT!!!!!!!! END Q3: Page 116: Advanced - 4 (20 points) Suppose you started with the following register contents. P-C007 Y-7892 X-FF00 A-44 B-70 SP-C04A What address is in the stack pointer and exactly what is in the stack after the following instruction sequence is executed? PSHA PSHB PSHY After the execution of the above instructions, the stack pointer points to address $C and the stack contains Address Content C045 โฆ C04 6 78 C047 92 C048 70 C049 44 As you can see, accumulator A is at the bottom of the stack, at address $C049, because it was pushed first. It is followed by accumulator B, and then register Y. Q4: Page 117, Challenging - 1 (25 points) Stack Pointer