CS310
Introduction to Computer Systems, Fall 2017
 Syllabus
 Course
Policies
 Code in
classroom (click here)
 Assignments. Requirements
 Type BOTH of questions and answers
(that should be highlighted) to the document in a fine format (handwriting
is NOT accepted); for the programming assignments, comments
for ALL operational statements and format for the code
with
functional modules. BOTH of the programs and the I/O
screenshot examples are copied to ONE
document (including all subquestions and projects).
The document should be named as CS310assignment#_FirstNameLastName.doc. Email the document as
an attachment to the instructor (usvwccs@gmail.com). The email subject is the same as the file name.
 Assignment 1 (1pm, Thu. 9/7) a) Convert each of following binary
numbers to its equivalent hex number: 101011, 10101010. b) Convert each
of following hex numbers to its equivalent binary number: 1F, 11. AAA, 101. c) What is the decimal representation of each of the following unsigned binary numbers: 0010 1011, 1010
1010? d) Perform the binary addition in byte: 0010 1011 + 1010 1010 = ? e) What is the 8bit binary representation of each of the following unsigned decimal numbers: 15, 51?
 Assignment 2 (1pm, Tu. 9/12) a) What is the decimal representation of each of the following signed binary
numbers in byte: 0010 1010, 1010 1010?
b) What is the 8bit binary representation of each of the following signed decimal numbers: 15, 100.
c) Perform the binary subtraction in byte: 00101011  10101010 = ? 10101010  01101011 = ?.
d) Perform the following hex operation in byte: 11 + 1F = ? 11  1F = ?
e) What is the 8bit hex form of decimal 30? What is the 16bit hex form of decimal
30?
 Assignment 3 (1pm, Th. 9/14) a) What is the decimal representation of each of the following signed
hexdecimal numbers: 22, F2?
b) What is the 8bit hexdecimal representation of each of the following signed decimal numbers:
22, 22?
d) Perform the following hex operation in byte: F2  22 = ? 22  F2 = ?
 Assignment 4 (1pm, Tu. 9/19) a) Convert the relative address 0DC7:ABCD (in real address mode) to a linear address.
b) Calculate the size in KB or MB of the memory space whose linear address is from
B0000 to BFFFF. Show the calculation process. c) The same question as b)
that is from
A0000 to BFFFF.
 Assignment 5 (1pm, Th. 9/21) For each of the following ASM code segments, show the result in hex for AL and other flags by filling the blanks.
a)
MOV AL, 0FEh
ADD AL, 9
AL: ____ CF: ____ SF: ____ ZF: ____ OF: ____
b)
MOV AL, 9
SUB AL, 0Ah
AL: ____ CF: ____ SF: ____ ZF: ____ OF: ____
 Assignment 6 (1pm, Tu. 10/10) a) Write a MASM program to
compute EAX = (12 * 2 ) + (12 / 2)  23. Use ADD, SUB, MUL, or DIV for
the corresponding operations, and store all of the
values to registers (use MOV). Store the result to EAX, and display it in hex by calling RegDump, and also in decimal by calling the WriteInt procedure (see p.124). b) With the same requirement,
compute EAX = (2 + 7) / 3  2 * 3. Requirements: format your codes with
functional modules (call Crlf for newline, p.113) and comments for ALL operational results.
 Assignment 7 (1pm, Th. 10/19) Write the MASM code to compute EAX =
(153)/4*2  (1+9)/5  6. All operands in the expression should be
stored in the registers and operated with corresponding operations,
meaning ADD, SUB, MUL, DIV. Format your code with
functional modules (display the results in decimal numbers) and comments for ALL operational results.
 Assignment 8 (1pm, Tu. 10/24) Project a) The MASM code
will read three positive integers from the keyboard and output their
average (integer part) to the monitor. Project b) Write ONE MASM program that will prompt a message, let the user input
two positive integers
(decimal), M and N (M<N), and perform the following tasks: i) display all numbers
among M to N (including the two end values); ii) sum up all numbers
among M and N and output the result.
 Assignment 9 (1pm, Tu. 11/7) Project a) Your ASM program that will prompt a message, let the user input
