1: /
   2: /  BMOVE -- block move
   3: /
   4: /	This is a highly optimized version of the old C-language
   5: /	bmove routine; it's function (should be) identical.
   6: /	It uses a fancy algorithm to move words instead of bytes
   7: /	whenever possible.
   8: /
   9: /	In C the routine is:
  10: /		char *bmove(a, b, l)
  11: /		char	*a, *b;
  12: /		int	l;
  13: /		{
  14: /			register int	n;
  15: /			register char	*p, *q;
  16: /			p = a;
  17: /			q = b;
  18: /			n = l;
  19: /			while (n--)
  20: /				*q++ = *p++;
  21: /			return (q);
  22: /		}
  23: /
  24: /	Parameters:
  25: /		a [4(sp)] -- source area
  26: /		b [6(sp)] -- target area
  27: /		l [10(sp)] -- byte count
  28: /
  29: /	Returns:
  30: /		Pointer to end of target area.
  31: /
  32: /	History:
  33: /		3/14/79 [rse] -- added odd to odd case
  34: /		2/9/78 [bob] -- converted from "C"
  35: /
  36: /
  37: 
  38: .globl  _bmove
  39: 
  40: _bmove:
  41:         mov     r2,-(sp)        / save r2
  42:         mov     4(sp),r1        / get src address
  43:         mov     6(sp),r0        / get dst address
  44: 
  45:         / determine whether to use word or byte move
  46:         mov     r0,r2           / r2 will reflect the three cases
  47:         bic     $177776,r2      / keep only last bit of dst
  48:         ror     4(sp)           / get least significant bit of src
  49:         adc     r2              / add it in.
  50:         beq     wordm           / both on even boundary
  51:         dec     r2              / check for odd case
  52:         bgt     wordodd         / both on odd boundary
  53: 
  54:         mov     10(sp),r2       / get count
  55:         beq     done
  56: bytem:
  57:         movb    (r1)+,(r0)+     / copy next byte
  58:         sob     r2,bytem        / branch until done
  59:         br      done
  60: 
  61: wordm:
  62:         mov     10(sp),r2       / get count
  63: wordt:
  64:         beq     done
  65:         asr     r2              / get word count
  66:         bcs     odd             / count was odd
  67: even:
  68:         mov     (r1)+,(r0)+     / copy word
  69:         sob     r2,even         / more to do if non-zero
  70:         br      done
  71: 
  72: wordodd:
  73:         mov     10(sp),r2       / get count
  74:         beq     done
  75:         movb    (r1)+,(r0)+     / copy byte
  76:         dec     r2              / dec count
  77:         br      wordt           / now treat as an even word move
  78: 
  79: odd:
  80:         beq     odd2            / special case of count = 1
  81: odd1:
  82:         mov     (r1)+,(r0)+     / copy word
  83:         sob     r2,odd1         / continue
  84: odd2:
  85:         movb    (r1)+,(r0)+     / count was odd. do last one
  86: 
  87: done:
  88:         mov     (sp)+,r2        / restore r2
  89:         rts     pc              / return

Defined functions

_bmove declared in line 38; defined in line 40; used 149 times
bytem defined in line 56; used 1 times
  • in line 58
done defined in line 87; used 5 times
even defined in line 67; used 1 times
  • in line 69
odd defined in line 79; used 1 times
  • in line 66
odd1 defined in line 81; used 1 times
  • in line 83
odd2 defined in line 84; used 1 times
  • in line 80
wordm defined in line 61; used 1 times
  • in line 50
wordodd defined in line 72; used 1 times
  • in line 52
wordt defined in line 63; used 1 times
  • in line 77
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2535
Valid CSS Valid XHTML 1.0 Strict