I need 2 procs, one that would reverse a string and another to get part of a string, like mid("whatever", 3,4), I know masm has midstr, but I want to learn how to write my own :) (btw I don't care for speed/size as of now, just anything thatll help me understand how to write them, the only thing I can write is strlen ^_^)
Posted on 2003-06-24 22:56:58 by KewLexX
Think of these functions as simple loops, and go from there.
Posted on 2003-06-24 23:21:30 by comrade
Well here is how easy it can be, a simple MID
(you did say, "I don't care for speed")



; Put in you data sections
.data
String db "The quick brown fox jumps over the lazy dogs back",0
.data?
Boofer db 50 dup(?)

[..snip..]

mov esi, OFFSET String
mov edi, OFFSET Boofer
add esi, 4 ; Start Here
mov ecx, 10 ; Length of SubString
rep movsb

invoke MessageBox,0,OFFSET Boofer,OFFSET Boofer,MB_OK


It returns 'quick brow'
Since you can write strlen then reversestr should be a breeze.

RobotBob
Posted on 2003-06-24 23:39:34 by RobotBob