From 5010fbae371221acbc3915fddc6e35ed0d5e5b15 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 30 Mar 2020 16:04:37 -0700 Subject: [PATCH] Various minor changes - Freeze Note brushes, so HTML export doesn't blow up when it tries to access them. - Add Ctrl+Shift+E as keyboard shortcut for File > Export. - For code/data percentage, count inline data as data. - Tweak code/data percentage text. - Document Merlin32 '{' bug. - Tweak tutorial text. --- SourceGen/DisasmProject.cs | 2 +- SourceGen/DisplayList.cs | 1 + SourceGen/Res/Strings.xaml | 2 +- SourceGen/RuntimeData/Help/codegen.html | 2 +- SourceGen/RuntimeData/Help/tutorials.html | 15 +++++++++------ SourceGen/WpfGui/MainWindow.xaml | 6 +++++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 1092c74..f8e0b78 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -1592,7 +1592,7 @@ namespace SourceGen { } } - if (attr.IsDataStart) { + if (attr.IsDataStart || attr.IsInlineDataStart) { // There shouldn't be data items inside of other data items. offset += attr.Length; diff --git a/SourceGen/DisplayList.cs b/SourceGen/DisplayList.cs index d7aab7d..985bf7f 100644 --- a/SourceGen/DisplayList.cs +++ b/SourceGen/DisplayList.cs @@ -435,6 +435,7 @@ namespace SourceGen { if (color != NoColor) { parts.HasBackgroundColor = true; parts.BackgroundBrush = new SolidColorBrush(color); + parts.BackgroundBrush.Freeze(); // export runs on non-UI thread } return parts; } diff --git a/SourceGen/Res/Strings.xaml b/SourceGen/Res/Strings.xaml index 28b4498..a75d4ce 100644 --- a/SourceGen/Res/Strings.xaml +++ b/SourceGen/Res/Strings.xaml @@ -163,7 +163,7 @@ limitations under the License. C64 Screen Code {1} CPU @ {2} MHz Show - {0:F1}KB: {1:F1}% code, {2:F1}% data, {3:F1}% junk + {0:F1}KB ({1:F1}% code, {2:F1}% data, {3:F1}% junk) Ready DCI string has mixed data DCI string not terminated diff --git a/SourceGen/RuntimeData/Help/codegen.html b/SourceGen/RuntimeData/Help/codegen.html index 7b75b53..915478e 100644 --- a/SourceGen/RuntimeData/Help/codegen.html +++ b/SourceGen/RuntimeData/Help/codegen.html @@ -277,7 +277,7 @@ code, but also needs to know how to handle the corner cases.

  • PC relative branches don't wrap around at bank boundaries.
  • For some failures, an exit code of zero is returned.
  • Immediate operands with a comma (e.g. LDA #',') - cause an error.
  • + or curly braces (e.g. LDA #'{') cause an error.
  • Some DP indexed store instructions cause errors if the label isn't unambiguously DP (e.g. STX $00,X vs. STX $0000,X). This isn't a problem with project/platform diff --git a/SourceGen/RuntimeData/Help/tutorials.html b/SourceGen/RuntimeData/Help/tutorials.html index d67d387..f3251f5 100644 --- a/SourceGen/RuntimeData/Help/tutorials.html +++ b/SourceGen/RuntimeData/Help/tutorials.html @@ -36,7 +36,7 @@ The buttons are shortcuts for items in the File menu.

    Create the project

    -

    Click "Start new project".

    +

    Click the "Start new project" button.

    The New Project window has three parts. The top-left window has a tree of known platforms, arranged by manufacturer. The top-right window @@ -460,7 +460,7 @@ to 2 (it's a 2-byte pointer). Click "OK" to create the entry, and then "OK" to update the table.

    There's now a ".var" statement (similar to a .equ) above line $203d, and the stores to $02/$03 have changed to "PTR1" and "PTR1+1".

    -

    Double-click on the JSR on line $2045 to jump to L209A. This just +

    Double-click on the JSR on line $2045 to jump to L20A7. This just loads a value from $3000 into the accumulator and returns, so not much to see here. Hit the back-arrow in the toolbar to jump back to the JSR.

    The next bit of code masks the accumulator so it holds a value between @@ -497,7 +497,8 @@ counts are adjusted for everything SourceGen can figure out. For example, the BEQ on line $205a shows "2+" cycles, meaning that it takes at least two cycles but might take more. That's because conditional branches take an extra cycle if the branch is taken. The BNE on line $2061" shows 3 cycles, -because we know that the branch is always taken. (If you want to see why, +because we know that the branch is always taken and doesn't cross a page +boundary. (If you want to see why it's always taken, look at the value of the 'Z' flag in the "flags" column. Lower-case 'z' means the zero-flag is clear. You can see it got set on the ORA #$80 line.)

    @@ -588,7 +589,8 @@ on.

    Start a new project. Select the Apple //e platform, click Select File and navigate to the Examples directory. In A2-Amper-fdraw, select -AMPERFDRAW#061d60. Click "OK" to create the project.

    +AMPERFDRAW#061d60 (ignore the existing .dis65 file). Click +"OK" to create the project.

    Not a lot to see here -- just half a dozen lines of loads and stores. This particular program interfaces with Applesoft BASIC, so we can make it a bit more meaningful by loading an additional platform @@ -758,7 +760,7 @@ list of parameters at the bottom. The file offset indicates where in the file the bitmap starts; note this is an offset, not an address (that way, if you change the address, your visualizations don't break). This is followed by the bitmap's width in bytes, and the bitmap's height. -Because we have 8 pixels per byte, we're currently showing a 1x1 image. +Because we have 8 pixels per byte, we're currently showing an 8x1 image. We'll come back to row stride.

    We happen to know (by playing the game and/or reading the fictitious drawing code) that the image is 8x8, so change the value in the height @@ -775,7 +777,8 @@ Set window as well. You should now see the blue 'X' in the code listing above line $100A.

    Repeat the process at line $1012: select the line, create a visualization -set, create a new bitmap, set the height to 8, click "OK" twice.

    +set, create a new visualization. The height will default to 8 because +that's what you used last time. Click "OK" in both dialogs to close them.

    Repeat the process at line $101A, but this time the image is 40x40 rather than 8x8. Set the width to 5, and the height to 40. This makes diff --git a/SourceGen/WpfGui/MainWindow.xaml b/SourceGen/WpfGui/MainWindow.xaml index c7e32ef..96268f3 100644 --- a/SourceGen/WpfGui/MainWindow.xaml +++ b/SourceGen/WpfGui/MainWindow.xaml @@ -113,7 +113,11 @@ limitations under the License. - + + + Ctrl+Shift+E + + F3