problem with task in assembler 8086

Thread Starter

zemzi

Joined Dec 14, 2011
8
Matrix given in memory to print the spiral in opposite direction from clockwise (left column down the right lower range, right up column, a series of upper left, etc. until you get to the middle) in 8086 assembler
Rich (BB code):
  mov     ecx,0
        mov     cl,[QDM]
        mov     ebx,ecx
        mov     edi,Matrix
mSpiral:
        push    edi
 
        mov     al,[edi];Output [edi]
        push    ecx
 
        mov     edx,ecx
        mov     ecx,edx
        dec     ecx
        cmp     ecx,0
        jle     mSkD1
mD1:
        add     edi,ebx
        mov     al,[edi];Output [edi]
        loop    mD1
mSkD1:
 
        mov     ecx,edx
        dec     ecx
        cmp     ecx,0
        jle     mSkD2
mD2:
        inc     edi
        mov     al,[edi];Output [edi]
        loop    mD2
mSkD2:
 
        mov     ecx,edx
        dec     ecx
        cmp     ecx,0
        jle     mSkD3
mD3:
        sub     edi,ebx
        mov     al,[edi];Output [edi]
        loop    mD3
mSkD3:
 
        mov     ecx,edx
        sub     ecx,2
        cmp     ecx,0
        jle     mSkD4
mD4:
        dec     edi
        mov     al,[edi];Output [edi]
        loop    mD4
mSkD4:
 
        pop     ecx
 
        pop     edi
        add     edi,ecx
        inc     edi
 
        sub     ecx,2
        cmp     ecx,0
        jle     mEx
        jmp     mSpiral
mEx:
 
Matrix  db 0,1,2,3,4,5,6,7,8,9,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh
QDM     db 4;Matrix dimension
I solve the task, but does not work , Can someone help me how to solve? it is very important...Please
 
Last edited by a moderator:
Top