org $3000 START * Test main; it's NOT part of the solution: * macro for printing string pstr MACRO lea \1,a1 move.l #13,d0 trap #15 ENDM _main: pstr MSG1 pstr MSG2 pea MSG1 jsr _yell pstr MSG1 ; no, so safe to print adda.w #4,sp move.l #9,d0 ; exit trap #15 ******************************************************************************* * Begin SOLUTION to midterm practice #4 ******************************************************************************* _yell: move.l 4(sp),a0 ; msg loop move.b (a0),d0 beq exit ; exit if end of string cmp.b #'a',d0 bcs skip ; don't modify if below 'a' cmp.b #'z',d0 bhi skip ; or above 'z' subi.b #$20,d0 ; upper to lower move.b d0,(a0) ; modify in place skip adda.w #1,a0 bra loop exit rts ******************************************************************************* * End SOLUTION ******************************************************************************* * Grading: * o full credit for an essentially correct implementation with a few * syntax errors * o 3/4 credit for an essentially correct main loop * -1/4 if forgot check for lowercase * o 1/8 credit for an essentially correct function entry and exit * o 1/8 credit for an essentially correct loading of the argument * Many other correct implementations are of course possible. MSG1 dc.b 'Hello Universe! Here I am.',0 MSG2 dc.b 'Hello?',0 end START