Exemplo n.º 1
0
        public void Visit(AttributeRVal v)
        {
            //get attr push it on stack

            /*
             * ; params are on user stack
             * ; top param is obj id
             */

            sw.WriteLine("\tnop ;getting an attr");

            try
            {
                sw.WriteLine("\tpop bx ; get object id");
                sw.WriteLine("\tmov ah,0");
                sw.WriteLine("\tmov al," + attrIndexes[v.AttrName] + " ; " + v.AttrName);
                sw.WriteLine("\tpush ax ; push attr #");
                sw.WriteLine("\tpush bx ; push object id");
                sw.WriteLine("\tcall get_obj_attr ; result->ax");
                sw.WriteLine("\tadd sp,4 ; pop 2 params");
                sw.WriteLine("\tmov ah,0 ; clear high byte");
                sw.WriteLine("\tpush ax");
            }
            catch (Exception e)
            {
                throw new Exception(v.AttrName + " is not a valid attr for " + v.ObjName, e);
            }
        }
Exemplo n.º 2
0
 public void Visit(AttributeRVal prv)
 {
     sw.WriteLine("\t;getting an attribute");
     //      Console.WriteLine("call get_obj_attr ; returns val in a");
     sw.WriteLine("\tpla ; get object id from stack");
     // sw.WriteLine("\tlda #" + game.GetObjectId(prv.ObjName) + " ; " + prv.ObjName);
     sw.WriteLine("\tldy #" + attrIndexes[prv.AttrName] + " ; " + prv.AttrName);
     sw.WriteLine("\tjsr get_obj_attr");
     sw.WriteLine("\tpha ; put attr on stack");
 }
Exemplo n.º 3
0
        public void Visit(AttributeRVal v)
        {
            // returns property c of object b in register a

            sw.WriteLine("\t;attr rval");
            //sw.WriteLine("\tld b," + game.GetObjectId(v.ObjName));
            sw.WriteLine("\tpop bc ; pop obj id");
            sw.WriteLine("\tld c," + attrIndexes[v.AttrName] + " ; " + v.AttrName);
            sw.WriteLine("\tcall get_obj_attr ");
            sw.WriteLine("\tpush af");
        }
Exemplo n.º 4
0
        public void Visit(AttributeRVal v)
        {
            //get attr push it on stack

            /*
             * ;params are on user stack
             * ; top param is attr to get
             * ; next param is obj id
             */

            sw.WriteLine("\t;getting an attr");
            sw.WriteLine("\tpuls b ; pull object #");
            sw.WriteLine("\tclra");
            sw.WriteLine("\ttfr d,x");

            try
            {
                sw.WriteLine("\tldb #" + attrIndexes[v.AttrName] + " ; " + v.AttrName);
                sw.WriteLine("\tpshs d");
                sw.WriteLine("\tpshs x");
            }
            catch (Exception e)
            {
                throw new Exception(v.AttrName + " is not a valid attr for " + v.ObjName, e);
            }

            /*
             *      puls b ; pull object #
             * clra ;
             * tfr d,x ;
             * ldb #1 ; holder
             * pshs d ; push it as a short
             * pshs x ; push object # as a short
             * jsr get_object_attr
             * leas 4,s
             * pshs b ; move rslt to sys stack
             *
             */
            sw.WriteLine("\tjsr get_object_attr");
            sw.WriteLine("\tleas 4,s");
            sw.WriteLine("\tpshs b ; move rslt to sys stack");
        }
Exemplo n.º 5
0
        public void Visit(AttributeRVal v)
        {
            //get attr push it on stack

            /*
             * ; params are on user stack
             * ; top param is obj id
             */

            sw.WriteLine(Tabs() + "// ;getting an attr");

            try
            {
                sw.WriteLine(Tabs() + "param1 = param_stack_pop() ; // get object id");
                sw.WriteLine(Tabs() + "param2 = " + attrIndexes[v.AttrName] + " ; //" + v.AttrName);
                sw.WriteLine(Tabs() + "param1 = get_object_attr(param1, param2) ; ");
                sw.WriteLine(Tabs() + "param_stack.push(param1);");
            }
            catch (Exception e)
            {
                throw new Exception(v.AttrName + " is not a valid attr for " + v.ObjName, e);
            }
        }