! difficulty rating
Write small leaf procedures (10-15 instructions) using solution template.
|
! ! SPIM Exercise 2.1 15 MinutesRun the strcpy() example in SPIM. Use this solution template to start. Step through the code and watch registers. ! ! SPIM
Exercise 2.2 15
MinutesModify strcpy() to work with Unicode (2-byte) strings. Assume that the string is terminated with the half-word 0. ! ! SPIM
Exercise 2.3 30-40
MinutesWrite the procedure int strlen(char s[]) which accepts an ASCII string s[] and returns its length. Load your procedure in SPIM to test it. Use this solution template. (Hint: write the C function first.) ! ! SPIM
Exercise 2.4 30
MinutesWrite the procedure char *toUpper(char s[]) which accepts an ASCII string s[] and changes it to uppercase. For example, if s[]="lower", then the procedure should make the string "LOWER". The procedure should return the same address passed as input. Load your procedure in SPIM to test it. Use this solution template [view]. (Hint: use andi with suitable mask to change to uppercase.) |