| TA: | Jade Cheng 成玉 (yucheng@hawaii.edu) | |
| Instructor: | David Pager (pager@hawaii.edu) | |
| Course: | Machine-Level and Systems Programming | |
| TA Office: | POST Building Room 303-3 (cubicle 3) | |
| TA Hours: | Tuesday 11:00 to 12:00 | |
| Thursday 11:00 to 12:00 | ||
TBD
If you do not complete homework assignments sufficently, you would automatically fail the course. Otherwise, homework does not affect your grades. Homework submissions will be recorded and posted on this site using the student codes provided by the TA.
Please submit your homework assignments by 11:59 pm on the posted due date. Homework received on time will receive 10 points. One point will be deducted for late submissions. After one week homework will not be accepted.
To facilitate the grading process, please try to follow the following guidelines when submitting assignments.
Assignments should be submitted via email using your UH UNIX email account. The TA will not accept any other form of submissions.
Assignments should be submitted to yucheng@hawaii.edu. Please do not send the assignments to the professor.
Please cc the email to youself. That way, if the TA doesn’t get your email for some reason, you have proof that it was sent.
Please use the following pattern for the subject of your email.
[312] homework number
For example: [312] homework 1
Please copy and paste the contents of the homework in the email body. That way, the TA will receive your work even if the attachment is rejected.
Plain text files are preferred. PDF, JPG, and PNG files are also accepted. Please do not send Microsoft Office documents.
You may submit an assignment more than one time. Only the most recent assignment submitted will be evaluated.
The grades for homework assignments, programming projects, in-class quizzes, and the exams will be posted using the student codes provided by the TA. If you lose or forget your code, please contact the TA.
Click your student ID to view your grades.
The solutions of some of the homework assignments and the in-class quizzes will be posted in this section. Since late submmisions are allowed, the solutions will not be available until a couple of weeks after the due date.
;; program2 -- This program asks the user how many numbers are to be added, and
;; input the user's response, which we will call n. Now go into a loop which is
;; iterated n times, and in each iteration asks the user to enter a number.
;; Your program should add up all these numbers, using only a single ADD
;; instruction, and, finally output: The sum of the numbers enters is: followed
;; by the sum.
.model small
.stack 100
.data
prompt1 db 0ah,0dh,"Enter a number < 10: $"
prompt2 db 0ah, 0dh, "Your number: $"
result db 0ah,0dh,"Sum of your numbers is: $"
.code
prog proc
mov ax, @data
mov ds, ax
lea dx, prompt1 ; display prompt1.
mov ah, 9h
int 21h
mov ah, 1h ; obtain input from keyboard.
int 21h
sub al, 30h ; convert user input to a digit.
mov cl, al ; mov to cl and use it as loop counter.
mov ch, 0 ; ch is used to store the sum.
startofloop:
cmp cl, 0 ; end loop if counter reaches 0.
je endofloop
dec cl ; decrement loop counter.
lea dx, prompt2 ; display prompt2
mov ah, 9h
int 21h
mov ah, 1h ; obtain input from the keyboard
int 21h
sub al, 30h ; convert it to a digit.
add ch, al ; add to ch.
jmp startofloop ; loop again.
endofloop:
add ch, 30h ; convert ch back to character.
lea dx, result ; print out result message
mov ah, 9h
int 21h
mov dl, ch ; print out the character which is the sum
mov ah, 2h
int 21h
mov al, 0 ; return code of 0
mov ah, 4ch ; function code for exit to os
int 21h
prog endp
end prog The course textbook — William Jones’ Assembly Language Programming for the IBM PC Family, 3rd Edition