Ads

Saturday 26 October 2013

AVL with file handling

AVL program with file handling.

https://drive.google.com/file/d/0BxZLLe3YK34xWE1qWE5FNlVnbkU/edit?usp=sharing

CREDITS -Omkar Patil

1 comment:

  1. SECTION .data

    msg1 : db "Enter two nos:",10
    len1 : equ $-msg1

    msg2 : db "The addition is "
    len2 : equ $-msg2

    SECTION .bss

    num1 resb 4
    num2 resb 4
    count1 resb 1
    count2 resb 1
    count3 resb 1

    SECTION .text

    global _start
    _start:
    mov eax,4
    mov ebx,1
    mov ecx,msg1
    mov edx,len1
    int 0x80


    label1: mov eax,3
    mov ebx,1
    mov ecx,num1
    mov edx,4
    int 0x80

    mov byte[count1],02h
    mov ebx,[num1]
    SUB ebx,3030h
    lp: cmp bl,09
    jb dig
    sub bl,07h
    dig: rol bx,08
    dec byte[count1]
    jnz lp
    rol bl,4
    add bl,bh
    mov bh,00h
    mov [num1],ebx

    label2: mov eax,3
    mov ebx,1
    mov ecx,num2
    mov edx,4
    int 0x80

    mov byte[count2],02h
    mov ebx,[num2]
    SUB ebx,3030h
    lp1: cmp bl,09
    jb dig1
    sub bl,07h
    dig1: rol bx,08
    dec byte[count2]
    jnz lp1
    rol bl,4
    add bl,bh
    mov bh,00h
    mov [num2],ebx

    adc ebx,[num1]

    display:mov byte[count3],02h
    mov ecx,ebx
    and cx,000Fh
    and bx,00F0h
    ror bl,04
    mov bh,cl
    lp2: cmp bl,09
    jb dig2
    add bl,07h
    dig2: rol bx,08
    dec byte[count3]
    jnz lp2
    add bx,3030h
    mov[num1],ebx

    mov eax,4
    mov ebx,1
    mov ecx,num1
    mov edx,2
    int 0x80




    exit: mov eax,1
    mov ebx,0
    int 0x80

    ReplyDelete