Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Re: All is righ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 17 Topic 4954 of 5160
Post > Topic >>

Re: All is right !

by "Wolfgang Kern" <nowhere@[EMAIL PROTECTED] > Apr 16, 2008 at 05:08 PM

"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
 




 17 Posts in Topic:
All is right !
"almas" <alm  2008-04-14 23:40:35 
Re: All is right !
"almas" <alm  2008-04-15 17:15:44 
Re: All is right !
"Wolfgang Kern"  2008-04-16 17:08:30 
Re: All is right !
"almas" <alm  2008-04-16 22:07:50 
Re: All is right !
"almas" <alm  2008-04-16 23:53:23 
Re: All is right !
"almas" <alm  2008-04-16 23:28:50 
Re: All is right !
"Wolfgang Kern"  2008-04-17 12:54:06 
Re: All is right !
"almas" <alm  2008-04-17 20:52:19 
Re: All is right !
"Wolfgang Kern"  2008-04-18 23:34:34 
Re: All is right !
"Wolfgang Kern"  2008-04-19 11:10:44 
Re: All is right !
"almas" <alm  2008-04-19 16:08:24 
Re: All is right !
"almas" <alm  2008-04-19 21:00:53 
Re: All is right !
"Wolfgang Kern"  2008-04-20 09:38:04 
Re: All is right !
"almas" <alm  2008-04-20 11:11:40 
Re: All is right !
"Wolfgang Kern"  2008-04-21 09:03:12 
Re: All is right !
"almas" <alm  2008-04-21 11:19:41 
Re: All is right !
"Wolfgang Kern"  2008-04-22 12:08:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 23:24:17 CDT 2008.