mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-05 06:04:36 +00:00
365864ccdf
Implemented Apple II hi-res bitmap conversion. Supports B&W and color. Uses essentially the same algorithm as CiderPress. Experimented with displaying non-text items in ListView. I assumed it would work, since it's the sort of thing WPF is designed to do, but it's always wise to approach with caution. Visualization Sets now show a 64x64 button as a placeholder for the eventual thumbnail. Some things were being flaky, which turned out to be because I wasn't Prepare()ing the plugins before using them from Edit Visualization. To make this a deterministic failure I added an Unprepare() call that tells the plugin that we're all done. NOTE: this breaks all existing plugins.
99 lines
3.2 KiB
C#
99 lines
3.2 KiB
C#
/*
|
|
* Copyright 2019 faddenSoft
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using PluginCommon;
|
|
|
|
/*
|
|
BRK
|
|
DFB command_code
|
|
DW parm_block
|
|
|
|
parm_block
|
|
dfb parm_count
|
|
parameters...
|
|
*/
|
|
|
|
namespace RuntimeData.Apple {
|
|
public class SOS : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineBrk {
|
|
private const string SOS_MLI_TAG = "SOS-MLI-Functions"; // tag used in .sym65 file
|
|
private bool VERBOSE = true;
|
|
|
|
private IApplication mAppRef;
|
|
private byte[] mFileData;
|
|
private Dictionary<int, PlSymbol> mFunctionList;
|
|
|
|
public string Identifier {
|
|
get {
|
|
return "Apple III SOS MLI call handler";
|
|
}
|
|
}
|
|
|
|
public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans) {
|
|
mAppRef = appRef;
|
|
mFileData = fileData;
|
|
|
|
mAppRef.DebugLog("SOS(id=" + AppDomain.CurrentDomain.Id + "): prepare()");
|
|
//System.Diagnostics.Debugger.Break();
|
|
}
|
|
|
|
public void Unprepare() {
|
|
mAppRef = null;
|
|
mFileData = null;
|
|
}
|
|
|
|
public void UpdateSymbolList(List<PlSymbol> plSyms) {
|
|
// Extract the list of function name constants from the platform symbol file.
|
|
mFunctionList = PlSymbol.GeneratePlatformValueList(plSyms, SOS_MLI_TAG, mAppRef);
|
|
}
|
|
public bool IsLabelSignificant(string beforeLabel, string afterLabel) {
|
|
return false;
|
|
}
|
|
|
|
public void CheckBrk(int offset, bool twoByteBrk, out bool noContinue) {
|
|
noContinue = true;
|
|
if (offset + 4 >= mFileData.Length) {
|
|
// ran off the end
|
|
return;
|
|
}
|
|
|
|
// We don't want every BRK to get formatted, so we only format it if we find
|
|
// a matching symbol for the command code.
|
|
|
|
byte req = mFileData[offset + 1];
|
|
if (VERBOSE) {
|
|
int addr = Util.GetWord(mFileData, offset + 2, 2, false);
|
|
mAppRef.DebugLog("Potential SOS call detected at +" + offset.ToString("x6") +
|
|
", cmd=$" + req.ToString("x2") + " addr=$" + addr.ToString("x4"));
|
|
}
|
|
|
|
PlSymbol sym;
|
|
if (!mFunctionList.TryGetValue(req, out sym)) {
|
|
return;
|
|
}
|
|
Util.FormatBrkByte(mAppRef, twoByteBrk, offset, DataSubType.Symbol, sym.Label);
|
|
mAppRef.SetInlineDataFormat(offset + 2, 2, DataType.NumericLE,
|
|
DataSubType.Address, null);
|
|
|
|
// Clear the "no continue" flag unless this is a QUIT call.
|
|
if (req != 0x65) { // QUIT call
|
|
noContinue = false;
|
|
}
|
|
}
|
|
}
|
|
}
|