xseg kstr: ds 30 cseg at 0 jmp _start istr: db "This programmator",0 _start: // initializing mov R0, #0 // R0 is used for input str offset counter mov dptr, #kstr // Saving 16-bit address of output str into DPTR mov R2, dpl // And saving dptr in R2 and R3 mov R3, dph __loop: mov DPTR, #istr mov a, R0 movc a, @a+DPTR jz __end // null-terminator? end mov dpl, R2 // Restoring sabed address in DPTR mov dph, R3 movx @DPTR, a cjne a, #'r', __notr // if not 'r', skipping inserting of letter inc DPTR // next letter mov a, #' ' // will be a ' ' movx @DPTR, a __notr: inc DPTR // Inc DPTR anyway mov R2, dpl // and save mov R3, dph inc R0 // Int input string pointer jmp __loop __end: end