RMSINI.PAS/-AU=
{$E+ External procedure}
{$C
	.TITLE	RMSINI
	.IDENT	"791109"
}
PROCEDURE rmsini;
{
	Init the RMS run-time system.  Declare types of RMS usage.
	Define RMS buffer allocation routines (grab space from heap).

	*** Note: This routine must be in the root segment of an overlaid task

       ********************* NOTE *********************
       All organizations are included in the ORG$ macros below.  Also, all
       operations are included for all file types.  Refer to the RMS MACRO-11
       Reference Manual pg 1-5 for details.  Remove the ORG$ and/or the entries
       not required if you are NOT linking with the RMSLIB.
}
BEGIN { rms init }
  {$C
    .enabl lsb
    .mcall gsa$, $init, org$
    gsa$ spctrl				; Define space control routine
    org$ seq,<cre,del,fin,get,put,upd>	; Sequential access (all types)
    org$ rel,<cre,del,fin,get,put,upd>	; Relative access (all types)
    org$ idx,<cre,del,fin,get,put,upd>	; Declare index access (all types)
    $init				; Init RMS run-time system
    br 63$				; Quit
  ;
  ; Space control routines.  Enter with:
  ;
  ;	Request for space--
  ;
  ;		r1 = amount of space required (bytes)
  ;		r2 = 0
  ;
  ;	Release of space--
  ;
  ;		r1 = size of block being released
  ;		r2 = address of block being released
  ;
  ; Leave with:
  ;
  ;	Request for space--
  ;
  ;		r0 = address of allocated block
  ;
  ;	Release of space--none
  ;
    spctrl::
      inc r1				; round space request...
      bic #1, r1			; ...to even boundary
      tst r2				; Request or release ??
      bne 1$				; ne ==> release, eq ==> request
      mov r1, -(sp)			; Push size request on stack
      call $new				; Get heap space
      mov (sp)+, r0			; return address of block
      br 62$				; done
    1$:
      mov r0, -(sp)			; save register
      mov r1, r0			; put length where $dispo wants it
      mov r2, -(sp)			; put address where $dispo wnats it
      call $dispo			; return block to heap
      mov (sp)+, r0			; restore register
    62$:
      clc				; no errors possible
      return				; return to sender (address unknown ?)
    63$:
    .dsable lsb
  }
END; { rms init }
/
