From 4537f2495823e29a530324c7df1a071296f15a7c Mon Sep 17 00:00:00 2001
From: Andy McFadden
-
+
diff --git a/docs/sgtutorial/address-tables.html b/docs/sgtutorial/address-tables.html
index 9dfe7f5..caf1dbb 100644
--- a/docs/sgtutorial/address-tables.html
+++ b/docs/sgtutorial/address-tables.html
@@ -58,7 +58,7 @@
We'll need to load scripts from the project directory, so we have to + @@ -111,20 +111,23 @@ a script that can handle that, so use Edit > Project Properties, select the Extension Scripts tab, and click - Add Scripts from Project. The file - browser opens in the project directory. Select the file - "InlineL1String.cs", click Open, then OK.
+ Add Scripts from Runtime. The file + browser opens in the RuntimeData directory. Open the + "Common" folder, select the file + "StdInline.cs", click Open, + then OK.Nothing happened. If you look at the script with an editor (and you
know some C#), you'll see that it's looking for a JSR
to a
- function called PrintInlineL1String
. So let's give it one.
InA1_
. So let's set a label.
This time, double-click the JSR
operand
("L1036") to edit the operand.
- Click Create Label, and enter PrintInlineL1String.
+ Click Create Label, and enter InA1_PrintString.
Remember that labels are case-sensitive;
you must enter it exactly as shown. Hit OK to accept the label,
and OK to close the operand editor.
If all went well, address $1003
should now be an L1 string "How long?
", and address $100D
- should be another JSR
.
The next JSR
appears to be followed by a null-terminated string, so
- we'll need something that handles that.
Go back into Project Properties
- and add the script called "InlineNullTermString.cs" from the project directory.
- This script is slightly different, in that it handles any JSR
to a label
- that starts with PrintInlineNullString
. So let's give it a couple of
- those.
JSR
. This one appears to be followed
+ by an inline null-terminated string, so we'll need something
+ that handles that.
Double-click the operand on line $100D ("L1037
"),
click Create Label,
- and set the label to "PrintInlineNullStringOne".
+ and set the label to "InAZ_PrintString1".
Hit OK twice. That formatted the first one and got us
- to the next JSR
. Repeat the process on line $1019
- ("L1038
"), setting the label to "PrintInlineNullStringTwo".
Things are looking good, but we've got one left, and it's got a
- twist. Instead of a string, the JSR
at $1025 is followed by a
- pointer to a string. We'd like to format the pointer as an address,
- and then format the string it points to.
We're going to add a third extension script. Sometimes it's - convenient to collect all inline data handlers for a project into a - single script, so we'll demonstrate that here. The new script handles - the previous two cases as well as this new case. - Go into Project - Properties, click the Extension Scripts tab, select the two scripts - you added earlier, and click Remove. Then add the script "InlineMulti.cs" - from the project directory. Click OK twice. Note that - the strings formatted earlier remain formatted.
+ to the nextJSR
, at $1019. Repeat the process on line $1019
+ ("L1038
"), setting the label to
+ "InAZ_PrintString2".
Double-click the operand on line $1025 ("L1039
"),
- click Create Label,
- and set the label to "PrintInlineAddrString".
- Hit OK twice. This formatted the address at $1028,
- and also formatted the string at $102b as a null-terminated string.
+
The last JSR
, at $1025, is followed by a 16-bit
+ pointer. Edit the operand, and use Create Label to
+ set the label at the target address to "InWA_StringPtr".
Because the bytes were formatted as an address and not a just a
16-bit value, a label was generated automatically.
What we'd really like to do in this case is to have it format the + 16-bit address as a pointer, and format the data it points to as + a null-terminated string. The StdInline script doesn't know how to + do that though, so you'd need to write a custom script. (Scripts + can format multiple data items, add symbolic references to labels + and constants, and chase pointers around.)
+The entire project is now nicely formatted. In a real project the
"Print Inline" locations would be actual print functions, not just RTS
instructions. There would likely be multiple JSR
s to the print function,
@@ -251,9 +209,14 @@
strings and clean up the disassembly automatically. The reason for
allowing wildcard names is that some functions may have multiple
entry points or chain through different locations.
Extension scripts can make your life much easier, but they do require - some programming experience. See the SourceGen manual for more details.
+ some programming experience. See the "Advanced Topics" section in the + SourceGen manual for more details.je#o_87GjFT1_kcpOajWx|p#KEx
zkOtM4;m#Ej5OEwklkKfH$~c63%P0YaUYQ#{Glm3`;fp>U<4T(vP*)DY&LPz_Z%K?h
zdY`u6)+aLJ9#<$YB&*+HfOx5u`P=gyRBznYZHAU>)NDMtwr&-^V*Y_2bO+L@<_`K1
z;s1K(Ej~x;n>UA@ajxa}*@y3ke1H`(sL~!m;p*!BT7V;FU03Fv;NVJ#yn>8-En0iubd#@#EL(zhLx8-dM9NN#?IO@}1sd+23p2I?VU1gCUdawnXTr
z!H0(rzF)>HszL$~u#%v6LDT(2~>7()PP9m%uaRf=u&)+%@M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