Re: All is right !
- From: "almas" <almes@xxxxxxxxxx>
- Date: Mon, 21 Apr 2008 11:19:41 +0200
Hello.
My aim : i want remove 2 bytes if they are equal.
So, it will reduce the size of the file.
If this way is easy, OK
If if the file have two bytes similars... and replace each byte by ~ , or an
other particular value : OK
Just the ascii to remove or replace have value from 22H to 2Fh
But, i discovered that i have also to remove bytes if i can find them 3
times or more.
So for 3 or more, it ca be letters.
The final aim is to have a file, and just keep the "Text-Ascii"
So by example : %% becomes ~ or ~ ~ or nothing !
%%% : do the same 1, 2, or 3 ~ or nothing
But now i identify if i have eee or sss or kkk remove into ~
Sure that in a french word, il will never find 3 sames letters.
I accept the risk of a " www.my_web.com "
Below, you can find the try. ( it is not usefull )
I built others versions... with out correct work.
mov ah,9
mov dx,offset tester ; display original characters
int 21h
mov cx,3Eh
mov si, offset tester
myloop:
lodsb
nop
nop
cmp al,22h
jb next ; scan ascii from 22h to 2Fh
cmp al,2Fh
ja next
cmp cx,1 ; take care about CX and the loop
jbe next
mov ah,al
lodsb
dec cx ; ajust SI and CX
cmp al,ah
jnz next
mov al,126
mov [si],al
call mycall
dec si
inc cx ; ajust SI and CX
xchg ah,al ; il will have the value "7E7Eh" in AX
next:
mov [si],al
call mycall
inc si
loop myloop
nop
nop
mov dx,offset tester
mov ah,9
int 21h
mov dx, offset here
int 21h
int 20h
mycall:
db: 0A3 ; will do mov [here],ax
out_put_buffer db: ,92h,01 ; will do A3 92 01
inc byte out_put_buffer
ret
tester db: "!0!!0###! 0##0%%0(((*()0**0))0++-+0--0>>0==0<<>=0<??¨? 0'''0---"
db: ,10,13,36
here db: " "
db: ,10,13,36
-------------- other version -------------
myloop:
lodsb
nop
cmp al,22h
jb next ; scan ascii from 22h to 2Fh
cmp al,2Fh
ja next
cmp ah,al
jnz next
mov al,126
mov [si],al
call mycall
dec si
inc cx
next:
mov [si],al
mov ah,al
call mycall
inc si
loop myloop
nop
mov dx,offset tester
mov ah,9
int 21h
mov dx, offset here
int 21h
int 20h
mycall:
db: 0A2h ; will do mov [here],al
out_put_buffer db: ,87h,01 ; will do A2 87 01 mov [here+?],al
inc byte out_put_buffer
ret
tester db: "!0!!0###! 0##0%%0(((*()0**0))0++-+0--0>>0==0<<>=0<??¨? 0'''0---"
db: ,10,13,36
here db: " "
db: ,10,13,36
------- same result : do some thing, but.... not right ---
"Wolfgang Kern" <nowhere@xxxxxxxx> a écrit dans le message de news:
fuheoc$g2j$1@xxxxxxxxxxxxxxxxxxxxxxxx
almas wroter:
Sure, at the last line "you are a comment":)
But i did not found any instruction called Wolfgang :-)
Yes, i coult try to igore errors, so i can shutdown some bytes.Ok.
May be, i will do it, actualy i prefer that the COM file can detect
errors
a run correctly
.... / ....
Now, i'm working on an other goal.
The aim is if i have two ascii
between 22h and 2Fh ( i can identify it )
and if the next ascii have same value, i remove it into "~"
Example : (( become ~ ~
but ( * stay (*
### become ~ ~ ~
I try .... and have troubles
If i put ##(*) i obtain ~##(**
or i have in others version ~ ~ ~*)
I fact the next byte keep the value of the byte before.
Not seeing your attempts I can only guess ...
and I'm not sure to understand what it shall do.
A) You like to replace two equal characters with 7eh,20h ("~ ") ?
B) or is your desire to reduce the string size by replacing doubles
with single "~"-bytes ?
Version A) should be simple enough ...
remember the location of the first and write 207eh (endianess!)
to this location if a match occured (advance the pointer by two).
but for B) you also need to move string-parts and adjust its size.
The next step : destroy all the ~
How to destroy a byte ? :)
replace it with 20h? or remove it ?
I spend a large part of saturday and obtain "funny" ; stranges results
Learning by doing can be funny, but it is for sure the right way
for those who like to learn about all details at the lowest level.
Keep on your way! It may sound like a slow way, but what you learn
with this method will remain solid.
__
wolfgang
.
- Follow-Ups:
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- References:
- All is right !
- From: almas
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- From: almas
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- All is right !
- Prev by Date: Re: All is right !
- Next by Date: Re: Linking TASM objs with current C++ stuff and linkers
- Previous by thread: Re: All is right !
- Next by thread: Re: All is right !
- Index(es):
Relevant Pages
|