HPlogo Communicator e3000 MPE/iX Release 7.5 (Software Release C75.00): HP e3000 MPE/iX Computer Systems > Chapter 7 Catalog of User Documentation

7.6 A Simple Example

MPE documents

Complete PDF
Table of Contents

These are examples to illustrate some of the rules to keep in mind while writing assembly code.

This example illustrates how the stack gets laid out at the entry code with the callee-saves registers. Note that the .callinfo requests that GR3, GR4 and FR12 ... FR14 get stored in the stack. It also allocates 32 bytes of space for local variables. The entire frame size including the frame marker is 64 bytes.


  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; 
  ;; 
          .space  $TEXT$
          .subspa $CODE$
  stack_layout
          .PROC
          .CALLINFO   entry_gr=4, entry_fr=14, frame=32 
          .EXPORT     stack_layout,code 
  ;; If you used a .enter directive, you'd see this code
  ;; automatically generated by the assembler.
  ;;      .ENTER
          fstds,ma    fr12,8(sp)
          fstds,ma    fr13,8(sp)
          fstds,ma    fr14,8(sp)
          stwm        r3,40(sp)
          stw         r4,-36(sp)

  ;; Assume this is the body of the program.
          ...
          ...
  ;; This is the exit sequence. This would have been automatically
  ;; generated if you used .leave directive.
          .LEAVE
          ldw         -36(sp),r4
          ldwm        -40(sp),r3
          fldds,mb    -8(sp),fr14
          fldds,mb    -8(sp),fr13
          bv          r0(rp)
          fldds,mb    -8(sp),fr12
          .PROCEND




7.5 The HP Pascal ESCAPE Mechanism


7.7 An Advanced Example: Multiple Unwind Regions