コード例 #1
0
        public void TestNoValueAfterSeparatorPOWord()
        {
            string source = @"* = $2000
                             !word 0,0,0,";

            C64Studio.Parser.ASMFileParser parser = new C64Studio.Parser.ASMFileParser();
            parser.SetAssemblerType(C64Studio.Types.AssemblerType.C64_STUDIO);

            C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig();
            config.OutputFile = "test.prg";
            config.TargetType = C64Studio.Types.CompileTargetType.PRG;
            config.Assembler  = C64Studio.Types.AssemblerType.C64_STUDIO;

            C64Studio.Types.ErrorCode code = C64Studio.Types.ErrorCode.OK;

            Assert.IsFalse(parser.Parse(source, null, config));

            foreach (var entry in parser.Messages.Values)
            {
                code = entry.Code;
                break;
            }

            Assert.AreEqual(1, parser.Errors);
            Assert.AreEqual(C64Studio.Types.ErrorCode.E1000_SYNTAX_ERROR, code);
        }
コード例 #2
0
        public void TestBinaryLiteralsOutOfBounds()
        {
            string source = @"    * = $c000

                              !byte %#...##...
                              !byte %101000010";

            C64Studio.Parser.ASMFileParser parser = new C64Studio.Parser.ASMFileParser();
            parser.SetAssemblerType(C64Studio.Types.AssemblerType.C64_STUDIO);

            C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig();
            config.OutputFile = "test.prg";
            config.TargetType = C64Studio.Types.CompileTargetType.PRG;
            config.Assembler  = C64Studio.Types.AssemblerType.C64_STUDIO;

            C64Studio.Types.ErrorCode code = C64Studio.Types.ErrorCode.OK;

            Assert.IsFalse(parser.Parse(source, null, config));

            foreach (var entry in parser.Messages.Values)
            {
                code = entry.Code;
                break;
            }

            Assert.AreEqual(2, parser.Errors);
            Assert.AreEqual(C64Studio.Types.ErrorCode.E1002_VALUE_OUT_OF_BOUNDS_BYTE, code);
        }
コード例 #3
0
        public void TestErrorOnIndirectAddressingForNOnSupportingOpCodes()
        {
            string source = @"* = $2000

                          SCREEN = $0400


                                    lda (SCREEN)
                                    sta (SCREEN)
          
                                    jsr (TEST)
          
                                    lda #1
                                    bne (THEEND)
          
                          THEEND          
                          TEST          
                                    rts";

            C64Studio.Parser.ASMFileParser parser = new C64Studio.Parser.ASMFileParser();
            parser.SetAssemblerType(C64Studio.Types.AssemblerType.C64_STUDIO);

            C64Studio.Parser.CompileConfig config = new C64Studio.Parser.CompileConfig();
            config.OutputFile = "test.prg";
            config.TargetType = C64Studio.Types.CompileTargetType.PRG;
            config.Assembler  = C64Studio.Types.AssemblerType.C64_STUDIO;

            C64Studio.Types.ErrorCode code = C64Studio.Types.ErrorCode.OK;

            Assert.IsFalse(parser.Parse(source, null, config));

            foreach (var entry in parser.Messages.Values)
            {
                code = entry.Code;
                break;
            }

            Assert.AreEqual(4, parser.Errors);
            Assert.AreEqual(C64Studio.Types.ErrorCode.E1105_INVALID_OPCODE, code);
        }