6-programs

# 6-programs - Multiple Precision Arithmetic How to add 2...

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

Multiple Precision Arithmetic How to add 2 N-byte numbers (N > 1) NUMB1 + NUMB2 → NUMB1 MSB B1 LSB NUMB1 MSB B1 LSB NUMB2 MSB B1 LSB SUM (NUMB1) + Algorithm: add byte by byte, starting with LSB; store result bytes in place of NUMB1;

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

View Full Document
A. Assume numbers are stored in little-endian format: NUMB1 LSB MSB . . . NUMB2 LSB MSB . . . Pseudo code = ? Note: assembly language program should mach pseudo code structure one-to-one to minimize programming errors and aid debugging
Decisions to be made for Pseudo Code: NUMB1/NUMB2 = arrays of data bytes; array elements can be accessed two ways: 1. through array index; 2. through pointer into array Which to use? Have to use a for-loop to go through the bytes: 1. Use while or do-until structure? 1. Count from up to N or down to 0?

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

View Full Document
A. Assume numbers are stored in little-endian format: Step 4: Program Section Counter = N; Pointer1 = &NUMB1[0]; Pointer2 = &NUMB2[0]; CF = 0; DO{ Pointer1→item + Pointer2→item + CF = Pointer1→item Pointer1++;
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/05/2011 for the course CS 3280 taught by Professor Michael during the Spring '09 term at Missouri (Mizzou).

### Page1 / 14

6-programs - Multiple Precision Arithmetic How to add 2...

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

View Full Document
Ask a homework question - tutors are online