CS 210 PROJECT #4 Due: Noon Friday 04/13/2007 This project acquaints students with facilities for manipulation of character-strings and text-files using the GNU/Linux assembly language. PROBLEM STATEMENT Write an assembly language program (named 'skeleton.s') that allows users to quickly create the 'boilerplate' source-code for a new assembly language application, following a style-format that would be suitable to use for future project-submissions in this course. (An example for such a program-skeleton is shown on the back of this page.) Your user should be allowed to provide a primary filename for the new source-code file by supplying a command-line argument, like this: $ ./skeleton xxx Here 'skeleton' is the name of your project's executable, and 'xxx.s' is the name that your program should use for the output-file it creates. SPECIFIC REQUIREMENTS (1) The output-file should have read-write permissions for all users; (2) The output-file's name should appear in an early comment-line; (3) Your name as programmer should automatically appear as a comment; (4) Instructions for assembling and linking should appear as comments; (5) Your output-file should include both .data and .text section; (6) Your output-file should declare '_start' as a global symbol; (7) Every program-label (e.g., '_start:') should be left-justified; (8) Every statement's opcode-field should be indented by 8 columns; (9) Every statement's operand-field should be indented by 16 columns; (10) Every statement's comment-field should be intended by 40 columns; (11) Your output-file should include an .end directive; (12) Your output-file should assemble and link without any errors; (13) Your output-file should be able to be executed without errors; (14) Your skeleton tool should not overwrite any existing files; (15) Your skeleton tool should show suitable diagnostic messages; (16) Your tool should not accept arguments longer than 12-characters; EXTRA CREDIT You will receive extra credit for your work on this project if your 'skeleton' tool automatically includes the current date as a comment in its output-files. (We learned how to compute the date in Project 1). WHAT TO SUBMIT As usual, copy your project's files into your '/submit' directory, and turn in the printout of your 'skeleton.s' file to your Instructor's mailbox in room Harney-222, together with a printout of sample output. ________________________________________________________________________ Allan B. Cruse University of San Francisco Spring 2007 //------------------------------------------------------------------ // example.s // // // // to assemble: $ as example.s -o example.o // and to link: $ ld example.o -o example // // programmer: // date begun: DD MMM YYYY //------------------------------------------------------------------ # manifest constants .equ sys_EXIT, 1 # system-call ID-number .section .data .section .text _start: # terminate this program mov $sys_EXIT, %eax # system-call ID-number xor %ebx, %ebx # return 0 as exit-code int $0x80 # invoke kernel service .global _start # make entry-point public .end # no more to be assembled