Elucid-non recursize

# Elucid-non recursize - This needs to be otherwise it could...

This preview shows pages 1–6. Sign up to view the full content.

Sheet1 Page 1 TITLE Euclidean algorithm(main.asm) INCLUDE Irvine32.inc .data input1WORD1071d input2WORD1029d answWORD0 temp WORD 0 t .code main PROC m mov eax, 0 m mov ax, input1 mov dx, input2 mov cx, input2 m euclid: cmp dx, 0 jz finish j mov answ, ax mov cx, dx mov temp, cx mov dx, 0 div cx d mov cx, dx mov ax, temp m loopeuclid finish: f call WriteHex call Crlf c

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 exit main ENDP END main
Sheet1 Page 3 Description: Euclidean algorithm decimal=1071, 1029, 42, 21, 0 hex=42f, 405, 2a, 15, 0 mov dx, 0 mov cx, 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: This needs to be otherwise it could be 0 and we would have a wrong answer. We could technically set it to 1 or another value if dx, the remainder, = 0 jump to finish else continue working Store potential answer. Clear it, we need it for the remainder. ax/cx in this case input1/input2 Move to B value remainder. move old B value to A value. Sheet1 Page 4 Sheet1 Page 5 A - Larger number B - Smaller number Sheet1 Page 6...
View Full Document

## This note was uploaded on 12/30/2009 for the course COS 231 taught by Professor Jasonlitz during the Summer '09 term at Thomas Edison State.

### Page1 / 6

Elucid-non recursize - This needs to be otherwise it could...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online