Help with assembler in Delphi 2
Hi
I'm busy writing a program that will eventually have to read millions of
lines of data (literally!) and convert the ASCII data into usable things
for printing out again, so I'm trying to optimise it heavily. One thing
that was holding things up was pos, which was mostly used for single
char checks so I wrote a single char version in Delphi with a for loop,
which helped a lot. However, I'd like to be able to write an assembler
version, which would look something like this in a 16-bit app: (skip
down to find the question, this is just to show you want I want)
asm
mov res, 0
les di, str {the string}
mov bx, di {save the start offset}
cld
mov cl, es:[di] {get the string length}
xor ch, ch
cld
mov al, ch {the character being searched for}
repne scasb
jne @end
sub bx, di {calculate distance scanned}
mov res, bx
end;
result := res;
However, I don't know much about the protected mode architecture other
than that memory addressing is totally different and so on. The question
is:
a) How do I load the address of the string
b) Given that, how does the code above need to be changed (scasb used
edi or something, doesn't it?)
Thanks in advance
Bruce
--
Please remove the ".nospam" from my address before replying
/--------------------------------------------------------------------\
| Bruce Merry (the Almighy Cheese) | bmerry at iafrica dot com |
| Proud user of Linux! | http://www.cs.uct.ac.za/~bmerry |
| Heavy, adj.: Seduced by the chocolate side of the force. |
\--------------------------------------------------------------------/