; ; This program works with a file that is similar to the one used in ; project 5. This program reads the last name and first name into ; strings (that work a lot like C++ strings) and then reads in the ; five bird counts and sums them together. Finally, the program ; displays the names (first then last) and the total birds seen for ; each person. This program completely relies on macros to work. ; .title filesummary .library /project:iopack/ .library /mymacros/ easyio cr=13 lf=10 first: .blkb 20 ; Watcher's first name last: .blkb 20 ; Watcher's last name count: .blkl 1 ; Number of birds seen crlf: .asciz title: .asciz /Watcher's Name Total Birds/ thefile: .ascid /thebirds.dat/ ; .entry start,^m<> openin watch, thefile ; Open the file screenout s, title ; Display titles top: filein watch, s, last ; Read last name beof watch, fini ; Exit on eof movab last, r6 ; Replace comma strlen last, r1 addl2 r1, r6 movb #^a/ /, -(r6) filein watch, s, first ; Read first name filein watch, i, r10 ; Make first count ; be the total movl #4, r6 ; Set loop counter again: filein watch, i, count ; Read a bird count addl2 count, r10 ; Add to total acbl #1, #-1, r6, again screenout s, first ; Display first name screenout c, <#^a/ /> ; One space screenout s, last ; Display last name strlen first, r6 ; Display sufficient strlen last, r7 ; spaces to fill out addl2 r6,r7 ; to 25 characters incl r7 subl3 r7,#25,r7 ; Display one space shift: screenout c, <#^a/ /> ; at a time sobgtr r7, shift screenout i, r10 ; Display total count screenout s, crlf ; Finish the line brw top fini: closein watch $exit_s .end start