Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   1's complement code not working ! help please (http://www.go4expert.com/forums/1s-complement-code-help-t29657/)

rabir 4May2013 23:56

1's complement code not working ! help please
 
Hi everyone
i'm new in assembly language.i try to code for 1's complement but not working.is there anyone who can detect my error

code is
Code:

Title Length of an array
.model small
.stack 100h
.data
msg0 db 0dh,0ah, 'Enter the binary value :  $'
msg1 db 0dh,0ah, 'the 1s complement form is: $'
str1 db 255 dup (?)
one db ?
two db ?
.code
main proc
mov ax,@data
mov ds,ax

lea dx,msg0
mov ah,09h
int 21h

lea si,str1 ; read a string
mov ah,01h

read:
        int 21h
        ;mov bl,al
       
        cmp al,0dh; carrage return
        je display; if input is a carrege return than jump display section

        cmp al,00h
        je _0_

        cmp al,01h
        je _1_

_0_:
        mov al,30h
        mov [si],al
        inc si
        jmp read

_1_:   
        mov al,31h
        mov [si],al
        inc si
        jmp read       



display:
           
              mov al,'$'
            mov [si],al
           
           
            lea dx,msg1
            mov ah,09h
            int 21h
           
            lea dx, str1
            mov ah,09h
            int 21h

            mov ah, 4ch
            int 21h
main endp
end main

thanks everyone


All times are GMT +5.5. The time now is 01:03.