Questions and problems

QUESTIONS AND PROBLEMS

10.1 What are the basic differences between the 68000,68008,68010, and 68012?

10.2 What D0es a HIGH on the 68000 FC2 pin indicate?

10.3

(a) If a 68000-based system operates in the user mode and an interrupt occurs, what will the 68000 mode be?

(b) If a 68000-based system operates in the supervisor mode, how can the mode be changed to user mode?

10.4

(a)  What is the purpose of 68000 trace and X flags?

(b) How can you set or reset them?

10.5 Indicate whether the following 68000 instructions are valid or not valid. Justify your answers.

image

10.6 How many addressing modes and instructions D0es the 68000 have?

10.7 What happens after execution of the following 68000 instruction?

MOVE.L D0,$03000013

10.8 What is meant by 68000 privileged instructions?

10.9 Identify the following 68000 instructions as privileged or nonprivileged:

image

image

10.11 Identify the addressing modes for each of the following 68000 instructions:

(a) CLR D0

(b) MOVE. L (Al) +,- (A5)

(c) MOVE $2000 (A2), D1

10.12 Determine the contents of registers I memory locations affected by each of the following 68000 instructions:

image

10.13 Find the contents of register D0 after execution of the following 68000 instruction sequence:

EXT.W D0

EXT.L D0

Assume [D0] = $F215A700 prior to execution of the instruction sequence.

10.14 Find the contents of D1 after execution of DIVS. W #6, D1. Assume [D1] = $FFFFFFF7 prior to execution of the 68000 instruction. Identify the quotient and remainder. Comment on the sign of the remainder.

10.15 Write a 68000 assembly program to multiply a 16-bit signed number in the low word of D0 by an 8-bit signed number in the highest byte (bits 31-24) of D0.

10.16 Write a 68000 assembly program to divide a 16-bit signed number in the high word ofD1 by an 8-bit signed number in the lowest byte ofD1.

10.17 Write a 68000 assembly program to add the top two 16 bits of the stack. Store the 16-bit result onto the stack. Assume supervisor mode.

10.18 Write a 68000 assembly program to add a 16-bit number in the low word (bits 0-15) of D 1 with another 16-bit number in the high word (bits 16-31) of D 1. Store the result in the high word of D 1.

10.19 Write a 68000 assembly program to add two 48-bit data items in memory as shown in Figure P 10.19. Store the result pointed to by A l. The operation is given by

imageFIGURE P10.19

10.20 Write a 68000 assembly program to divide a 9-bit unsigned number in the high 9 bits (bits 31-23) of D0 by 810• D0 not use any division instruction. Store the result in D0. Neglect the remainder.

10.21 Write a 68000 assembly program to compare two strings of 15 ASCII characters.

The first string is stored starting at $502030. The second string is stored at location $302510. The ASCII character in location $502030 of string 1 will be compared with the ASCII character in location $302510 of string 2, [$502031] will be compared with [$302511], and so on. Each time there is a match, store $EEEE onto the stack; otherwise, store $0000 onto the stack. Assume user mode.

10.22 Write a subroutine in 68000 assembly language to subtract two 32-bit packed BCD numbers. BCD number 1 is stored at a location starting from $500000 through $500003, with the least significant digit at $500003 and the most significant digit at $500000. BCD number 2 is stored at a location starting from $700000 through $700003, with the least significant digit at $700003 and the most significant digit at $700000. BCD number 2 is to be subtracted from BCD number 1. Store the result as packed BCD digits in D5.

10.23 Write a subroutine in 68000 assembly language to compute

imageAssume the X;’s are signed 8-bit and stored in consecutive locations starting at $504020. Assume AO points to the x;’s. Also, write the main program in 68000 assembly language to perform all initializations, call the subroutine, and then compute Z/100.

image

(b) Assume 10-MHz 68000. Write a 68000 assembly language program to obtain a delay routine for one millisecond. Using this one-millisecond routine, write a 68000 assembly language program to provide a delay for 10 seconds.

10.25 Write a 68000 assembly program to compute the following:

I= 6 xJ+ KIM

where the locations $6000, $6002, & $6004 contain the 16-bit signed integers J, K, and M. Store the result into a long word starting at $6006. Discard the remainder of KIM.

10.26 Write a subroutine in 68000 assembly language program to compute the trace of a 4×4 matrix containing 8-bit unsigned integers. Assume that each element is stored in memory as a 16-bit number with upper byte as zero in the row-major order form; that is, elements are stored in memory as row by row and within a row, elements are stored as column by column. Note that the trace of a matrix is the sum of the elements of the leading diagonal.

