This is what i came up with. FC which takes a few arguments.
PAddr (Copy from addres)
Len (Number of characters to be copied)
DbNo (DB to copy to)
DbbNo (Offset within DB to copy to)
PAddr (Copy from addres)
Len (Number of characters to be copied)
DbNo (DB to copy to)
DbbNo (Offset within DB to copy to)
Code:
L DW#16#80000000 // P-Area
L #PAddr // P-Address to start copy from
SLD 3 // Byte.Bit orientation
OD // Complete address
LAR1 // Store address in AR1
L #Db_No // Copy to DB
T #L_Db_No // Typecast to Word
OPN DB [#L_Db_No] // Open DB
L P#1.0 // Pointer 1 byte
L #Dbb_No // Startaddress, copy to
*D // Pointer to startaddress
LAR2 // Store in AR2
L #Len // StrLen to copy
T DBB [AR2,P#0.0] // String max len = Len
T DBB [AR2,P#1.0] // String curr len = Len
TAR2 // AR2 -> ACCU
L P#2.0 // Start of actual string
+D // Calculate address
LAR2 // Store in AR2
L #Len // Prepare index
_001: T #iLoopCnt // Store index counter
L B [AR1,P#0.0] // Copy 1 char from P-Area
T DBB [AR2,P#0.0] // Store 1 char in DB
TAR1 // Curr. copy from addr to ACCU
L P#1.0 // Increase address
+D // By 1
LAR1 // And store result in AR1
TAR2 // Curr. copy to address
L P#1.0 // Increase address
+D // By 1
LAR2 // And store result in AR2
L #iLoopCnt // Load index counter
LOOP _001 // Loopa if greater than zero