|Help needed for ASCII code
|Page 1 of 1|
|Author:||DCKK84 [ Mon Aug 15, 2011 10:24 am ]|
|Post subject:||Help needed for ASCII code|
I am trying to figure out the assignment that I am given, the objectives are:
To compare 2 strings 'Computer Hardware' and 'Comppuuter Haardware'.
A string to store at $600 and a second string of equal length to store at $700. Having each string to end with $0D. Write an assembly program to determine whether the strings are identical. If they are identical, place $00 in data register D0. If they are not, place $FF in D0.
I have tried writing the program codes, but I can't make it produce the result that is needed.
X DC.W 'COMPUTER HARDWARE'
Y DC.W 'COMPPUUTER HAARDWARE'
MOVEA #X,A0 *A0 POINT AT BASE OF ARRAY X
MOVEA #Y,A1 *A1 POINT AT BASE OF ARRAY Y
CMP D1,D2 *COMPARE X AND Y
ELSE MOVE.W #$FF,D0
TRAP #15 ; halt simulator
END START ; last line of source
Sorry for my bad programming, badly need help over here. Thank you if you can help me with this set of program codes.
|Author:||profkelly [ Mon Aug 15, 2011 11:34 pm ]|
Use a loop to iterate through the strings character by character.
CMP D1,D2 *COMPARE X AND Y does a 16 bit compare. It should be
Stop the loop when the two characters being compared are different (the strings are not equal) or when $0D is reached on both strings (the strings are equal).
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group