Re: All is right !



Hi Wolfgang.

Note : if i have to replace [Ctrl - C] ascii 003 ; some programs refuse it.
Same for ascii [ ALT 10 ] or alt 6

Sure i can do a XOR 20h on each bytes of a file ; byte 0 become 20h
and i can move the Space...
then i do again XOR 20h.... and not modified bytes have again same value.

The idea is to type with numbers and letters
Example i type "50", the program write " P "
If i type "A8" the programm write " ¿ "

I can type 00 ; 01 ;02 ... 0E,0F 10,11,12.....and so long...FE FF
I just obtain One byte 0 to 0FFh

The byte falls at the location hexa... i catch it.
The next operation : find the byte a hexa_address and remove it.

With this part of programm i can choose the byte i will remove.
Before it, i had to build 256 tools... for each bytes.

I am sorry, but do not understand you want to do.

after
cmp al,41h jb error
cmp al,46h jb error
sub al,7 ; i can obtain 3Ah to 40h ( do" :" to " @ ") why ?

I do xor bx,bx so bx=0000
I have to save value of AX, so i put it into bx
then, i must have Ah=0 al =...? come from the lodsbyte

Yes : the character "d" and "u" make to gather the byte "DU"
So, i do "letter d" becomes "d *16" d = 0 to F
and i do d*16 + u U can also have value 0 to 0Fh

Right : for the low size ; cx, is not usefull
.... may be it could be or ah,bl

At the end, i just use one "$" for flag end of text.
the most important is text terminate by $

low_size:
mov cx,0016 *** where is this used ?
add ax,bx *** OR AL,BL ?
*** you have the lower nibble (4 bits) in AL now
and the higher nibble shifted (*16) and saved in BL.
Two hex-characters wont ever produce more than one byte.
It will work if you add AX,BX, but I'd use OR AL,BL
or does your DOS support Unicode ? :)
... then a mov AH,0 would do it.

txt db: "Use Asci2Hex" ,13,10 *** no $ here ?
hexa db: ,0,0,0 ,13,10,36
*** hexa db: 32,13,10,36
;the 'space' replaced by your single character ?

> [...]
After you're done with this Your next step could be a key-input
loop (ie: until ESC) instead of the command-line input ...
(INT21h or direct INT16h)
__
wolfgang



"Wolfgang Kern" <nowhere@xxxxxxxx> a écrit dans le message de news:
fu54pj$omk$1@xxxxxxxxxxxxxxxxxxxxxxxx

"almas" wrote:

Hi every body.

:) you sure mean "everybody" and not the hull I'm living in :)

Just a few comments marked with ***

If you remember, i would like to remove a byte in a file.
Rod; Franck ask answers.

Now, i build a part :
The spirit is : I type lettres " F " and " A " and i put the byte "
0FAh " in the file.
So for the next step, i can identify the byte i choose.

If some body have a better code, i will appréciate.
If some body have an other way to do it, i am also interrest.

Best regards
Almas


; i type the value of an ASCII...
; it put in a Byte this ascii
; this code can be run alone.

mov si,0082h ; i suppose i begin à 82h
*** OK if no command line were typed in at all ?
lodsb
cmp al,3Ah

*** what if one typed any of !"+-*().. or an ALT-num<30 ?
jb chiffre_d ; d for ten : ( forty, fivety, 60 and so long)
cmp al,41h ; is it an Hexa letter ?
jb error
cmp al,46h
ja error
*** > sub al,37h ; "A" > 0Ah "F" become 0Fh
*** > jmp short high_size
*** I'd replace the two lines above with sub al,07
*** a JMP costs more than one ADD and the code become shorter too
chiffre_d:
sub al,30h ; "0" > 00h "9" become 09h
high_size:
***> mov cx,0010h
***> mul cx ; get high position ascii*
OK it works, but why: "dx:ax = ax*16" ?
whouldn't SHL AL,4 (= *16 and clears low 4 bits also)
do what you want ? (00,01..0Fh becomes 00,10..F0h)

xor bx,bx
xchg ax,bx ; ax into bx
*** why clear and exchange ... mov bl,al ??

lodsb
cmp al,3Ah
jb chiffre_u : U like Unit
cmp al,41h
jb error
cmp al,46h
ja error
sub al,37h
*** > jmp short low_size
*** > chiffre_u:
*** same as mentioned above ...
sub al,30h
low_size:
mov cx,0016 *** where is this used ?
add ax,bx *** OR AL,BL ?
*** you have the lower nibble (4 bits) in AL now
and the higher nibble shifted (*16) and saved in BL.
Two hex-characters wont ever produce more than one byte.
It will work if you add AX,BX, but I'd use OR AL,BL
or does your DOS support Unicode ? :)
... then a mov AH,0 would do it.
mov offset hexa,ax
*** why two characters ? (the 2nd will be zero):"?" or so...
mov dx,offset hexa
jmp short display_it
int 20h *** when would this be executed ?

error:
mov dx,offset txt
display_it:
mov ah,9
int 21h
int 20h
txt db: "Use Asci2Hex" ,13,10 *** no $ here ?
hexa db: ,0,0,0 ,13,10,36
*** hexa db: 32,13,10,36
;the 'space' replaced by your single character ?

[...]
After you're done with this Your next step could be a key-input
loop (ie: until ESC) instead of the command-line input ...
(INT21h or direct INT16h)
__
wolfgang





.



Relevant Pages