this is one of my first assembly code, what do you think about it?
1 Is there a better way I can go thourgh array?
2 I'm using SI to store the array address because I've seen it's a common paradigm to do that. But why to bother? Can't I just use 'VECTOR' instead?
3 Other general advice? (It's my really first code...)
. org 100h .MODEL SMALL .DATA VECTOR DW 3,4,2,0,54,-2,3,4 MIN DW ? .CODE .STARTUP XOR AX,AX ;counter LEA SI,VECTOR ;store vector address in SI MOV BX,[SI] ;BX is the minium, let's suppose it's the first element here ADD SI,2 ;I want to go through the array 2byte at once INC AX ;scanned elements in AX TESTMIN: CMP BX,[SI] JL GOAHEAD MOV BX,[SI] GOAHEAD: ADD SI,2 INC AX CMP AX,8 JL TESTMIN ret
Thank you guys
This post has been edited by domenico: 11 May 2013 - 09:18 AM