From bf97dc18c49b4d7ab6af4cb690c114aef1487cc1 Mon Sep 17 00:00:00 2001 From: NotExactlySiev Date: Tue, 3 May 2022 21:40:20 +0430 Subject: [PATCH 1/4] Update ui.ts --- src/ide/ui.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/ide/ui.ts b/src/ide/ui.ts index d2a78d59..12b403fa 100644 --- a/src/ide/ui.ts +++ b/src/ide/ui.ts @@ -1141,6 +1141,39 @@ async function _downloadProjectZipFile(e) { }); } +function _downloadSymFile(e) { + var sym = platform.debugSymbols.addr2symbol; + var text = ""; + $.each(sym, function(k, v) { + let symType; + if (k < 0x2000) { + k = k % 0x800; + symType = "R"; + } else if (k < 0x6000) symType = "G"; + else if (k < 0x8000) { + k = k - 0x6000; + symType = "S"; + } else { + k = k - 0x8000; + symType = "P"; + } + let addr = Number(k).toString(16).padStart(4, '0').toUpperCase(); + // Mesen doesn't allow lables to start with digits + if (v[0] >= '0' && v[0] <= '9') { + v = "L" + v; + } + // nor does it allow dots + v = v.replaceAll('.', '_'); + text += `${symType}:${addr}:${v}\n`; + }); + + var prefix = getFilenamePrefix(getCurrentMainFilename()); + var blob = new Blob([text], {type:"text/plain;charset=utf-8"}); + saveAs(blob, prefix + ".mlb", {autoBom:false}); + +} + + async function _downloadAllFilesZipFile(e) { var zip = await newJSZip(); var keys = await store.keys(); @@ -1907,6 +1940,7 @@ function setupDebugControls() { $("#item_download_rom").click(_downloadROMImage); $("#item_download_file").click(_downloadSourceFile); $("#item_download_zip").click(_downloadProjectZipFile); + $("#item_download_sym").click(_downloadSymFile); $("#item_download_allzip").click(_downloadAllFilesZipFile); $("#item_record_video").click(_recordVideo); if (platform_id.startsWith('apple2') || platform_id.startsWith('vcs')) // TODO: look for function From d5110344281beb82baf3dd4386ad981c58df6bb8 Mon Sep 17 00:00:00 2001 From: NotExactlySiev Date: Tue, 3 May 2022 21:41:22 +0430 Subject: [PATCH 2/4] Update index.html --- index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/index.html b/index.html index d2ba288a..fae6e4ad 100644 --- a/index.html +++ b/index.html @@ -89,6 +89,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
  • Download ROM Image
  • Download Project as ZIP
  • Download All Changes as ZIP
  • +
  • Download Debug Symbols (.mlb)
  • Download ROM Image
  • Download Project as ZIP
  • Download All Changes as ZIP
  • -
  • Download Debug Symbols (.mlb)
  • +
  • Download Debug Symbols