I am using Easy68k to write an assembly program, where I have to write a script for searching a number inside a file with numbers.
File numbers4.txt :
1
2
3
4
5
6
7
9
11
12
13
14
My Code :
ORG $1000
START: ; first instruction of program
*------------File Handling ------------*
lea filename, a1
move #51, d0
trap #15
move.l #filesize, d2
lea buffer, a1
move #53, d0
trap #15
*------------Save Address in A1------------*
movea.l a1, a3 ; pointer for file values
*------------Searching Value Loop------------*
clr.l d3 ; value at index
search move.b (a3)+,d3
*-- Compare Here --*
next cmpi.b #$FF,d3
bne.s search
* Put program code here
SIMHALT ; halt simulator
* Put variables and constants here
org $2000
filename dc.b 'numbers4.txt',0
buffer ds.w 80
filesize dc.b 80
END START ; last line of source
The file values loaded to the memory :
I am stuck at the part where I have to compare values. I know how to compare single digit values 0-9 (ie : subtract 30) to hex but how do the compare double digit or beyond with hex? like how to a check if hex "0B" is one of the ascii values (31 31) that is in the memory. Or Perhaps my approach is incorrect I am not sure.
I am a newbie so my apologies if I am missing something obvious. Please help