; concantenate string pointed by stack to string pointed by dptr strcat: pop 7 ; hi ret pop 6 ; lo ret sc4: movx a,@dptr ; find end of string jz sc3 ; got it inc dptr ; next char sjmp sc4 sc3: mov r0,dpl ; r0 = lo destination mov dpl,r6 ; dpl = lo source mov r6,dph ; r6 = hi destination mov dph,r7 ; dph = hi source sc1: mov p2,r6 movx a,@dptr inc dptr jz sc2 ; all done movx @r0,a inc r0 mov a,r0 jnz sc1 inc r6 ; next page sjmp sc1 sc2: movx @r0,a ; terminate string push dpl ; lo ret push dph ; hi ret mov dpl,r0 mov dph,r6 ret