Write an assembly program that reads characters from standard input until the “end of file” is reached. The input provided to the program contains A, C, T, and G characters. The file also may have new line characters (ASCII code 10 decimal), which should be skipped/ignored. The program then must print the count for each character. You can assume (in this whole assignment) that the input doe not contain any other kinds of characters. the X86 assembly program that simply counts how many A’s, C’s, T’s, and G’s the input string contain.
% ./hw5_ex1
ACCCTGG
^D
A: 1
C:3
T: 1
G: 2
%cat ./fugu.seq | ./hw5_ex1
A: 144210
B: 141094
C: 145356
D: 146900
%cat ./mouse.seq | ./hw5_ex1
A: 163053
C: 126396
T: 181707
G: 128964
It is tempting to use four individual counters in memory implemented as four distinct labels.You can do this,but it would be better to use instead an "array" of four counters.That is, a single label in the .bss segment such as: CounterArray resd 4.( That data in the .bss segment is initialised to zero).
One annoyance is that the A,C,T and G characters don't have consecutive ASCII codes. therefore, you can't use their ASCII codes as n index into an array of counters. You have to come up with some solution to deal with this and some of the possible solutions are easier than other.
Get Answers For Free
Most questions answered within 1 hours.