library - CSE 380 The Library Lab #4 Library Create a...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 380 The Library Lab #4 Library Create a library file with subroutines that can be called as needed Library must contain at minimum: uart_init read_character output_character output_string Outputs string to HyperTerminal read_string Gets string from HyperTerminal Don’t forget ‘echo’ display_digit Accepts value to display digit on seven-segment display read_DIPs Returns value on DIP switches LEDS Accepts value to be turn on appropriate LEDs Use of subroutines in lab #4 is REQUIRED! It will be included in your grade! Example Write a routine called evaluation which calculates the following r0 := r0 * r0 + r1 - r2 * r2 Write a square function sqr SUBS r1, r0, #1 ; Counter BEQ done ; If r0 is 1, 1*1 = 1 MOV r2, r0 ; Initialize partial product loop ADD r0, r2, r0 ; Partial product calculation SUB r1, r1, #1 ; Counter decrement CMP r1, #0 ; Done? BGT loop done MOV PC, LR
Background image of page 1

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

View Full DocumentRight Arrow Icon
Write evaluate evaluate ; Evaluates r0 = r0 * r0 + r1 - r2 * r2 STMFD SP!,{lr} ; Spill Registers
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

library - CSE 380 The Library Lab #4 Library Create a...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online