COAL Assignment 3
COAL Assignment 3
(A, B, C)
Fall 2017
Assignment-3
Submission: Wednesday 1st November (on xeon until labs are open)
Question 1:
Write a subroutine Trimmer that trims all the occurrences of string2 from string1 printed on video
screen. The subroutine takes the following parameters (in same order):
i. Row number where string 1 is printed on screen
ii. Column number where string 1 is printed on screen
iii. Length of string 1
iv. Offset (i.e. address) of string 2 in data segment
You can safely assume that String2 length is less than String1 length. You would have to calculate the
length of string 2 yourself. For example:
String 1 (on video screen): Hello world
String 2 (defined in ds): wor
After this subroutine string1 becomes:
Hello ldrld
(You can create other subroutines as well.)
Question 2:
Write a near procedure to copy a given area on the screen at the center of the screen without using a
temporary array. The routine will be passed top, left, bottom, and right in that order through the stack.
The parameters passed will always be within range the height will be odd and the width will be even so
that it can be exactly centered.
Question 3:
Update the strcmp subroutine of book, such that it returns 0 of two strings are equal, -1 if string 1 is
smaller than string 2 and 1 if string 1 is greater than string 2. (Strings are defined in data segment.)