Due 10/27/95. Submit to Aric Stewart at stewarar@mathcs.carleton.edu Write an assembly language program for the Motorola 680x0 processors that will: 1. Prompt the user to enter an integer 2. Read the user's input 3. Translate the input (an ASCII string) into an integer internally, assuming the typed string represented a base 10 integer 4. Square the integer 5. Translate the square back to an ASCII string and print it out In addition to the routines putchar, _getchar, and putstring I demonstrate in the example program (see the CS207 home page), you should write the routines getstring, atoi, and itoa, as described here. Once those three routines are written, this program will be a snap to complete. | | Subroutine: getstring | | Preconditions: a0 contains the address of a sufficiently | large buffer to contain the user's typed input. | | Postconditions: a0's value is unchanged. The buffer pointed | to by a0 now contains a null-terminated string corresponding | to a line of text typed by the user (or the first line of | a file, if standard input was redirected when the program | was called). getstring has read the newline character, but | has not stored it in the buffer. | | | Subroutine: atoi (Ascii TO Integer) | | Preconditions: a0 contains the address of a null-terminated | string. | | Postconditions: if the string was composed entirely of base-10 | digits, d0 now contains the corresponding integer. If the string | contained any non-digit characters, atoi makes no guarantess | regarding the contents of d0. | | | Subroutine: itoa (Integer TO Ascii) | | Preconditions: d0 contains an integer. a0 contains the address | of a buffer large enough to hold the ASCII base-10 representation | of the integer in d0. | | Postcondition: a0's value is unchanged. The buffer pointed to | by a0 now contains a null-terminated string, which is the | ASCII form of base-10 representation of the integer in d0. | d0 is also unchanged. |