diff --git a/css/ui.css b/css/ui.css index efe53510..f34a7d5a 100644 --- a/css/ui.css +++ b/css/ui.css @@ -403,3 +403,22 @@ div.markdown th { .alert { z-index:2; } +.segment { + border: 2px solid rgba(0,0,0,0.2); + border-radius:8px; + color: #333; + background-color:#999; +} +.segment.segment-ram { + background-color:#aaffaa; +} +.segment.segment-rom { + background-color:#ddddff; + padding-top:1em; + padding-bottom:1em; +} +.segment-offset { + font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; + font-size: 12pt; + color:#66dd66; +} diff --git a/src/project.ts b/src/project.ts index f5afba38..9e14c1b1 100644 --- a/src/project.ts +++ b/src/project.ts @@ -1,6 +1,6 @@ "use strict"; -import { FileData, Dependency, SourceLine, SourceFile, CodeListing, CodeListingMap, WorkerError, WorkerResult } from "./workertypes"; +import { FileData, Dependency, SourceLine, SourceFile, CodeListing, CodeListingMap, WorkerError, Segment, WorkerResult } from "./workertypes"; import { getFilenameForPath, getFilenamePrefix, getFolderForPath, isProbablyBinary } from "./util"; type BuildResultCallback = (result:WorkerResult) => void; @@ -12,6 +12,7 @@ type GetRemoteCallback = any; // TODO (path:string, (text:string) => FileData) = export class CodeProject { filedata : {[path:string]:FileData} = {}; listings : CodeListingMap; + segments : Segment[]; mainpath : string; pendingWorkerMessages = 0; tools_preloaded = {}; @@ -298,6 +299,11 @@ export class CodeProject { lst.assemblyfile = new SourceFile(lst.asmlines, lst.text); } } + // save and sort segment list + this.segments = data.segments; + if (this.segments) { + this.segments.sort((a,b) => {return a.start-b.start}); + } } getListings() : CodeListingMap { diff --git a/src/ui.ts b/src/ui.ts index e91df95c..092f095e 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -194,6 +194,11 @@ function refreshWindowList() { return new Views.MemoryView(); }); } + if (current_project.segments) { + addWindowItem("#memmap", "Memory Map", function() { + return new Views.MemoryMapView(); + }); + } } // can pass integer or string id diff --git a/src/views.ts b/src/views.ts index 2da0f79b..d18ce55a 100644 --- a/src/views.ts +++ b/src/views.ts @@ -3,7 +3,7 @@ import $ = require("jquery"); //import CodeMirror = require("codemirror"); import { CodeProject } from "./project"; -import { SourceFile, WorkerError } from "./workertypes"; +import { SourceFile, WorkerError, Segment } from "./workertypes"; import { Platform, EmuState } from "./baseplatform"; import { hex, lpad, rpad } from "./util"; import { CodeAnalyzer } from "./analysis"; @@ -772,3 +772,54 @@ export class BinaryFileView implements ProjectView { getPath() { return this.path; } } + +/// + +export class MemoryMapView implements ProjectView { + maindiv : JQuery; + + createDiv(parent : HTMLElement) { + this.maindiv = $("