1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

1's complement code not working ! help please

Discussion in 'Assembly Language Programming (ALP) Forum' started by rabir, May 4, 2013.

  1. rabir

    rabir New Member

    May 4, 2013
    Likes Received:
    Trophy Points:
    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
    Title Length of an array
    .model small
    .stack 100h
    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 ?
    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
            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_
            mov al,30h
            mov [si],al
            inc si
            jmp read
            mov al,31h
            mov [si],al
            inc si
            jmp read        
                  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
    Last edited by a moderator: May 5, 2013

Share This Page