A92: Sage version 0.3


[Prev][Next][Index][Thread]

A92: Sage version 0.3



Now Sage can do a little more. It still can't be used for practicle
purposes. I have added in subtraction, division, and multiplication. I
need some help to get this done faster.

This example shows most of what is done so far, and what it gets turned
into in Assembly:

int main() {
      return 53;
  }

  void zaper(int hi) {
      int hi;
  }

  int zunc(int hi,int b) {
      int h3;
      zaper();
      return hi;
  }

  int zunc2(int hi,int b) {
      int h2=5+3;
      int h4=5-2;
      int h5=5*2;
      int h6=6/2;
      int h3;
      return hi+h2;
  }

Gets Turned into:

     @program prog_code,prog_name

zunc2:
        move.w  #0,-(a7)
        ;Moving variable tempConstant17 to !ExpressionReasult6.
        move.w  #5,0(a7)
        ;Loading variable !ExpressionReasult6.
        move.w  0(a7),d0
        ;Adding variable tempConstant19 to !ExpressionReasult6.
        add.w   #3,d0
        ;Popping variables off of stack
        add.l   #2,a7
        ;Moving variable !ExpressionReasult6 to stack.
        move.w  d0,-(a7)
        move.w  #0,-(a7)
        ;Moving variable tempConstant20 to !ExpressionReasult8.
        move.w  #5,0(a7)
        ;Loading variable !ExpressionReasult8.
        move.w  0(a7),d0
        ;Subtracting variable tempConstant22 from !ExpressionReasult8.
        sub.w   #2,d0
        ;Popping variables off of stack
        add.l   #2,a7
        ;Moving variable !ExpressionReasult8 to stack.
        move.w  d0,-(a7)
        move.w  #0,-(a7)
        ;Moving variable tempConstant23 to !ExpressionReasult10.
        move.w  #5,0(a7)
        ;Loading variable !ExpressionReasult10.
        move.w  0(a7),d0
        ;Multipling variable tempConstant25 and !ExpressionReasult10.
        mulu.w  #2,d0
        ;Popping variables off of stack
        add.l   #2,a7
        ;Moving variable !ExpressionReasult10 to stack.
        move.w  d0,-(a7)
        move.w  #0,-(a7)
        ;Moving variable tempConstant26 to !ExpressionReasult12.
        move.w  #6,0(a7)
        ;Loading variable !ExpressionReasult12.
        move.w  0(a7),d0
        ;Dividing variable !ExpressionReasult12 by tempConstant28.
        divu.w  #2,d0
        ;Popping variables off of stack
        add.l   #2,a7
        ;Moving variable !ExpressionReasult12 to stack.
        move.w  d0,-(a7)
        move.w  #0,-(a7)
        move.w  #0,-(a7)
        ;Loading variable hi.
        move.w  14(a7),d0
        ;Moving variable hi to !ExpressionReasult14.
        move.w  d0,0(a7)
        ;Loading variable h2.
        move.w  10(a7),d1
        ;Loading variable !ExpressionReasult14.
        move.w  0(a7),d3
        ;Adding variable h2 to !ExpressionReasult14.
        add.w   d1,d3
        ;Popping variables off of stack
        add.l   #2,a7
        ;Popping variables off of stack
        add.l   #14,a7
        ;Moving variable !ExpressionReasult14 to stack.
        move.w  d3,-(a7)
        rts

zunc:
        move.w  #0,-(a7)
        bsr     zaper
        move.w  4(a7),d0
        ;Popping variables off of stack
        add.l   #6,a7
        ;Moving variable hi to stack.
        move.w  d0,-(a7)
        rts

zaper:
        move.w  #0,-(a7)
        ;Popping variables off of stack
        add.l   #4,a7
        rts

prog_code:
        ;Moving variable tempConstant33 to stack.
        move.w  #53,-(a7)
        rts

prog_name:
        dc.b   "This is not yet supported",0

        reloc_open
        reloc_close
        end


Remember the address for Sage is
http://www.ieighty.net/~edward/sage/done.html