Re: All is right !
- From: "almas" <almes@xxxxxxxxxx>
- Date: Wed, 16 Apr 2008 22:07:50 +0200
Hi everybody...
Hi Wolfgang.
OK, body is the opposite of the back !
Sorry a speak english as i make files in ASM :-)
I will read the solution....and study it.
" je vais la lire au calme, l'étudier..." ... in french.
Sure, il put si,82h because I am the only one user... and know the
synthax., i just put 1 space after the command line.
The file i built is correct... but i do not know if it can work when add in
a more large programm.
"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)*** > sub al,37h ; "A" > 0Ah "F" become 0Fh
cmp al,41h ; is it an Hexa letter ?
jb error
cmp al,46h
ja error
*** > 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:***> mov cx,0010h
sub al,30h ; "0" > 00h "9" become 09h
high_size:
***> 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*** why clear and exchange ... mov bl,al ??
xchg ax,bx ; ax into bx
lodsb*** > jmp short low_size
cmp al,3Ah
jb chiffre_u : U like Unit
cmp al,41h
jb error
cmp al,46h
ja error
sub al,37h
*** > chiffre_u:
*** same as mentioned above ...
sub al,30h*** you have the lower nibble (4 bits) in AL now
low_size:
mov cx,0016 *** where is this used ?
add ax,bx *** OR AL,BL ?
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*** hexa db: 32,13,10,36
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
;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
.
- Follow-Ups:
- Re: All is right !
- From: almas
- Re: All is right !
- References:
- All is right !
- From: almas
- Re: All is right !
- From: almas
- Re: All is right !
- From: Wolfgang Kern
- All is right !
- Prev by Date: Re: Why is my nasm program killing itself?
- Next by Date: Re: All is right !
- Previous by thread: Re: All is right !
- Next by thread: Re: All is right !
- Index(es):
Relevant Pages
|