"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 ****fted (*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 sup****t 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


|