From: almas on
OK : i add dec DI, all ri right !
Below the code.... but why a push and a pop ?

mov cx, byte size_file
mov si, offset come_from ; 1st file
mov di, offset go_to ; the new file

push ds ; What do thoose 3 lines ?
pop es
cld

mov al, "*" ; Star is not modified in Dos and Windows

work:
movsb ; copy byte from ds:si to es:di
dec di
scasb ; check byte at es:di
jz jmp_loop ; DI = Al ?
inc word calculate_new_size
jmp_loop:
loopnz work ; repeat if more and not inverted ?
dec di ; backup to overwrite inverted ?
inc cx ; adjust cx for loop
loop work ; repeat if more, exit if not
inc di ; adjust dx for exit

mov dx, offset come_from
mov ah,9
int 21h
mov dx,offset go_to
int 21h
int 20h

size_file db: ,20h
calculate_new_size db: ,0,0,0,0
come_from db: " * Rod**** *Pem**ber*ton* *!*" ,0Dh,0Ah,24h
go_to db: " " ,32,32,32

It just copy Rod Pemberton 0D,0A and $
All is right !

Regards
Almas






"Rod Pemberton" <do_not_have(a)nohavenot.cmm> a �crit dans le message de news:
fts1vu$lpn$1(a)aioe.org...
> "almas" <almes(a)naburo.com> wrote in message
> news:4801477e$0$868$ba4acef3(a)news.orange.fr...
>> I try the code of Rod
>> in input i have " Text" in output i have "T e x T "
>> Beteewn each letter a space ( 20h)
>>
>
> Ha! Well, I said it was untested... I see that it probably needs "dec
> di"
> between movsb and scasb. :-(
>
>
> Rod Pemberton
>


From: almas on
Hi every body.

.... about the idea of Rod, now, i add bytes
I replace the * by Space##
I would just add two ##
At the end of the text, i have strange thinks.

Below : what i have :

1st line the "original"
2nd line what i obtain

* Rod**** *Pem**ber*ton* *!*
* ## Rod* ##* ##* ##* ## * ##Pem* ##* ##ber*�##ton*'## *�##!*)##

i do rod.com > rod.txt



mov cx, byte size_file
mov si, offset come_from ; 1st file
mov di, offset go_to ; the new file

push ds ; What do thoose 3 lines ?
pop es
cld
mov al, "*" ; Star is not modified in Dos and Windows

work:
movsb ; copy byte from ds:si to es:di
dec di
scasb ; check byte at es:di
jz jmp_add ; DI = Al ?
inc word calculate_new_size
jmp_loop:
loopnz work ; repeat if more and not inverted ?
dec di ; backup to overwrite inverted ?
inc cx ; adjust cx for loop
loop work ; repeat if more, exit if not
inc di ; adjust dx for exit

mov dx, offset come_from
mov ah,9
int 21h
mov dx,offset go_to
int 21h
int 20h

jmp_add:
push cx
mov cx,0003
add_it:
inc di
mov byte [di], "#"

inc word calculate_new_size
loop add_it
pop cx
jmp short jmp_loop

size_file db: ,20h
calculate_new_size db: ,0,0,0,0
come_from db: " * Rod**** *Pem**ber*ton* *!*" ,0Dh,0Ah,24h
go_to db: " " ,32,32,32

Regards
Almas

"Rod Pemberton" <do_not_have(a)nohavenot.cmm> a �crit dans le message de news:
fts1vu$lpn$1(a)aioe.org...
> "almas" <almes(a)naburo.com> wrote in message
> news:4801477e$0$868$ba4acef3(a)news.orange.fr...
>> I try the code of Rod
>> in input i have " Text" in output i have "T e x T "
>> Beteewn each letter a space ( 20h)
>>
>
> Ha! Well, I said it was untested... I see that it probably needs "dec
> di"
> between movsb and scasb. :-(
>
>
> Rod Pemberton
>


From: Rod Pemberton on

"almas" <almes(a)naburo.com> wrote in message
news:4801f23f$0$870$ba4acef3(a)news.orange.fr...
> OK : i add dec DI, all ri right !
> Below the code.... but why a push and a pop ?
>
> mov cx, byte size_file
> mov si, offset come_from ; 1st file
> mov di, offset go_to ; the new file
>
> push ds ; What do thoose 3 lines ?
> pop es
> cld
>

First two set es equal to ds. es and ds are the segments used by the string
instructions. ds should be set to your application by DOS.

The third sets the memory direction that the string instructions work: up or
down. cld causes them to increment si and di. std causes them to decrement
si and di.


Rod Pemberton

From: Rod Pemberton on
"almas" <almes(a)naburo.com> wrote in message
news:4802107d$0$874$ba4acef3(a)news.orange.fr...
> Hi every body.
>
> ... about the idea of Rod, now, i add bytes
> I replace the * by Space##
> I would just add two ##
> At the end of the text, i have strange thinks.
>
> Below : what i have :
>
> 1st line the "original"
> 2nd line what i obtain
>
> * Rod**** *Pem**ber*ton* *!*
> * ## Rod* ##* ##* ##* ## * ##Pem* ##* ##ber*�##ton*'## *�##!*)##
>
> i do rod.com > rod.txt
>
> mov cx, byte size_file
> mov si, offset come_from ; 1st file
> mov di, offset go_to ; the new file
>
> push ds ; What do thoose 3 lines ?
> pop es
> cld
> mov al, "*" ; Star is not modified in Dos and Windows
>
> work:
> movsb ; copy byte from ds:si to es:di
> dec di
> scasb ; check byte at es:di
> jz jmp_add ; DI = Al ?
> inc word calculate_new_size
> jmp_loop:
> loopnz work ; repeat if more and not inverted ?
> dec di ; backup to overwrite inverted ?
> inc cx ; adjust cx for loop
> loop work ; repeat if more, exit if not
> inc di ; adjust dx for exit
>
> mov dx, offset come_from
> mov ah,9
> int 21h
> mov dx,offset go_to
> int 21h
> int 20h
>
> jmp_add:
> push cx
> mov cx,0003
> add_it:
....

> inc di
> mov byte [di], "#"
>

Are those two reversed?

mov byte [di], "#"
inc di

That will probably output ### for each *. You might want to change this:

> jmp_add:
> push cx
> mov cx,0003
> add_it:
> inc di
> mov byte [di], "#"
>
> inc word calculate_new_size
> loop add_it
> pop cx
> jmp short jmp_loop

To this:

> jmp_add:
mov byte [di], " "
inc di
> push cx
mov cx,0002
> add_it:
mov byte [di], "#"
inc di
>
> inc word calculate_new_size
> loop add_it
> pop cx
> jmp short jmp_loop


I would've done the Space## in the movsb-scasb loop above, probably using
string instructions. I have to leave. So, maybe, I'll post later.


Rod Pemberton

First  |  Prev  | 
Pages: 1 2 3
Prev: Replace bytes
Next: Audio processing via GPU