Computer Arch. Project

# Computer Arch. Project - incrementing the counter by 5...

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

Computer Architecture Final Project Finding the minimum value Hussein Zahr [email protected] Instructor: Veton Këpuska Date: 12/16/04

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

View Full Document
Introduction This assembly language program implements a minimum value searching algorithm. 1- Program Code LIST: .equ 0x496 ; Address of the list .org LIST ; list values .dc 0x496, 25, 0x512, 12, 0x528, 98, 0X544, 01, 0x560, 52 .org 0 lar r10, LIST ;store in r10 the list of values lar r11, SEARCH ;store in r11 the address of label SEARCH lar r12, NEW ;store in r12 the address of label NEW lar r13, EXIT ;store in r13 the address of label EXIT lar r14, COUNTER ;store in r14 the value of the counter ; r1= hold result ; r2= buffer for next address pointer ; r3= buffer for current data member ; r4= test register COUNTER: addi r14,r14,5

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: ; incrementing the counter by 5 SEARCH: addi r14,r14,-1 ; Start decrementing counter ld r1,4(r10) ; Load r1 with first values and so initialized the table ld r2,0(r10) ; Load r2 with pointer to the next linked cell ld r3,4(r10) ; Load r3 with values of current data brzr r13,r14 ; check for null value of the counter, if zero branch to EXIT sub r4,r1,r2 ; subtract r2 from r2 brmi r12,r4 ; skip if r4 smaller than r1, branch to r12 cause r4 negtive addi r1,r2,0 ; change pointer to value of r2 br r11 ;return to starting loop NEW: addi r10,r2,0 ; go to next number of list br r11; ;branch to SEARCH loop EXIT: stop 2 2-Result Before running compiler: 3 After running the compiler: 4...
View Full Document

### Page1 / 4

Computer Arch. Project - incrementing the counter by 5...

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

View Full Document
Ask a homework question - tutors are online