In the IA-32 program in Figure 3.44, in-line code is used to read a line of charac-

Question:

In the IA-32 program in Figure 3.44, "in-line" code is used to read a line of charac- ters and display them. Rewrite this program in the form of a main program that calls a subroutine named GETCHAR to read a single character and calls another subrou- tine named PUTCHAR to display a single character. The addresses INSTATUS and DATAIN are passed to GETCHAR in registers EBX and EDX; and the main program expects to get the character passed back in register AL. The addresses OUTSTATUS and DATAOUT and the character to be displayed are passed to PUTCHAR in registers ESI, EDI, and AL, respectively. Any other registers used by either subroutine must be saved and restored by the subroutine using the processor stack, whose pointer is register ESP. Storing the characters in memory and checking for the end-of-line character CR is to be done in the main program.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Organization

ISBN: 9780072320862

5th Edition

Authors: V Carl Hamacher, Carl Hamacher, Zvonko G Vranesic, Safwat G Zaky

Question Posted: