Clarification of Question by
kaycee1234-ga
on
02 Mar 2005 07:58 PST
Below is a code i have been able to come up with. It compiles but does
not run. Please can someone help fix this problem?
INCLUDE Irvine32.inc
.data
V1 BYTE "a", "a", "a", "b", "b", "c", "c", "d", "d", "d", "e", "e",
"e", "f", "f", "f", "g", "g", "g", "h", "h", "h", "i", "i", "i";
V2 BYTE "d", "e", "b", "e", "c", "e", "f", "e", "a", "g", "i", "h",
"g", "e", "c", "i", "d", "e", "h", "g", "e", "i", "h", "e", "f";
COST BYTE 1,2,2,7,4,5,7,3,2,3,4,5,6,9,6,5;
Temp BYTE ?
AnsV1 BYTE ?
AnsV2 BYTE ?
ACost BYTE ?
.code
main PROC
mov esi,OFFSET V1
mov edi,OFFSET Temp
mov ebx,OFFSET COST
mov edx,OFFSET V2
mov ecx,OFFSET ACost
;~-----------------------------------------------------------------------------------
L1: push esi ; Starting of Code----Moving the value of array V1 into stack
mov edi,ebx ; moving the associated cost into Temp for comparison
add esi,4 ; incrementing the pointer
JP1:cmp ebp,esi ; comparing the next value with the one in stack
jne L2 ; If not equal then the next value is the next node in Spanning Tree
add ebx,4 ; incrementing the pointer
mov edi,ebx ; Storing the value to choose the minimum in Temp
Loop JP1 ; Repeat until there is a new value
Loop L1
;~-----------------------------------------------------------------------------------
L2: mov eax,edi ; Finding the minimum value
add edi,4 ; Sorting
cmp eax,edi
jle L2 ; If less than or equal to : compare with next value
mov eax,edx; Else what is the next node for minimum edge value
cmp eax,ebp ; compare with the existing node if same or not i.e.
if there is a loop
jne L4 ; if the values not are equal then jump to L4
mov edi,1000 ; else go back one step and repeat the same process
without the previous vertex
jmp JP1 ;
L4: ;mov AnsV1[ecx],ebp
;mov AnsV2[ecx],eax
mov ecx,ebx
;inc ecx
;~-------------------------------------------------------------------------------------
mov edx,OFFSET ACost
call WriteString
main endp
END main