1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

    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
     
    Last edited by a moderator: May 5, 2013

Share This Page