This tutorial will walk you through some of the fancier things SourceGen can do. We assume you've already finished the basic features tutorial, and know how to create projects and move around in them.
Start a new project. Select Generic 6502. For the data file, navigate to the Examples directory, then from the Tutorial directory select "Tutorial2".
Looking at the code list, the first thing you'll notice is that we
immediately ran into a
BRK, which is a pretty reliable sign that we're not in
a code section. This particular file begins with
00 20, which
could be a load address (e.g. some C64 binaries look like this). So let's start
with that assumption.
As discussed in the introductory material, SourceGen separates code from data by tracing all possible execution paths from declared entry points. The generic profiles mark the first byte of the file as an entry point, but that's wrong here. We want to change the entry point to be after the 16-bit load address, at offset +000002.
Click on the first line of code at address $1000, and select Actions > Remove Analyzer Tags (Ctrl+H Ctrl+R). This removes the "code entry point" tag. Unfortunately the $20 is still auto-detected as being part of a string directive.
The string is making it hard to manipulate the next few bytes,
so let's fix that by selecting Edit > Toggle Data Scan
(Ctrl+D). This turns off the feature that
automatically generates string and
so now each uncategorized byte is on its own line.
You could select the first two lines and use Actions > Edit Operand to format them as a 16-bit little-endian hex value, but there's a shortcut: select the first line with data (address $1000), then Actions > Format As Word (Ctrl+W). It automatically grabbed the following byte and combined them.
Since we believe $2000 is the load address for everything that follows, click on the line with address $1002, select Actions > Set Address, and enter "2000". With that line still selected, use Actions > Tag Address As Code Start Point (Ctrl+H Ctrl+C) to tell the analyzer to start looking for code there.
That looks better, but the branch destination ($203D) is off the bottom of the screen (unless you have a really tall screen or small fonts) because of all the intervening data. Use Edit > Toggle Data Scan (Ctrl+D) to turn the string-finder back on. Now it's easier to read.