Midterm Exam Practice Questions - Machine Dependent Programming | ECS 050, Exams of Computer Science

Material Type: Exam; Class: Machine Dependent Prog; Subject: Engineering Computer Science; University: University of California - Davis; Term: Summer 2007;

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-oty-1
koofers-user-oty-1 🇺🇸

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1. (6) Manychanges had to be made to CUSP in order to support interrupts. Describe 6 of
them.
2. (4) The I/O device interface uses Status, Control and Data registers. There are twodifferent
places to put these registers - describe the two, and give a brief advantage of each approach.
3. (2) What is a Video Buffer?
4. (2) CUSP uses a Frame Pointer.Why?What is it used for?
pf3
pf4
pf5
pf8

Partial preview of the text

Download Midterm Exam Practice Questions - Machine Dependent Programming | ECS 050 and more Exams Computer Science in PDF only on Docsity!

  1. (6) Many changes had to be made to CUSP in order to support interrupts. Describe 6 of them.
  2. (4) The I/O device interface uses Status, Control and Data registers. There are two different places to put these registers - describe the two, and give a brief advantage of each approach.
  3. (2) What is a Video Buffer?
  4. (2) CUSP uses a Frame Pointer. Why? What is it used for?
  1. (2) Suppose the following code is executed:

LDA# $E OUTB $ INB $ HLT

What does the Accumulator contain after the HLT instruction is executed?

  1. (16) Given the following code sequence:

.EQU @,$ LDA# $ L0: LDX# 7 L1: STC L L2: LDX# 8 LDC S .WORD $ STC L L3: HLT S1: .WORD $3F001A S2: .WORD $ S3: .WORD $9DA .END

What memory locations and registers are altered by the execution of this program? Show the values of the registers and memory locations that have changed when the program ter- minates. Assume the program begins execution at location 000.

ACC = XR = PC = SP = FP = MEM[ ] = MEM[ ] = MEM[ ] = MEM[ ] = MEM[ ] =

  1. (20) Here is the beginning of some code that calls a subroutine, and the first few statements of the subroutine itself. Write down the contents of the Stack at the point where the subrou- tine stops. If you do not know the exact contents, write down what they would be ("con- tents of Accumulator", for example). Assume execution begins at "START" (location 005). Assembly Language Program: .EQU @, 000 ARRAY: .BLKW 3, LENGTH: .WORD 9 COUNT: .WORD 12 START: LDS# $A LDX# 17 LDA# 256 TSF PSH# ARRAY PSH LENGTH PSH# COUNT JSR PAR HLT

.EQU @,$ .EQU CNT, .EQU ARR, .EQU LENTH,

PAR: BGN# 3 PSHA PSHX ( Write down Contents of Stack at this point, as well as the value of the Stack Pointer and the Frame Pointer ) Mem Address Mem Contents

SP= FP=

  1. (16) The following is an interrupt-driven program that will beep every time you press any character on the keyboard. This program will not work as shown - there are at least 4 lines missing that are necessary in order to make the program function correctly, and 4 others that are incorrect. Your task is to fill in the missing lines and fix the incorrect ones. .EQU KBD_CNTL,$ .EQU KBD_DATA,$ .EQU CRT_DATA,$

.EQU INTERRUPT_ENA,$ .EQU BELL,$ .EQU STACKTOP,$E

MAIN: LDA# INTERRUPT_ENA ; enable kbd interrupts OUTB KBD_DATA

LOOP: NOP JMP LOOP

KBD_ISR: PSHA ; save registers INB KBD_DATA ; read keystroke LDA# BELL ; ring bell OUTB CRT_DATA

EXIT: POPX ; restore registers RTN

.END

Keyboard Register Bit Number Interpretation 7654 3210

Control x--- ---- 1 = enable interrupts, 0 = disable interrupts -x-- ---- 1 = flush buffer, 0 = no operation --xx xxxx unused (no affect)

Status x--- ---- 1 = ready (data available) -x-- ---- 1 = interrupt enabled --xx xxxx unused (always zero)

Interrupt Addr $FF

Tape Drive Register Bit Number Interpretation 7654 3210 Control x--- ---- 1 = enable interrupts, 0 = disable interrupts -x-- ---- 1 = clear interrupt request, 0 = no operation --xx ---- 00 = no operation 01 = read record 10 = write record 11 = rewind tape ---- xxxx unused (no affect) Status x--- ---- 1 = ready (to begin new operation) -x-- ---- 1 = interrupt enabled --x- ---- 1 = tape mounted ---x ---- 1 = interrupt pending ---- 1--- 1 = end of tape encoutered on read ---- -xxx unused (always zero) Interrupt Addr $FFA

Printer Register Bit Number Interpretation 7654 3210

Control x--- ---- 1 = enable interrupts, 0 = disable interrupts -x-- ---- 1 = clear interrupt request, 0 = no operation --xx xxxx unused (no affect)

Status x--- ---- 1 = ready (to receive character) -x-- ---- 1 = interrupt enabled --x- ---- 1 = printer on-line ---x ---- 1 = interrupt pending ---- xxxx unused (always zero)

Interrupt Addr $FF

Timer Register Bit Number Interpretation 7654 3210 Control x--- ---- 1 = enable interrupts, 0 = disable interrupts -x-- ---- 1 = clear ready bit, 0 = no operation --xx ---- 00 = no operation 01 = start timer (after loading counter) 10 = stop timer 11 = start timer (without loading counter) ---- xxxx unused (no affect) Status x--- ---- 1 = ready (count complete) -x-- ---- 1 = interrupt enabled --xx xxxx unused (always zero) Interrupt Addr $FFB