Hi i have to make a program to these specs:
So far in stdio.asm you have subroutines which enable you to output and input single characters, and input a word sized number in hex. However, it would be nice to be able to output and input a string of characters.
So write 2 new subroutines which you add to stdio.asm to the following specification:
a)
GetString – inputs a string with echo (into a string in memory i.e. an array of char) from the keyboard until it encounters a cariage return character (note – not a line feed). This is because the <enter> key on the keyboard is encoded as a single carriage return character (not carriage return/linefeed). Thus you cannot look for linefeed as the input termination character.
The carriage return character you have found should not be stored with the rest of the string, it should be discarded. The input string should be placed in an array 256 bytes long. The start address of the destination character array should be passed as a parameter to the subroutine in DI. Very importantly you should ensure that the string of characters you have input is null terminated i.e. as in C put a byte value of 00H into the first byte after the end of the string. The subroutine should not corrupt any register values.
Remember to use the specialist string (array) instructions – although we are unable in this instance to use rep.
Also note that you can use the subroutine Getch that you wrote last week to input individual characters (it should be in stdio.asm).
b)
PutString – outputs to the console window the contents of a character array. The address of the start of the array should be passed to the subroutine in SI. The subroutine assumes that the string is null terminated. You can use the subroutine Putch that you wrote last week to output the individual characters.
c) Write some code in a separate program to test your subroutines. NOTE – PutString like PutHex does NOT output a newline so you will need to do this yourself if you want to put it on separate lines.
i have read all the material which has been given to us in class but i have no idea how to start and approach this any thing you guys can recommended to research?
I am guessing i would have to use some sort of loop with a counter and an array to store the word which has been input from keyboard an array of characters. When printing the out the string to screen you would use a loop again printing out each character in order.
do i have the right idea of how to do this or am i well off here if so can you offer some guidance please.
thankyou
So far in stdio.asm you have subroutines which enable you to output and input single characters, and input a word sized number in hex. However, it would be nice to be able to output and input a string of characters.
So write 2 new subroutines which you add to stdio.asm to the following specification:
a)
GetString – inputs a string with echo (into a string in memory i.e. an array of char) from the keyboard until it encounters a cariage return character (note – not a line feed). This is because the <enter> key on the keyboard is encoded as a single carriage return character (not carriage return/linefeed). Thus you cannot look for linefeed as the input termination character.
The carriage return character you have found should not be stored with the rest of the string, it should be discarded. The input string should be placed in an array 256 bytes long. The start address of the destination character array should be passed as a parameter to the subroutine in DI. Very importantly you should ensure that the string of characters you have input is null terminated i.e. as in C put a byte value of 00H into the first byte after the end of the string. The subroutine should not corrupt any register values.
Remember to use the specialist string (array) instructions – although we are unable in this instance to use rep.
Also note that you can use the subroutine Getch that you wrote last week to input individual characters (it should be in stdio.asm).
b)
PutString – outputs to the console window the contents of a character array. The address of the start of the array should be passed to the subroutine in SI. The subroutine assumes that the string is null terminated. You can use the subroutine Putch that you wrote last week to output the individual characters.
c) Write some code in a separate program to test your subroutines. NOTE – PutString like PutHex does NOT output a newline so you will need to do this yourself if you want to put it on separate lines.
i have read all the material which has been given to us in class but i have no idea how to start and approach this any thing you guys can recommended to research?
I am guessing i would have to use some sort of loop with a counter and an array to store the word which has been input from keyboard an array of characters. When printing the out the string to screen you would use a loop again printing out each character in order.
do i have the right idea of how to do this or am i well off here if so can you offer some guidance please.
thankyou