COMP1521 Assignment 1 Scrolling Text
to give you experience writing MIPS assembly code
to give you experience with functions in MIPS
to give you experience with data and control structures in MIPS
A common sight in shops is a grid of LEDs where text scrolls across the grid, something like …The aim of this assignment is to complete a MIPS program that can scroll alphabetic text strings like theabove video.
Create a private directory for doing the assignment, and put the assignment files in it by running thefollowing command:$ u n z i p / h o m e / c s 1 5 2 1 / w e b / 1 8 s 2 / a s s i g n m e n t s / a s s i g n 1 / a s s i g n 1 . z i pIf you’re working on this at home, download the ZIP file and create the files on your home machine. It’sfine to work on your own machine but remember to always test your code on the CSE machines beforesubmitting.The above command will create the following files:MakefileA file to control compilation of scroll.c.
It is not critical for the MIPS assembler part: it creates theexecutable C program to give you an exemplar, and can produce the exe.s file.scroll.cA complete solution, written in C. Your goal is to write a MIPS assembler program to copy thebehaviour of this program.chars.hThe array of big characters used in producing the scrolling text. This is #include’d in scroll.c.scroll.sA partly complete solution to the assignment, written in MIPS assembler.chars.sA MIPS version of the array of big characters used in producing the scrolling text. This file requiresno modification.Initially, it would be worth compiling the C program and running it on some examples to get a feel for itsbehaviour. The compiled C program, called scroll, expects a single command-line argument: the textstring to be scrolled.You can compile and run the C program (scroll) as follows:
What the scrolling program should do, whether implemented in MIPS or C:check the command-line argument (< 100 chars, only letters and spaces)create a buffer containing big versions of the characters in argvadd part of the content of the big-char buffer into the display buffer, starting at starting_poswrite the contents of the display buffer to standard outputrepeat, moving one column to the left each time, until the message scrolls of the left of the displayBoth the C and the MIPS programs are structured the same, with a main function to handle thecommand-line arguments and then run the scrolling.
The programs also have the same set of lowerlevelfunctions. In scroll.c, there are comments describing the purpose of each function and the codeis hopefully clear enough that you can understand how each function works.The diagram below shows the major data structures used by the programs:theString holds a copy of the string from argvbigString holds a copy of theString in big characters and with one column of spacebetween adjacent big charactersdisplay is where characters are placed before being written out to the screenall_chars[52*9*9] array containing representation of ‘A’-‘Z’ and ‘a’-‘z’ as big chars (not shown inthe diagram; defined in the chars.s file)
The aim of this exercise is to complete the supplied MIPS program skeleton (in the file scroll.s) tobehave exactly like the C program (in scroll.c). You should not change the chars.s file; treat itscontents as a read-only data structure.In scroll.s each function has comments to:indicate which registers the function usesindicate which registers the function overwrites (clobbers)give a mapping between local variables in the C code and registers in MIPSNote that these are suggestions only; you can use whatever registers you like, provided that you saveand restore any $s? registers that you overwrite in the function code. And, of course, provided that thecode behaves the same as the C code.
To save you some time, we have included function prologues and epilogues in some functions. Thesesave and restore registers $fp, $ra, and any $s? registers that the function happens to use, and alsomaintain the stack.
You can use these as templates for how to implement the prologue and epilogue inthe functions that do not provide them.Some of the functions from scroll.s are already implemented, but others require you to write MIPSassembler for them.
Here’s a rundown of the functions in scroll.s and their status:main Partly complete, including the epilogue and prologue, and the command-lineargument checking.setUpDisplay Function prologue and epilogue ok. ToDo: function body.showDisplay Function prologue and epilogue ok. ToDo: function body.delay Already complete, but you can tweak the numbers if you want, to speed up orslow down the animation.isUpper ToDo: function prologue and epilogue, and function body.isLower Already complete (and makes isUpper very easy).
EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!
E-mail: firstname.lastname@example.org 微信:easydue