a positive integers (decimal type), N (N>0), and perform the following tasks:
i) display all even numbers from 1 to N (including N if it is even); ii) sum up all
even numbers from 1 and N (including N if it is even), and output the result.
iii) find the average value in ii) (integer part) and output it. Hint: to output even numbers from
1N, initialize the register EAX with
2 and with an increment of 2, with N/2 loops. Refer to WriteString (p.124), ReadInt (p.121), WriteDec (p.123), etc.
Additional requirements: screenshots show N being 5 and 6;
display the required results and related prompting messages ONLY, and
remove the debugging info before submitting the project.
 Assignment 10 (1pm, Th. 11/9) Project a) Your ASM
code will prompt messages and let the user input two positive integers a
and n. The code will output the result of a^{n} to
the monitor. Hint: a^{n}=a*a ... *a (total of n
terms). Additional requirements: screenshots show results
of 2^{1 }, 2^{2}, and 3^{3};
display the required results and related prompting messages ONLY, and
remove the debugging info before submitting the project.
 Assignment 11 (1pm, Tu. 11/14) Project a) The program will prompt a message and let the user input two integers M and N (assuming 0<M<N). And then the program will perform the following tasks: i) output all odd numbers between M to N (not including M and N) to the monitor;
ii) sum up all odd in i). Additional requirements: screenshot
examples show: [1, 9] and [2, 10]. Project b) The program will prompt and
let the user input positive integers until a negative number or zero is
read (quit the program), and then perform the following tasks: i)
calculate the total value of all numbers read and display the result to
the monitor; ii) calculate the average value in i), and display the
integer part to the monitor. Additional requirements:
screenshot example shows that keyboard input is 1, 2, 3, 4, 5, 0.
 Assignment 12 (1pm, Th. 11/16) Project a) The program will
prompt messages and let the user input two sides values of a rectangle and
output its perimeter and area to the monitor. Use a loop so the code
could be run continuously until a zero/negative value for the first side is read. Additional requirements:
two screenshots show results of two sides values of (1, 2) and (2, 3).
 to be updated.


 Topics covered

8/29 Syllabus and class policy. Bit, byte and word

8/31 Binary and hex. Binary addition; binary to decimal

9/5 Decimal to binary; signed binary and subtraction;
two's complement

9/7 More on binary/hex

9/12 Architectures. Convert relative address to linear
address. Real mode

9/14 More on architectures. Linear addresses and its
size of the space

9/19 Flags

9/21 More on flags

9/26 Test 1A

9/28 On test. Stacks

10/3 Takehome assignment

10/5 More on MUL/DIV; use WriteInt (p.124) and Crlf
(p.113)

10/10 ASM coding  structure and comments

10/12  (Fall break)

10/17 Variables (memory). I/O

10/19 Loops (p.105) and JMP (104). More on variables and data types

10/24 Addressing

10/26 Test 1B

10/31 On Test 1B; data in memory (ch3); directoffset
addressing (ch4)

11/02 Data operators (OFFSET, PTR, TYPE, LENGTHOF,
SIZEOF). Indirect addressing (IA)

11/07 More on IA. Compare (p.156) and conditional jump
(p.161 Table 65)

11/09 More on CJ

11/14 Procedure

11/16 More on procedure

11/21 Test 2

11/23 

11/28 More on CJ and procesure

11/30 Structures and Micros

12/05 Review

12/07 Exam

Final project due on final week

 Textbook's
Web
 Download and install the zip file (Click here)
for Windows 8 or earlier. For Windows 10, copy the shared folder Masm615
from the computer //MATV2D5RC08Y1/ (MUST on campus, click the network
drive and find/click it) and paste it to C:\ drive of your computer (you should
be on the Administer role).
 How to install and configure TextPad
and MASM
6.15. (Note: If you use Java, install Java before TextPad. Click
here
for more info)

 Lecture notes 
 Code in
the past years
© Since 2000,
Dr. John Wang, Virginia Wesleyan University, 5817 Wesleyan Drive, Virginia
Beach, VA 23455
Updated on Tuesday, November 14, 2017
by
zwang@vwu.edu
http://zwang.vwc.edu/~jwang/ThreeTen
