1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-03 05:49:48 +00:00
6502bench/SourceGen/SGTestData/2011-hinting.cs
Andy McFadden 245e0bd9f3 Make address translation available to extension scripts
The current AddressMap is now passed into the plugin manager, which
wraps it in an AddressTranslate object and passes that to the
plugins at Prepare() time.  This allows plugins to convert addresses
to offsets, making it possible to format complex structures.

This breaks existing plugins.
2019-10-06 18:13:39 -07:00

38 lines
1.2 KiB
C#

// Copyright 2018 faddenSoft. All Rights Reserved.
// See the LICENSE.txt file for distribution terms (Apache 2.0).
using System;
using System.Collections.Generic;
using PluginCommon;
namespace RuntimeData.Test2011 {
public class Test2011 : MarshalByRefObject, IPlugin, IPlugin_InlineJsr {
private IApplication mAppRef;
private byte[] mFileData;
public string Identifier {
get {
return "Test 2011-hinting";
}
}
public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans,
List<PlSymbol> plSyms) {
mAppRef = appRef;
mFileData = fileData;
mAppRef.DebugLog("Test2011(id=" + AppDomain.CurrentDomain.Id + "): prepare()");
}
public void CheckJsr(int offset, out bool noContinue) {
noContinue = false;
if (offset + 7 < mFileData.Length &&
mFileData[offset + 1] == 0x56 && mFileData[offset + 2] == 0x24) {
mAppRef.SetInlineDataFormat(offset + 3, 4, DataType.NumericLE,
DataSubType.None, null);
}
}
}
}