示例#1
0
        // IGenerator
        public void Configure(DisasmProject project, string workDirectory, string fileNameBase,
                              AssemblerVersion asmVersion, AppSettings settings)
        {
            Debug.Assert(project != null);
            Debug.Assert(!string.IsNullOrEmpty(workDirectory));
            Debug.Assert(!string.IsNullOrEmpty(fileNameBase));

            Project = project;
            Quirks  = new AssemblerQuirks();
            Quirks.StackIntOperandIsImmediate = true;
            Quirks.LeadingUnderscoreSpecial   = true;
            Quirks.Need24BitsForAbsPBR        = true;
            Quirks.BitNumberIsArg             = true;

            mWorkDirectory = workDirectory;
            mFileNameBase  = fileNameBase;
            Settings       = settings;

            mLongLabelNewLine = Settings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);

            AssemblerConfig config = AssemblerConfig.GetConfig(settings,
                                                               AssemblerInfo.Id.Tass64);

            mColumnWidths = (int[])config.ColumnWidths.Clone();

            mHasPrgHeader = GenCommon.HasPrgHeader(project);
        }
示例#2
0
        // IGenerator
        public void Configure(DisasmProject project, string workDirectory, string fileNameBase,
                              AssemblerVersion asmVersion, AppSettings settings)
        {
            Debug.Assert(project != null);
            Debug.Assert(!string.IsNullOrEmpty(workDirectory));
            Debug.Assert(!string.IsNullOrEmpty(fileNameBase));

            Project = project;
            Quirks  = new AssemblerQuirks();
            if (asmVersion != null)
            {
                mAsmVersion = asmVersion.Version;       // Use the actual version.
            }
            else
            {
                mAsmVersion = V1_56;                    // No assembler installed, use default.
            }

            Quirks.StackIntOperandIsImmediate = true;
            Quirks.LeadingUnderscoreSpecial   = true;
            Quirks.Need24BitsForAbsPBR        = true;
            Quirks.BitNumberIsArg             = true;
            Quirks.BankZeroAbsPBRRestrict     = true;

            mWorkDirectory = workDirectory;
            mFileNameBase  = fileNameBase;
            Settings       = settings;

            mLongLabelNewLine = Settings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);

            AssemblerConfig config = AssemblerConfig.GetConfig(settings,
                                                               AssemblerInfo.Id.Tass64);

            mColumnWidths = (int[])config.ColumnWidths.Clone();

            // 64tass emulates a loader on a 64K system.  The address you specify with
            // "* = <addr>" tells the loader where the code lives.  If the project runs off the
            // end of memory, you get a warning message and an output file that has the last
            // part as the first part, because the loader wraps around.
            //
            // If (start_addr + total_len) doesn't fit without wrapping, we want to start
            // the code with "* = 0" (or omit it entirely) and use ".logical" for the first.
            // chunk.  This allows us to generate the full 64K.  Note that 65816 code that
            // starts outside bank 0 will always fail this test.
            //
            // Thus there are two modes: "loadable" and "streamable".  We could output everything
            // as streamable but that's kind of ugly and prevents the PRG optimization.
            //
            // If the file has more than 64K of data in it, we need to add "--long-address" to
            // the command-line arguments.

            // Get start address.  If this is a PRG file, the start address is the address
            // of offset +000002.
            bool hasPrgHeader = GenCommon.HasPrgHeader(project);
            int  offAdj       = hasPrgHeader ? 2 : 0;
            int  startAddr    = project.AddrMap.OffsetToAddress(offAdj);

            if (startAddr + project.FileDataLength - offAdj > 65536)
            {
                // Does not fit into memory at load address.
                mOutputMode   = OutputMode.Streamable;
                mHasPrgHeader = false;
            }
            else
            {
                mOutputMode   = OutputMode.Loadable;
                mHasPrgHeader = hasPrgHeader;
            }
            //Debug.WriteLine("startAddr=$" + startAddr.ToString("x6") +
            //    " outputMode=" + mOutputMode + " hasPrg=" + mHasPrgHeader);
        }