Phoebus R. Dokos writes: > >> I always thought that slices could work in reverse as well (and they > >> should actually) so eg. > >> > >> a$ = "hi" > >> b$ = a$ (2 TO 1) > >> > >> PRINT b$ should return "ih" but maybe it's just me :-) > >> > >> Phoebus > > Patience my boy! Marcel The Miracle Maker will crack this one > > eventually! > > > > Hehe that or crack our head for making these suggestions ;-) > Seriously though that would be a great improvement as it would eliminate > the need for a reverse function (Geoff would love that one as well I'd > imagine) > It's rather annoying to have to resort to LEN(String$)-1 iterations to > solve this :-)
It would be trivial to write your own m/c routine to do the job! Off the top of my head, something along the lines of get1string ;SB string on stack. a1->string move.w 0(a6,a1.l),d0 ;get len lea.l 2(a1,d0.w),a0 ;a0 -> end string lsr.w #1,d0 ;only need to swap half the string bra.s loop_end ;dont bother if 1 char or less loop move.b 2(a6,a1.l),d1 ;swap chars move.b 0(a6,a0.l),2(a6,a1.l) move.b d1,0(a6,a0.l) subq.l #1,a0 ;next pair addq.l #1,a1 loop_end dbra d0,loop returnstring ;reset a1 and return string to SB should work. Per