@@ -25,6 +25,8 @@ public enum Mode
2525 private Mode _mode = Mode . New ;
2626 private bool _loading = true ;
2727
28+ private string _sysBusDomainName = null ! ;
29+
2830 private bool _changedSize ;
2931 private bool _changedDisplayType ;
3032
@@ -34,6 +36,8 @@ public enum Mode
3436
3537 private readonly HexTextBox AddressBox ;
3638
39+ private readonly TextBox AddressWithPointersBox ;
40+
3741 private readonly CheckBox BigEndianCheckBox ;
3842
3943 private readonly ComboBox DisplayTypeDropDown ;
@@ -54,6 +58,8 @@ private int SelectedWidth
5458
5559 private readonly ComboBox SizeDropDown ;
5660
61+ private readonly CheckBoxEx UsePointerSyntaxCheckbox ;
62+
5763 public WatchEditor ( )
5864 {
5965 _changedDisplayType = false ;
@@ -94,8 +100,40 @@ public WatchEditor()
94100 {
95101 Controls = { new LabelEx { Text = "0x" } , AddressBox } ,
96102 } ;
103+ AddressWithPointersBox = new ( ) { Size = new ( 100 , 20 ) , Visible = false } ;
104+ SingleColumnFLP flpAddrOptions = new ( )
105+ {
106+ Controls = { flpAddr , AddressWithPointersBox } ,
107+ } ;
97108 tlpMain . Controls . Add ( label1 , row : row , column : 0 ) ;
98- tlpMain . Controls . Add ( flpAddr , row : row , column : 1 ) ;
109+ tlpMain . Controls . Add ( flpAddrOptions , row : row , column : 1 ) ;
110+ row ++ ;
111+
112+ UsePointerSyntaxCheckbox = new ( ) { Enabled = MemoryDomains . HasSystemBus , Text = "Use pointer syntax" } ;
113+ UsePointerSyntaxCheckbox . CheckedChanged += ( checkedChangedSender , _ ) =>
114+ {
115+ var isChecked = ( ( CheckBox ) checkedChangedSender ) . Checked ;
116+ flpAddr . Visible = ! ( AddressWithPointersBox . Visible = isChecked ) ;
117+ if ( isChecked )
118+ {
119+ if ( ( string ) DomainDropDown . SelectedItem == _sysBusDomainName ! )
120+ {
121+ AddressWithPointersBox . Text = $ "0x{ AddressBox . Text } ";
122+ }
123+ else
124+ {
125+ DomainDropDown . SelectedItem = _sysBusDomainName ;
126+ AddressWithPointersBox . Text = string . Empty ;
127+ }
128+ AddressBox . Text = string . Empty ;
129+ }
130+ else
131+ {
132+ //TODO eval and copy back
133+ AddressWithPointersBox . Text = string . Empty ;
134+ }
135+ } ;
136+ tlpMain . Controls . Add ( UsePointerSyntaxCheckbox , row : row , column : 1 ) ;
99137 row ++ ;
100138
101139 LocLabelEx label3 = new ( ) { Anchor = AnchorStyles . Right , Text = "Size:" } ;
@@ -187,6 +225,7 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
187225 }
188226
189227 _loading = false ;
228+ _sysBusDomainName = MemoryDomains . SystemBus . ToString ( ) ;
190229 SetAddressBoxProperties ( ) ;
191230
192231 switch ( _mode )
@@ -206,7 +245,9 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
206245 NotesBox . Enabled = false ;
207246 NotesBox . Text = "" ;
208247
209- AddressBox . Enabled = false ;
248+ AddressBox . Enabled = AddressWithPointersBox . Enabled
249+ = UsePointerSyntaxCheckbox . Enabled
250+ = false ;
210251 AddressBox . Text = Watches . Select ( a => a . AddressString ) . Aggregate ( ( addrStr , nextStr ) => $ "{ addrStr } ,{ nextStr } ") ;
211252
212253 BigEndianCheckBox . ThreeState = true ;
@@ -220,7 +261,15 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
220261 {
221262 NotesBox . Text = Watches [ 0 ] . Notes ;
222263 NotesBox . Select ( ) ;
223- AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
264+ if ( Watches [ 0 ] is NeoWatch neo )
265+ {
266+ UsePointerSyntaxCheckbox . Checked = true ;
267+ AddressWithPointersBox . Text = neo . AddressString ;
268+ }
269+ else
270+ {
271+ AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
272+ }
224273 }
225274
226275 SetBigEndianCheckBox ( ) ;
@@ -321,17 +370,25 @@ private void Ok_Click(object sender, EventArgs e)
321370 default :
322371 case Mode . New :
323372 var domain = MemoryDomains . FirstOrDefault ( d => d . Name == DomainDropDown . SelectedItem . ToString ( ) ) ;
324- var address = AddressBox . ToLong ( ) ?? 0 ;
325373 var notes = NotesBox . Text ;
326374 var type = Watch . StringToDisplayType ( DisplayTypeDropDown . SelectedItem . ToString ( ) ) ;
327375 var bigEndian = BigEndianCheckBox . Checked ;
328- Watches . Add ( Watch . GenerateWatch (
329- domain ,
330- address ,
331- ( WatchSize ) SelectedWidth ,
332- type ,
333- bigEndian : bigEndian ,
334- note : notes ) ) ;
376+ var addrWithPointers = AddressWithPointersBox . Text ;
377+ if ( addrWithPointers . Length is not 0 )
378+ {
379+ //TODO
380+ }
381+ else
382+ {
383+ var address = AddressBox . ToLong ( ) ?? 0 ;
384+ Watches . Add ( Watch . GenerateWatch (
385+ domain ,
386+ address ,
387+ ( WatchSize ) SelectedWidth ,
388+ type ,
389+ bigEndian : bigEndian ,
390+ note : notes ) ) ;
391+ }
335392 break ;
336393 case Mode . Edit :
337394 DoEdit ( ) ;
0 commit comments