Spring 2019 CSE4100 System Programming
Midterm Exam – 2019.4.18 (Thu)
Total: 100 points
Copyright By PowCoder代写 加微信 powcoder
1. SIC/XE Assembler 1 (12 points)
We would like to assemble the following program written in assembly language for a SIC/XE machine. Assume we have implemented a two-pass assembler. Answer the following questions.
(1) In pass 1 of the assembler, a symbol table will be generated. Write the contents of the symbol table. (The program name also goes into the symbol table.) [2 points]
Symbol Name
Address (hex)
(2) Write the object program produced by the assembler after pass 2. [10 points]
2. SIC/XE Assembler 2 (28 points)
Following is an assembly code of a program that reads a record from an input device to the memory. The program consists of two control sections. Answer the questions. (For EQU statements, the value of the symbol goes into the first column.)
BUFFER,BUFEND,LENGTH
BUFFER,LENGTH,BUFEND
BUFEND-BUFFER
(1) Assume the assembler pass 1 is finished. Write the assembly listing for control section ‘MYPROG’ by filling the table above. You should fill the first column with addresses assigned to each line, and the last column with the object code. (Fill in the gray part.) [4 points]
(2) Write the assembly listing for control section ‘RDREC’. (Fill in the gray part.) [12 points]
(3) Write the object program for control section ‘MYPROG’. For text records, only write columns 1-9. For modification records, use symbol names and do not use reference numbers. [4 points]
(4) Write the object program for control section ‘RDREC’. For text records, only write columns 1-9. For modification records, use symbol names and do not use reference numbers. [8 points]
3. SIC/XE Linking Loader (36 points)
Suppose we are going to build a program by linking three sub-programs, PROGA, PROGB, and PROGC. Following are the assembly listings of the three sub-programs.
LISTA,ENDA
LISTB,ENDB,LISTC,ENDC
ENDA-LISTA+LISTC
ENDC-LISTC-10
LISTB,ENDB
LISTA,ENDA,LISTC,ENDC
ENDA-LISTA+LISTC
LISTB-ENDB+LISTA-8
LISTC,ENDC
LISTA,ENDA,LISTB,ENDB
ENDA-LISTA+LISTC
ENDC-LISTC+LISTB-6
(1) Fill in the gray part (object codes) in the three tables. [6 points]
(2) Write the object programs for the three sub-programs. You do not need to write records for the missing part. For modification records, use symbol names instead of reference numbers. [12 points].
(3) After loading, the loader prints a load map on the screen. Write the load map assuming that the order of programs loaded is PROGA, PROGB, and PROGC. Assume PROGADDR=0x4000. [6 points]
Control Section
Symbol Name
Address (hex)
Length (hex)
(4) Write the contents of the memory (in hex format) after the loader has loaded the object programs onto memory. You can leave out the memory that is not relevant. (Don’t bother writing dots.) [12 points]
Byte 00-03
Byte 04-07
Byte 08-0B
Byte 0C-0F
4. SIC/XE Addressing Modes (12 points – 2 points each)
After executing the following instructions (in object code), what is the value of register A (in hex)? The memory and other register values are as follows. (※ Hint: opcode of LDA is 00.)
(B) = 006000 (PC) = 003000 (X) = 000090
Memory Address
Value (hex)
Memory Address
Value (hex)
(1) 032600 (2) 03C300 (3) 022030
(4) 010030 (5) 0310C303 (6) 003600
5. Loading and Linking – Concepts (12 points)
※ Answer briefly to the following questions. You can write your answers in English or Korean.
(1) What is program relocation? [2 points]
(2) What is the benefit of using program relocation? [2 points]
(3) What is a linkage editor? How is it different from a linking loader? [2 points]
(4) What is the benefit of using a linkage editor, instead of a linking loader? [2 points]
(5) What is dynamic linking? [2 points]
(6) What is the benefit of using dynamic linking? [2 points]
——– End of the Exam ——-
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com