7 REVERSE$

This routine reverses all characters in a string.

A%=7:CALL&4083,string$

All arguments are passed by reference and must be either movable strings or fixed strings. You may pass multiple arguments at once. Other types are ignored.

The following program:

10 hello$="Hello,"
20 DIM world 30:$world="World!"
30 A%=7:CALL&4083,hello$,$world
40 PRINT hello$'$world

would output:

,olleH
!dlroW

BASIC wrapper function

You can wrap up the routine as a standard BASIC function using the following snippet:

DEFFN_REVERSE$(s$)LOCALA%:A%=7:CALL&4083,s$:=s$

You could then invoke it like this:

PRINT FN_REVERSE$("Hello, World!")

which would output

!dlroW ,olleH