x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4563
Number of posts: 16029

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Linked List in ASM Posted by nitsakh on 7 Apr 2011 at 2:58 AM
I want to write a simple linked list program with ASM .
Here's the code which I have tried to write(presently only for single digit numbers) ! However,it works only for 3 numbers and that too has sometimes some errors. I am new to assembly language.
So please help me as to what I am supposed to do,as I am in fix !


.model small

.data
	m1 db 10,13,'Enter Data :: $'
    m2 db 10,13,'Continue ?? $'
    head dw 0
.code
	mov ax,@data
	mov ds,ax

    mov bx,1
    mov ah,48h
    int 21h

    mov head,ax

    mov dx,offset m1
    mov ah,09h
    int 21h
    mov ah,01h
    int 21h
    xor ah,ah
    mov bx,head
    mov [bx],ax
    mov di,head

    mov dx,offset m2
    mov ah,09h
    int 21h
    mov ah,01h
    int 21h
    cmp al,'y'
    je loop1
    cmp al,'Y'
    je loop1
    jmp below
       
loop1:
    mov bx,1
    mov ah,48h
    int 21h

    xor si,si
    mov [di+2],ax
    xor di,di
    mov si,ax
    mov dx,offset m1
    mov ah,09h
    int 21h
    mov ah,01h
    int 21h
    xor ah,ah
    mov word ptr [si],ax
    mov di,si
    
    mov dx,offset m2
    mov ah,09h
    int 21h
    mov ah,01h
    int 21h
    cmp al,'y'
    je loop1
    cmp al,'Y'
    je loop1

below:
    mov word ptr [di+2],0
    
disp:
    mov ah,02h
    mov dx,10
    int 21h
    mov dx,13
    int 21h
    mov bx,head
    mov ah,02h
    mov dx,[bx]
    int 21h

lp:
    mov ah,02h
    add bx,2
    mov dx,word ptr [bx]
    int 21h
    cmp word ptr [bx+2],0
    jnz lp

exit:
    mov ah,4ch
    int 21h

end




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.