Beispiel #1
0
        public void Visit(PropertyRVal v)
        {
            /*
             * ; returns the property for the object on the
             * ; user stack. the value will be either 1 or 0
             * ; parameters on user stack
             * ; 1-object id (top)
             *
             */
            sw.WriteLine("\t;getting a property");
            try
            {
                sw.WriteLine("\tpop bx ; pull param so we can reorder stack");
                sw.WriteLine("\tmov ah,0");
                sw.WriteLine("\tmov al," + propIndexes[v.PropName] + " ; " + v.PropName);
                sw.WriteLine("\tpush ax ; property param is on bottom");
                sw.WriteLine("\tpush bx ; push object #");
            }
            catch (Exception e)
            {
                throw new Exception(v.PropName + " is not a valid prop for " + v.ObjName, e);
            }

            sw.WriteLine("\tcall get_obj_prop ; result -> A");
            sw.WriteLine("\tadd sp,4 ; pop 2 params");
            sw.WriteLine("\tmov ah,0 ; clear high byte");
            sw.WriteLine("\tpush ax ; push result");
        }
Beispiel #2
0
        public void Visit(PropertyRVal v)
        {
            /*
             * ; returns the property for the object on the
             * ; user stack. the value will be either 1 or 0
             * ; parameters on sys stack
             * ; 1-object id (top)
             * ; 2-property number
             *
             */
            sw.WriteLine("\t;getting a property");

            sw.WriteLine("\tpuls b ; pull object #");
            sw.WriteLine("\tclra");
            sw.WriteLine("\ttfr d,x ; save it");


            try
            {
                sw.WriteLine("\tldb #" + propIndexes[v.PropName] + " ; " + v.PropName);
                sw.WriteLine("\tclra");
                sw.WriteLine("\tpshs d");
            }
            catch (Exception e)
            {
                throw new Exception(v.PropName + " is not a valid prop for " + v.ObjName, e);
            }

            sw.WriteLine("\tpshs x ; push object #");

            sw.WriteLine("\tjsr get_object_prop ; result -> B");
            sw.WriteLine("\tleas 4,s");
            sw.WriteLine("\tpshs b ; push result on stack sys stack");
        }
Beispiel #3
0
 public void Visit(PropertyRVal v)
 {
     // returns property c of object b in register a
     // the property should be 0 - 15 inclusive
     sw.WriteLine("\t;get object property");
     sw.WriteLine("\tpop bc ; get obj id");
     // sw.WriteLine("\tld c,b ; sub wants obj in c");
     sw.WriteLine("\tld c," + propIndexes[v.PropName] + " ; " + v.PropName);
     sw.WriteLine("\tcall get_obj_prop");
     sw.WriteLine("\tpush af");
 }
        public void Visit(PropertyRVal prv)
        {
            //        Console.WriteLine("call get_obj_prop ; returns val in a");
            //Console.WriteLine("push a onto stack");
            sw.WriteLine("\t; getting a property");
            sw.WriteLine("\tpla ; get object id into A");
            //int bit = (int)Math.Log(Convert.ToDouble(propBytes[prv.PropName]), 2) + 1;
            int bit = propIndexes[prv.PropName];

            sw.WriteLine("\tldx #" + bit + " ; " + prv.PropName);
            sw.WriteLine("\tjsr get_obj_prop ; A=1-16 ");
            sw.WriteLine("\tpha");
        }
 public void Visit(PropertyRVal v)
 {
     /*
      * ; returns the property for the object on the
      * ; user param_stack. the value will be either 1 or 0
      * ; parameters on user stack
      * ; 1-object id (top)
      *
      */
     sw.WriteLine(Tabs() + "//getting a property");
     try
     {
         sw.WriteLine(Tabs() + "param1 = param_stack_pop() ; //object id");
         sw.WriteLine(Tabs() + "param2 = " + propIndexes[v.PropName] + " ; //" + v.PropName);
         sw.WriteLine(Tabs() + "param1 =  get_object_prop(param1, param2) ; ");
         sw.WriteLine(Tabs() + "param_stack.push(param1);");
     }
     catch (Exception e)
     {
         throw new Exception(v.PropName + " is not a valid prop for " + v.ObjName, e);
     }
 }