10.27 A 68000168230 microcomputer-based microcomputer is required to drive the LEDs connected to bit 0 of ports A and B based on the input conditions set by switches connected to bit 1 of ports A and B. The I/O conditions are as follows:

  • If the input at bit 1 of port A is HIGH and the input at bit 1 of port B is low, then the LED at port A will be ON and the LED at port B will be OFF.
  • If the input at bit 1 of port A is LOW and the input at bit 1 of port B is HIGH, then the LED at port A will be OFF and the LED at port B will be ON.
  • If the inputs of both ports A and B are the same (either both HIGH or both LOW), then both LEDs of ports A and B will be ON.

Write a 68000 assembly language program to accomplish this.

10.28 A 6800016821-based microcomputer is required to test a NAND gate. Figure PI 0.28 shows the I/O hardware needed to test the NAND gate. The microcomputer is to be programmed to generate the various logic conditions for the NAND inputs, input the NAND output, and turn the LED ON connected at bit 3 of port A if the NAND gate chip is found to be faulty. Otherwise, turn the LED ON connected at bit 4 of port A. Write 68000 assembly language program to accomplish this.

image

A 68000/68230-based microcomputer is required to add two 3-bit numbers stored in the lowest three bits of D0 and D1 and output the sum (not to exceed 9) to a common cathode seven-segment display connected at port A as shown in Figure P10.29.Write 68000 assembly language program to accomplish this by using a l00k-up table.

10.30 A 68000/68230-based microcomputer is required to input a number from 0 to 9 from an ASCII keyboard interfaced to it and output to an EBCDIC printer. Assume that the keyboard is connected to port A and the printer is connected to port B. Store the EBCDIC codes for 0 to 9 starting at an address $003030, and use this l00kup table to write a 68000 assembly language program to accomplish the above.

clip_image00810.31 Determine the status of AS, FC2-FCO, LDS, UDS, and address lines immediately after execution of the following instruction sequence (before the 68000 tristates these lines to fetch the next instruction):

MOVE #$2050,SR

MOVE.B D0,$405060

Assume the 68000 is in the supervisor mode pnor to execution of the instructions.

10.32 Suppose that three switches are connected to bits 0-2 of port A and an LED to bit 6 of port B. If the number of HIGH switches is even, turn the LED ON; otherwise, turn the LED OFF. Write a 68000 assembly language program to accomplish this.

(a) Assume a 68000/6821 system.

(b) Assume a 68000/68230 system.

10.33 Assume the pins and signal shown in Figure Pl 0.33 for the 68000, 68230 (ODD), 2764 (ODD and EVEN). Connect the chips and draw a neat schematic. Determine the memory map and I/O map (Addresses for PGCR, PADDR, PBDDR, PACR, PBCR, PADR, PBDR). Assume a 16.67-MHz internal clock on the 68000.

image

10.35 (a) Write 68000 instruction sequence so that upon hardware reset, the 68000

will initialize the supervisor stack pointer to 100010 and the program counter to 200010.

(b) Write a 68000 service routine at address $1000 for a hardware reset that will initialize all data registers to zero, address registers to $FFFFFFFF, supervisor SP to $502078, and user SP to $1F0524, and then jump to $7020F0.

10.36 Assume the 68000 stack and register values shown in Figure PI 0.36 before occurrence of an interrupt. If an external device requests an interrupt by asserting the IPL2, IPL 1, and IPLO pins with the value 0002, determine the contents of A7′ and SR during interrupt and after execution of RTE at the end of the service routine of the interrupt. Draw the memory layouts and show where A7′ points to and the stack contents during and after interrupt. Assume that the stack is not used by the service routine.

image

image

10.38  In Figure P.l0.38, ifVM > 12 V, tum an LED ON connected at bit 3 of port A. If VM < 11 V, tum the LED OFF. Using ports, registers, and memory locations as needed and level 1 autovectored interrupt:

(a) Draw a neat block diagram showing the 68000/6821 microcomputer and the connections to the diagram in Figure P10.38 to ports.

(b) Write the main program and the service routine in 68000 assembly language.

The main program will initialize ports and wait for interrupt. The service routine will accomplish the  above task and stop.

image

10.39 Write a subroutine in 68000 assembly language using the TAS instruction to find, reserve, and lock a memory segment for the main program. The memory is divided into three segments (0, 1, 2) of 16 bytes each. The first byte of each segment includes a flag byte to be used by the TAS instruction. In the subroutine, a maximum of three 16-byte memory segments must be checked for a free segment (flag byte= 0). The TAS instruction should be used to find a free segment. The starting address of the free segment (once found) must be stored in AO and the low byte D0 must be cleared to zero to indicate a free segment and the program control should return to the main program. If no free block is found, $FF must be stored in the low byte of D0 and the control should return to the main program.

10.40 Will the circuit in Figure P10.40 work? If so, determine the I/O port addresses for PGCR, PADR, PADDR, PBDR, PBDDR, PCDR and PCDDR. If not, comment briefly, modify the circuit, and then determine the port addresses. Use only the pins and the signals shown. Assume all D0n’t cares to be zeros.

image

One thought on “Questions and problems

Leave a comment

Your email address will not be published. Required fields are marked *