|
Prev: Replace bytes
Next: Audio processing via GPU
From: almas on 12 Apr 2008 15:10 Hi every body. My aim : open a file, destroy particulars bytes Open a new file with not the particulars bytes. I try ... you can see below. Actualy, i copy a text with no * I have to coy from " here" X bytes described in out_put_buffer Next step Create a new file and copy X bytes mov cx, byte size_file mov si, offset come_from ; 1st file work: cmp byte [si], "*" jz next mov al,[si] inc word out_put_buffer db: 0A3 ; will do mov [here],ax out_put_buffer db: ,4Ch,01 ; will do A3 4C 01 inc word calculate_new_size next: inc si loop work nop jmp short texte calculate_new_size dw: ,0,0,0,0 ; nop nop nop size_file db: ,20h,00 come_from db: "ici* est *mon Te*XTe court* !" ,0Dh,0Ah,24h ; DEBUG can read thooses bytes above. ; but when debug read below.... bytes still have value 0 before_here db: ,0Dh,0Ah here db: ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 db: ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ; in this file Here is at address 014Ch so out_put_buffer is correct db: "$" nop nop nop nop nop nop ; many nop... nop ; the aim read a NOP nop nop nop texte: mov dx,offset come_from mov ah,09 int 21h xor ax,ax int 16h mov ah,9 mov dx,offset before_here int 21h int 20h
From: Frank Kotler on 12 Apr 2008 18:19 almas wrote: .... > inc word out_put_buffer > db: 0A3 ; will do mov [here],ax > out_put_buffer db: ,4Ch,01 ; will do A3 4C 01 Not after you've incremented it, it won't... You're kidding, right? Aside from distinguishing between an 8088 and an 8086, modifying code just before you execute it is generally a bad idea, although it may "look" clever. Best, Frank
From: almas on 12 Apr 2008 19:38 Hi every body. I have a solution... now i have to open file 1 read the bytes ; i will use SI register. I will put bytes in a place ( location in english ?) Then i have to open a new file and put the bytes in it Save new_file, close it ; close file 1 terminate. Below : the code. "destroy stars" ; i use A86 mov cx, byte size_file ; rescue after open file 1 mov si, offset come_from ; 1st file work: lodsb cmp al, "*" ; now i try it ! jz next db: 0A3h ; will do mov [here],ax out_put_buffer db: ,57h,01 ; will do A3 57 01 inc word calculate_new_size inc word out_put_buffer next: loop work mov dx,offset come_from mov ah,09 int 21h mov dx,offset before_here int 21h int 20h calculate_new_size dw: ,0,0,0,0 ; size_file db: ,26h,00 come_from db: "ici* est *mon* *Te**XTe c*o*u*rt* !" ,0Dh,0Ah,24h before_here db: ,0Dh,0Ah here db: ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 db: ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 db: ,0,0,0,0 ,0,0,0,0 In out put i obtain "ici est mon TeXTe" In english : here is my text with no star 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) It can be a good idea to do mov di,si anc cmp al,di with stosb and mosvb Thanks for Rod, Frank, Terence and others "helpers" Best regards Almas
From: Rod Pemberton on 13 Apr 2008 00:27 "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 13 Apr 2008 06:20
Hi Rod. It do not matter. Now, i have a new idea. Do the opposite : remplace a "�" by " ?*?" So it will have a larger size of file. Now, i do not need it, but, may be i will. I have an idea about i have to do : create: ; i do not descrite the mov dx, int 21h and others mov ah, 3Ch : create file i come here: mov ah,3D12h jb create mov handle2,ax mov ax, 4200h ; i get size of the new file mov bx, handle2 mov ax,4202h ; go to end of file out put mov ah,40h write bytes mov cx, buffer_size_file2 mov dx; offset of Destination ( called Here for me) mov ah,3Eh ; close file2 mov ah,3Eh mov bx, handle1 ; for close file 1 : rhe input int 20h : terminate Now, you have an idea about he structure i wa nt to do Best 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 > |