Machine Problem 1, due Jun. 24
Part of
the homework for CS:2630, Spring 2015
|
n: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ... |
f(n): | 0 | 1 | 3 | 6 | 10 | 15 | 21 | 28 | ... |
f(n) = n(n+1)/2 |
n | ||
f(n) = | Σ | i |
i = 1 |
If you substitute the following application code for the application code section of the hello world program given in Chapter 5 of the notes, you will have a program that prints the first 20 non-negative integers:
; --- begin application code --- LIS R8,0 ; n = 0 LOOP: ; loop { MOVE R3,R8 ; -- parameter n, the number to output LIS R4,4 ; -- parameter 4, the field width LIL R1,PUTDEC JSRS R1,R1 ; putdec( n, 4 ) ADDSI R8,1 ; n = n + 1 CMPI R8,19 BLE LOOP ; } until (R8 > 19) ; --- end application code ---
All code you add must be at least as readable and at about as well commented as the code distributed above and in the notes.
An absolute rule: We do not do detective work to connect printed paper copies of assignments with the person who did the work. We assemble and print all assignments as part of the grading process. If your name is not included in the title line, you will not receive any credit.
Programming assignments will be submitted on-line using the on-line Online Coursework Submission tool provided by the Liberal Arts Linux server cluster. The user interface for this is awful, but but it works. Your source file must be named mp1.a (the name is case-sensitive). This is the name you will type in response to the File/directory name prompt. When the submission tool prompts for Course type CS2630. Select the assignment directory mp1. Remember, this is a Linux system, file names are case sensitive.
You must submit your work using the submit command from the a CLAS Linux machine. If you make repeated submissions, only the last one will count. Submissions must be in place before midnight on the indicated day.