Chapter8 Subroutines

Chapter8 Subroutines - pulx rts ; END subroutine...

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

View Full Document Right Arrow Icon
Summer 2008 ELEC 2220 – Computer Systems Program Subroutines Text: Chapter 7.16, Chapter 8
Background image of page 1

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

View Full DocumentRight Arrow Icon
Summer 2008 ELEC 2220 Computer Systems – V. P. Nelson Program Subroutines
Background image of page 2
Summer 2008 ELEC 2220 Computer Systems – V. P. Nelson Program Subroutines Program Element Program Example Subroutines and functions ; Subroutine "count_em( char *StringP )" ; This routine counts the characters in a string ; until the NULL character is found. ; Entry: D register pointing to the start ; Exit: None ; Reg Mod: CCR ; Data Mod: Data location Counter contains the ; number of characters ; count_em ; Save the registers pshx tfr d,x ; Put the address in X ; WHILE the char is not ZERO while_do: tst 0,x beq found_eot ; DO count the chars inc Counter inx bra while_do ; ENDO found_eot: ; ENDWHILE the char is not NULL ; Restore the registers
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pulx rts ; END subroutine "count_em()" Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Subroutine calls Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson Summer 2008 ELEC 2220 Computer Systems V. P. Nelson...
View Full Document

This note was uploaded on 09/23/2011 for the course ELEC 2220 taught by Professor Staff during the Summer '08 term at Auburn University.

Page1 / 13

Chapter8 Subroutines - pulx rts ; END subroutine...

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

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