RequireParamCountExact() public static method

public static RequireParamCountExact ( List param, int count ) : void
param List
count int
return void
示例#1
0
 private List <ushort> AssembleNOP(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 0);
     return(new List <ushort> {
         0x2080
     });                                 // LOD R0, R0
 }
示例#2
0
        private List <ushort> AssembleLOD(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
        {
            Guard.RequireParamCountExact(param, 2);
            Guard.RequireOpcodeFlag(opcodeFlag, new[] { OpcodeFlag.BitWidth8, OpcodeFlag.BitWidth16 });

            return(state.Parser.AssembleALU(0x0080, param[0], param[1], opcodeFlag, state));
        }
示例#3
0
 private List <ushort> AssembleSLP(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 0);
     Guard.RequireOpcodeFlag(opcodeFlag, new[] { OpcodeFlag.BitWidth16 });
     return(new List <ushort> {
         0x04B4
     });
 }
示例#4
0
 private List <ushort> AssembleJSR(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     if (opcodeFlag.HasFlag(OpcodeFlag.FarJump))
     {
         Guard.RequireParamCountMinMax(param, 1, 2); // allow two params for immediate far jump.
         return(state.Parser.AssembleJMI(0x01B9, param[0], param.Count == 2 ? param[1] : null, state));
     }
     Guard.RequireParamCountExact(param, 1);
     return(state.Parser.AssembleJMI(0x00B9, param[0], null, state));
 }
示例#5
0
 private List <ushort> AssembleJMP(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireOpcodeFlag(opcodeFlag, new[] { OpcodeFlag.BitWidth16 });
     if (opcodeFlag.HasFlag(OpcodeFlag.FarJump))
     {
         Guard.RequireParamCountMinMax(param, 1, 2);
         return(state.Parser.AssembleJMI(0x01B8, param[0], param.Count == 2 ? param[1] : null, state));
     }
     Guard.RequireParamCountExact(param, 1);
     return(state.Parser.AssembleJMI(0x00B8, param[0], null, state));
 }
示例#6
0
        private List <ushort> AssembleSTO(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
        {
            Guard.RequireParamCountExact(param, 2);
            Guard.RequireOpcodeFlag(opcodeFlag, new[] { OpcodeFlag.BitWidth8, OpcodeFlag.BitWidth16 });

            List <ushort> code = state.Parser.AssembleALU(0x0088, param[0], param[1], opcodeFlag, state);

            if ((code[0] & 0xF000) == 0x1000) // no sto register - should lod r0, r1, not sto r0, r1
            {
                throw new Exception("Store register instructions not supported");
            }
            if ((code[0] & 0xFE00) == 0x0000) // no sto immediate.
            {
                throw new Exception("Store immediate instructions not supported");
            }
            return(code);
        }
示例#7
0
        private List <ushort> AssembleSTX(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
        {
            Guard.RequireParamCountExact(param, 1);

            Param p1 = ParseParam(param[0]);

            if (p1.AddressingMode != AddressingMode.Immediate)
            {
                throw new Exception("stx instructions expect a single immediate parameter");
            }

            int p1i = (short)p1.ImmediateWordShort;

            if (p1i < sbyte.MinValue || p1i > sbyte.MaxValue)
            {
                throw new Exception("stx instructions accept a single immediate parameter with values between -128 and +127");
            }

            return(new List <ushort> {
                (ushort)(0x00BB | (((sbyte)p1i) << 8))
            });
        }
示例#8
0
 private List <ushort> AssembleMDI(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 2);
     Guard.RequireOpcodeFlag(opcodeFlag, state.Parser.flag8or16);
     return(state.Parser.AssembleALU(0x0058, param[0], param[1], opcodeFlag, state));
 }
示例#9
0
 private List <ushort> AssembleHWQ(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 1);
     Guard.RequireOpcodeFlag(opcodeFlag, new[] { OpcodeFlag.BitWidth16 });
     return(state.Parser.AssembleHWI(0x00BA, param[0]));
 }
示例#10
0
 private List <ushort> AssembleSET(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 2);
     return(state.Parser.AssembleSEI(0x00AC, param[0], param[1]));
 }
示例#11
0
 private List <ushort> AssembleSSG(List <string> param, OpcodeFlag opcodeFlag, ParserState state)
 {
     Guard.RequireParamCountExact(param, 1);
     return(state.Parser.AssembleMMU(0x01B5, param[0], state));
 }