• News:
    • 0.18:
      You are now allowed to use registers as procedure arguments
  • Syntaxes:
      PROC <name>( [ <args> ] ) [ (<results>) ] IS <exp>
    
      PROC <name>( [ <args> ] ) [ (<results>) ]
        <statements>
      ENDPROC [ <exp> ]
    

    where <name> is the procedure name, <args> are arguments of the procedure and <results> are return value types. <exp> is a list of returning expressions. <statements> is all the code of the procedure.

  • Early exit (RETURN):
    Procedure can be left before the end is reached be the RETURN keyword. This also allows to return a list of values:
      RETURN [ <exp> ]
    

    where <exp> is a list of returning expressions.

  • Returning values:
    Procedures in PowerD can return one or more return values. All of these should be defined in <results> field (see above). Defaultly are all values typed as LONGs, so if the procedure return eg. FLOATs or DOUBLEs this field MUST be defined. If not, procedure will return bad values. (FLOATs and DOUBLEs are stored in floating point registers, while all others are stores in cpu data registers)
    All of these return types can contain also default return value and everywhere a procedure will be left without a return values these default will be used instead like here:
      PROC test()(DOUBLE,DOUBLE)
        RETURN 2,1.1
      ENDPROC 1.0,1.1
    

    is the same as:
      PROC test()(DOUBLE=1.0,DOUBLE=1.1)
        RETURN 2
      ENDPROC
    
  • Registers as arguments
    This allows You to use registers instead of stack for arguments storage. This is important for library compilation, where all functions should use registers only. This is a 68k only feature, it's useless on ppc, because ppc uses single argument structure for all function types. Pay attention on registers You use for these arguments, You are allowed to use all data registers D0-D7, and some address registers A0-A3, A4 is also a possibility in PowerD, but this register has special meaning in other languages, so I wouldn't recommend to use it. And ofcourse You can use all the float registers FP0-FP7.

    Syntactical example:
      PROC xxx(a:L IN d0,b:PTR IN a1,c:DOUBLE IN fp1)
      ENDPROC
    

    Here You see, that the magic keyword is the 'IN' followed by the register itself.

    Limitations:
    Currently, if You use this feature, You have to use it on all the arguments. It isn't allowed to use eg: PROC xxx(a,b IN d0).