954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

task in assembly

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)

I'm new here, I have to write code for the task above in assembly,could someone help me and explain me how to solve this task? Please

juce
Newbie Poster
13 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 
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


, each linemov al,[edi];Output [edi] means print. I did not implement it because I do not know what compiler and OS do you use.

skaa
Light Poster
36 posts since Jan 2011
Reputation Points: 13
Solved Threads: 5
 

I use assembler 8086. by which interrupt I should print the result ??
mov ah, 02h
int 21h ?? or something else?????
Thanks for your help

kikiritce
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

Yes, you can use it.

skaa
Light Poster
36 posts since Jan 2011
Reputation Points: 13
Solved Threads: 5
 

I tried one more time, but doesn't work.Your post is all right and helpful for me
If you can help me one more time it would be grateful. I couldn't print the result. tnx

kikiritce
Newbie Poster
20 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

I work on Windows 7. It does not allow to use interrupts, so I can print using Windows API only. Is it fine for you?

skaa
Light Poster
36 posts since Jan 2011
Reputation Points: 13
Solved Threads: 5
 

The AL(Assemly Linker) task wraps AL.exe, a tool that is distributed with the Windows Software Development Kit (SDK). This Assembly Linker tool is used to create an assembly with a manifest from one or more files that are either modules or resource files.

Hugo123007
Newbie Poster
9 posts since Dec 2011
Reputation Points: 7
Solved Threads: 0
Infraction Points: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: