x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4556
Number of posts: 16011

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

Report
assambly matrix program Posted by huhz on 13 Nov 2011 at 11:50 AM
Hello. I had a task to write a program which finds minimal elements in each matrix column. I kinda wrote program, but when i check results they are kinda different.

.model tiny
.code
.startup
                Org      100h
                Jmp Short Start
N Equ  2
M  Equ 3
Matrix DW 1, 7, 3   ; 2 elementi diapazonв [Min, Max]
DW 4, 5, 6   ; 3 elementi diapazonв [Min, Max]
Vector DW M Dup (?)
S Equ Type Matrix
Start:
Xor Bx, Bx
Mov Cx, M
Lea Di, Vector
Cols: Push      Cx
Mov Cx, N
Xor Si, Si
Xor Ax, Ax
Xor      Dx, Dx
Mov  Ax , Matrix[Bx][Si]
Rows:
 
   Cmp Matrix[Bx][Si], Ax
Jg False
Mov  Ax,  Matrix[Bx][Si]
 
False:
Add Si, S*M
Loop Rows
Mov [Di], Ax
Add Bx, S
Add Di, S
                Pop      Cx
Loop Cols
Xor Bx, Bx
Mov Cx, M
Print: Mov Ax, Vector[Bx]
Add Bx, S
Loop Print
          
.exit 0
end


Could someone point out or help me correct my mistakes?



 

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.