Is there any easy way (simple) way to flip array,
for example Arr1 4,13,2,8,5 to become Arr1 5,8,2,13,4
just simple command not to use whole procedure to exchange numbers .. just to change the start of the array or something .. ?
thanks
well - not really
i mean - there is no special instruction intended for that
you just have to write a little loop that picks up a byte at each end, swaps them, then moves toward the center for the next one
something like this...
mov di,offset Arr1
mov si,offset Arr1+sizeof Arr1-1
swap_loop:
mov al,[si]
mov ah,[di]
mov [di],al
mov [si],ah
inc di
dec si
cmp si,di
ja swap_loop
well, that's one way to do it - lol
start reading from the end?
lol drizz - you are starting to sound like JJ
i am guessing it is a numeric string that he wants to display - lol
i would try building it the opposite direction to begin with :bg
listen to me - now i am starting to sound like JJ - lol
http://www.masm32.com/board/index.php?topic=12816.msg98960#msg98960
There's one precaution you should take with Dave's suggested procedure: either
i) make sure the ES segment register is identical to the DS segment register (DI defaults to the ES segment unless specified otherwise)
or
ii) include DS as a segment override when using the DI register, such as
mov ah,ds:[di]
mov ds:[di],al
QuoteDI defaults to the ES segment unless specified otherwise
Only on string ops, surely? The only one to watch for is any access to [bp] which defaults to SS.
DI references ES only for string instructions - for other instructions, it references DS
what sinsi said - i just wanted to clarify for MGG
oh Ok I guess I will use another way to solve the problem that one seems too dificult. DednDave I am trying to code the 3rd method for Bubble sort and thinking of ways to make it possible.