Programming Examples

 

 

2. Copying a String

B

exeunt

; all done

COPY

%r0,%ret0

; clear rtnval

onebyte

 

 

LDBS,MA

1(%arg0),%r6

; temp1 < -byte,bump src pointer

onemore

 

 

STBS,MA

%r6,1(%arg1)

; dest<-temp1,bump dest pointer

ADDIBF,=,N

-1,%arg2,onemore

; decrement count

 

 

; compare for 0.

LDBS,MA

1(%arg0),%r6

; delay slot

fallout

 

; temp1 <-byte,bump src pointer

 

 

Bexeunt

COPY %r0,%ret0

choke

LDI 14,%ret0

exeunt

.LEAVE

.PROCEND

Chapter 7

133