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.
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 ,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 ,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 ,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 ,0
   
disp:
    mov ah,02h
    mov dx,10
    int 21h
    mov dx,13
    int 21h
    mov bx,head
    mov ah,02h
    mov dx,
    int 21h

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

exit:
    mov ah,4ch
    int 21h

end




Posted on 2011-04-07 04:27:19 by nitsakh