summaryrefslogtreecommitdiff
path: root/lib/simulator/simulator_gui.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/simulator/simulator_gui.tcl')
-rw-r--r--[-rwxr-xr-x]lib/simulator/simulator_gui.tcl470
1 files changed, 254 insertions, 216 deletions
diff --git a/lib/simulator/simulator_gui.tcl b/lib/simulator/simulator_gui.tcl
index ddaba65..9ae70b9 100755..100644
--- a/lib/simulator/simulator_gui.tcl
+++ b/lib/simulator/simulator_gui.tcl
@@ -2,7 +2,7 @@
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,9 +21,14 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _SIMULATOR_GUI_TCL ] } {
+set _SIMULATOR_GUI_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
-# Provides graphical frontend for simulator engine (intended to be
+# Provides graphical front-end for simulator engine (intended to be
# used at the bottom panel). This class is part of class Simulator.
# --------------------------------------------------------------------------
@@ -35,33 +40,47 @@
class Simulator_GUI {
## COMMON
- common count 0 ;# Counter of instances
+ common sim_gui_count 0 ;# Counter of instances
common name_color {#0000DD} ;# Color for register name labels (eg. 'SP')
common name_nr_color {#8800DD} ;# Color for not-register name labels (eg. 'Clock')
- common on_color {green} ;# Foreground color for bits in state 1 (for bit maps)
- common off_color {red} ;# Foreground color for bits in state 0 (for bit maps)
+ common on_color {#00CC00} ;# Foreground color for bits in state 1 (for bit maps)
+ common off_color {#DD0000} ;# Foreground color for bits in state 0 (for bit maps)
# Font for bit labels (eg. 'EA')
- common bitfont [font create \
- -family {helvetica} \
- -size -11 \
- -weight bold]
+ common bitfont [font create \
+ -family {helvetica} \
+ -size [expr {int(-11 * $::font_size_factor)}] \
+ -weight [expr {$::MICROSOFT_WINDOWS ? "normal" : "bold"}] \
+ ]
# Same as $bitfont but underlined
- common bitfont_under [font create \
- -family {helvetica} \
- -size -11 -underline 1 \
- -weight bold]
+ common bitfont_under [font create \
+ -family {helvetica} \
+ -size [expr {int(-11 * $::font_size_factor)}] \
+ -underline 1 \
+ -weight [expr {$::MICROSOFT_WINDOWS ? "normal" : "bold"}] \
+ ]
# Color for small labels (eg. 'HEX')
common small_color {#5599BB}
# Font for small labels (eg. 'OCT')
- common smallfont $::smallfont
+ common smallfont $::smallfont
+ if {$::MICROSOFT_WINDOWS} { ;# On MS Windows we need some smaller font to fit in
+ set smallfont [font create \
+ -size [expr {int(-9 * $::font_size_factor)}] \
+ -family {helvetica} \
+ -weight normal \
+ ]
+ }
common hcolor {#FFAA00} ;# Highlight foreground color for entry widgets
common hbcolor {#CCCCCC} ;# Highlight background color for entry widgets
# Font for other memory entries (eg. PCON)
- common entry_font [font create -size -12 -family $::DEFAULT_FIXED_FONT -weight bold]
+ common entry_font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ -weight [expr {$::MICROSOFT_WINDOWS ? "normal" : "bold"}] \
+ ]
# Postfixes for entry text variables
common entry_variables {
@@ -108,7 +127,7 @@ class Simulator_GUI {
private variable set_pc_by_line_button {} ;# Button: Set PC by line number
# Variables related to object initialization
- private variable gui_initialized 0 ;# Bool: GUI created
+ private variable sim_gui_gui_initialized 0 ;# Bool: GUI created
private variable parent ;# Parent widget
## PUBLIC
@@ -121,14 +140,14 @@ class Simulator_GUI {
## Object constructor
constructor {} {
- incr count ;# Increment instances counter
- set obj_idx $count ;# Set object index
+ incr sim_gui_count ;# Increment instances counter
+ set obj_idx $sim_gui_count ;# Set object index
}
## Object destructor
destructor {
# Unallocate entry text variables
- if {$gui_initialized} {
+ if {$sim_gui_gui_initialized} {
SimGUI_clean_up
}
}
@@ -138,19 +157,21 @@ class Simulator_GUI {
# @return void
public method PrepareSimulator {_parent} {
set parent $_parent
- set gui_initialized 0
+ set sim_gui_gui_initialized 0
}
## Inform simulator panel than it has became active
# @return void
public method SimulatorTabRaised {} {
+ update idletasks
+ $scrollable_frame yview scroll 0 units
}
## Initialize simulator GUI
# @return void
public method CreateSimulatorGUI {} {
- if {$gui_initialized} {return}
- set gui_initialized 1
+ if {$sim_gui_gui_initialized} {return}
+ set sim_gui_gui_initialized 1
# Set object variables
set disable_validation 1
@@ -196,7 +217,7 @@ class Simulator_GUI {
{up0} "Set this bit to 1"}
{command {Set to 0} {} 7 "bit_popup_menu_setto 0"
{button_cancel} "Set this bit to 0"}
- } $bitmenu 0 "$this " 0 {}
+ } $bitmenu 0 "$this " 0 {} [namespace current]
#
# Create left part
@@ -210,7 +231,12 @@ class Simulator_GUI {
if {[expr {$cap % 8}]} {
incr hg
}
- set hexeditor [HexEditor hexeditor${obj_idx} $main_top_frame.left_frame 8 $hg 2 hex 0 1 8 $cap]
+ if {!$::MICROSOFT_WINDOWS} {
+ set height_in_number_of_rows 9
+ } else {
+ set height_in_number_of_rows 11
+ }
+ set hexeditor [HexEditor hexeditor${obj_idx} $main_top_frame.left_frame 8 $hg 2 hex 0 1 $height_in_number_of_rows $cap]
$hexeditor bindCellValueChanged "$this simulator_hexedit_value_changed"
$hexeditor bindCellLeave {help_window_hide}
$hexeditor bindCellEnter "$this create_help_window_ram"
@@ -228,14 +254,14 @@ class Simulator_GUI {
set sim_gregs_f [frame $middle_f.gregs_frame]
# Pack frames of middle part
- pack $ctrl_f -fill x -padx 2
+ pack $ctrl_f -fill x
pack $sim_gregs_f
- pack $middle_f -side left -fill both -anchor w
+ pack $middle_f -side left -fill both -anchor w -padx 5
# Create controls icon bar
iconBarFactory $ctrl_f "X::" [string range $ctrl_f.controls_ 1 end] ::ICONS::16:: {
- {start_stop "Initialize simulator" {launch} {__initiate_sim}
- "Load sim file into simulator engine"}
+ {start_stop "Start/Stop simulator" {launch} {__initiate_sim}
+ "Load program into the simulator engine, or shutdown the MCU simulator."}
{separator}
{reset "Reset" {rebuild} {__reset -}
"Perform HW reset"}
@@ -250,7 +276,7 @@ class Simulator_GUI {
"Run program and show results after each instruction"}
{run "Run program" {2rightarrow} {__run}
"Run program and show results after some time"}
- }
+ } [namespace current]
foreach slave [pack slaves $ctrl_f] {
pack configure $slave -padx 0
}
@@ -258,11 +284,11 @@ class Simulator_GUI {
# Create separator under controls icon bar
pack [ttk::separator $sim_gregs_f.mid_sep \
-orient horizontal \
- ] -fill x -expand 1 -pady 2
+ ] -fill x -expand 1 -pady 2 -padx 5
## Create registers: A B
set sim_gregs_f_AB [frame $sim_gregs_f.gregs_f_AB]
- pack $sim_gregs_f_AB -anchor w
+ pack $sim_gregs_f_AB -pady 5
# Create num. base headers
set col 1
@@ -318,7 +344,7 @@ class Simulator_GUI {
-validate key \
]
- setStatusTip -widget $entry -text $stip
+ setStatusTip -widget $entry -text [mc $stip]
# Register register entry for disabling/enabling
add_entry $entry
# Register register entry for synchronizations
@@ -333,7 +359,7 @@ class Simulator_GUI {
$sim_gregs_f_AB._B_$base icursor \[$entry index insert\]
focus $sim_gregs_f_AB._B_$base
"
- } {
+ } else {
bind $entry <Key-Up> "
$sim_gregs_f_AB._A_$base icursor \[$entry index insert\]
focus $sim_gregs_f_AB._A_$base
@@ -350,7 +376,7 @@ class Simulator_GUI {
## Create register: PSW
set sim_gregs_f_PSW [frame $sim_gregs_f.gregs_f_PSW]
- pack $sim_gregs_f_PSW -anchor w
+ pack $sim_gregs_f_PSW -pady 2
set ::Simulator_GUI::ENV${obj_idx}_PSW 0
create_bitmap_register $sim_gregs_f_PSW 1 PSW {C AC F0 RS1 RS0 OV - P} 0 {
{Bit address: 0xD7 -- Carry Flag}
@@ -387,7 +413,7 @@ class Simulator_GUI {
-text "R$i" -fg $name_color -pady 0 \
-font $bitfont \
] -row 1 -column $col -sticky we
- setStatusTip -widget $sim_gregs_f_Rx._R${i}_l -text $stip
+ setStatusTip -widget $sim_gregs_f_Rx._R${i}_l -text [mc $stip]
# Create register hexadecimal entry
set ::Simulator_GUI::ENV${obj_idx}_R$i {00}
@@ -439,10 +465,10 @@ class Simulator_GUI {
pack $frame0 -side left -anchor nw
# Create timers frame (hexadecimal entries and bitmaps)
- set timers_frame [ttk::labelframe $frame0.timers_f \
- -padding 2 \
- -labelwidget [label $frame0.timers_lbl -text "TIMERS 0 & 1" -font $smallfont -pady 0]]
- pack $timers_frame -anchor nw -fill x
+ set timers_frame [labelframe $frame0.timers_f \
+ -pady 2 -padx 2 \
+ -labelwidget [label $frame0.timers_lbl -text [mc "TIMERS 0 & 1"] -font $smallfont -pady 0]]
+ pack $timers_frame -anchor nw -fill x -padx 5
# Create frame for hexadecimal entries: TH1 TL1 TH0 TL0
set timers_values_f [frame $timers_frame.timers_values_f]
@@ -633,20 +659,20 @@ class Simulator_GUI {
}
# Create frame for interrupt control registers (IE and IP)
- set interrupt_frame [ttk::labelframe $frame0.interrupt_f \
- -padding 2 \
- -labelwidget [label $frame0.int_lbl -text "INTERRUPTS" -font $smallfont -pady 0]]
- pack $interrupt_frame -anchor nw -fill x
+ set interrupt_frame [labelframe $frame0.interrupt_f \
+ -pady 2 -padx 2 \
+ -labelwidget [label $frame0.int_lbl -text [mc "INTERRUPTS"] -font $smallfont -pady 0]]
+ pack $interrupt_frame -anchor nw -fill x -pady 5 -padx 5
# Create IE, IP bitmaps
- if {[$this get_feature_avaliable t2]} {
+ if {[$this get_feature_available t2]} {
set et2 {ET2}
set pt2 {PT2}
set et2_stip {Bit address: 0xAD -- Enable or disable the Timer 2 overflow interrupt}
set pt2_stip {Bit address: 0xBD -- Defines the Timer 2 interrupt priority level}
- set et2_ttip {Timer 2 interrupt enable bit}
+ set et2_ttip {Timer 2 interrupt enable bit.}
set pt2_ttip {Timer 2 interrupt priority bit}
- } {
+ } else {
set et2 {-}
set pt2 {-}
set et2_stip {Bit address: 0xAD -- Not implemented}
@@ -654,14 +680,14 @@ class Simulator_GUI {
set et2_ttip {Not implemented}
set pt2_ttip {Not implemented}
}
- if {[$this get_feature_avaliable uart]} {
+ if {[$this get_feature_available uart]} {
set es {ES}
set ps {PS}
set es_stip {Bit address: 0xAC -- Enable or disable the serial port interrupt}
set ps_stip {Bit address: 0xBC -- Defines the Serial Port interrupt priority level}
set es_ttip {Serial Port interrupt enable bit}
set ps_ttip {Serial Port interrupt priority bit}
- } {
+ } else {
set es {-}
set ps {-}
set es_stip {Bit address: 0xAD -- Not implemented}
@@ -669,14 +695,14 @@ class Simulator_GUI {
set es_ttip {Not implemented}
set ps_ttip {Not implemented}
}
- if {[$this get_feature_avaliable acomparator]} {
+ if {[$this get_feature_available acomparator]} {
set ec {EC}
set pc {PC}
set ec_stip {Bit address: 0xAE -- Enable or disable the comparator interrupt}
set pc_stip {Bit address: 0xBE -- Defines the comparator interrupt priority level}
set ec_ttip {EC Comparator Interrupt Enable bit}
set pc_ttip {Comparator Interrupt Priority bit}
- } {
+ } else {
set ec {-}
set pc {-}
set ec_stip {Bit address: 0xAE -- Not implemented}
@@ -824,7 +850,7 @@ class Simulator_GUI {
set addrs {} ;# Register addresses
set stips {} ;# Status bar tips
foreach reg {P0 P1 P2 P3 P4} addr {128 144 160 176 192} stip {0 1 2 3 4} {
- if {[$this get_feature_avaliable [string tolower $reg]]} {
+ if {[$this get_feature_available [string tolower $reg]]} {
lappend regs $reg
lappend addrs $addr
lappend stips [mc "SFR 0x%s: Latch of port %s" [symb_name_to_hex_addr $reg] $stip]
@@ -842,7 +868,7 @@ class Simulator_GUI {
-text "$reg:" -fg $name_color -pady 0 \
-font $bitfont \
] -row $row -column 1
- setStatusTip -widget $frame1_top_left._${reg}_l -text $stip
+ setStatusTip -widget $frame1_top_left._${reg}_l -text [mc $stip]
# Create binary entry
set ::Simulator_GUI::ENV${obj_idx}_${reg}_bin {11111111}
@@ -862,7 +888,7 @@ class Simulator_GUI {
# Set entry event bindings
bind $entry0 <FocusIn> "$this unmark_entry $addr"
- setStatusTip -widget $entry0 -text $stip
+ setStatusTip -widget $entry0 -text [mc $stip]
if {$row != 1} {
bind $entry0 <Key-Up> "
$frame1_top_left._Pxx[expr {$row-1}]_bin_e icursor \[$entry0 index insert\]
@@ -914,66 +940,66 @@ class Simulator_GUI {
### Create bottom frame widgets (PCON SCON)
## Create register bitmaps
# - PCON
- if {[$this get_feature_avaliable pof]} {
+ if {[$this get_feature_available pof]} {
set POF {POF}
set pof_statusTip {Power Off Flag}
set pof_tooltip {Power-Off Flag\nCleared to recognize next reset type.\nSet by hardware when VCC rises from 0 to its nominal voltage. Can also be set by software.}
- } {
+ } else {
set POF {-}
set pof_statusTip {Not implemented}
set pof_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable gf1]} {
+ if {[$this get_feature_available gf1]} {
set GF1 {GF1}
set gf1_statusTip {General purpose flag bit}
set gf1_tooltip {General purpose Flag\nCleared by user for general purpose usage.\nSet by user for general purpose usage.}
- } {
+ } else {
set GF1 {-}
set gf1_statusTip {Not implemented}
set gf1_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable gf0]} {
+ if {[$this get_feature_available gf0]} {
set GF0 {GF0}
set gf0_statusTip {General purpose flag bit}
set gf0_tooltip {General purpose Flag\nCleared by user for general purpose usage.\nSet by user for general purpose usage.}
- } {
+ } else {
set GF0 {-}
set gf0_statusTip {Not implemented}
set gf0_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable pd]} {
+ if {[$this get_feature_available pd]} {
set PD {PD}
set pd_statusTip {Power down bit}
set pd_tooltip {Power-Down mode bit\nCleared by hardware when reset occurs.\nSet to enter power-down mode.}
- } {
+ } else {
set PD {-}
set pd_statusTip {Not implemented}
set pd_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable idl]} {
+ if {[$this get_feature_available idl]} {
set IDL {IDL}
set idl_statusTip {Idle mode bit}
set idl_tooltip {Idle mode bit\nCleared by hardware when interrupt or reset occurs.\nSet to enter idle mode.}
- } {
+ } else {
set IDL {-}
set idl_statusTip {Not implemented}
set idl_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable uart]} {
+ if {[$this get_feature_available uart]} {
set SMOD1 {SMOD}
set smod1_statusTip {Double baud rate bit}
set smod1_tooltip {Serial port Mode bit 1 for UART\nSet to select double baud rate in mode 1, 2 or 3.}
- if {[$this get_feature_avaliable smod0]} {
+ if {[$this get_feature_available smod0]} {
append SMOD1 {1}
set SMOD0 {SMOD0}
set smod0_statusTip {Frame Error Select}
set smod0_tooltip {Frame Error Select. When SMOD0 = 0, SCON.7 is SM0. When SMOD0 = 1, SCON.7 is FE.\nNote that FE will be set after a frame error\nregardless of the state of SMOD0.}
- } {
+ } else {
set SMOD0 {-}
set smod0_statusTip {Not implemented}
set smod0_tooltip {Not implemented}
}
- } {
+ } else {
set SMOD1 {-}
set smod1_statusTip {Not implemented}
set smod1_tooltip {Not implemented}
@@ -981,11 +1007,11 @@ class Simulator_GUI {
set smod0_statusTip {Not implemented}
set smod0_tooltip {Not implemented}
}
- if {[$this get_feature_avaliable pwm]} {
+ if {[$this get_feature_available pwm]} {
set PWMEN {PWMEN}
set pwmen_stip {Pulse Width Modulation Enable}
set pwmen_ttip {Pulse Width Modulation Enable. When PWMEN = 1, Timer 0 and Timer 1 are\nconfigured as an 8-bit PWM counter with 8-bit auto-reload prescaler.\nThe PWM outputs on T1 (P3.5).}
- } {
+ } else {
set PWMEN {-}
set pwmen_stip {Not implemented}
set pwmen_ttip {Not implemented}
@@ -1010,7 +1036,7 @@ class Simulator_GUI {
$idl_tooltip \
]
# - SCON
- if {[$this get_feature_avaliable uart]} {
+ if {[$this get_feature_available uart]} {
create_bitmap_register $frame1_bottom 2 SCON {SM0 SM1 SM2 REN TB8 RB8 TI RI} 1 {
{Bit address: 0x9F -- Serial Port mode specifier}
{Bit address: 0x9E -- Serial Port mode specifier}
@@ -1032,7 +1058,7 @@ class Simulator_GUI {
}
# Create bit FE (Frame error)
- if {[$this get_feature_avaliable smod0]} {
+ if {[$this get_feature_available smod0]} {
set FE_frm [frame $frame1_bottom._SCON_SM0_FE_frm]
grid forget $Simulator_panel_parent._SCON_SM0
@@ -1043,7 +1069,7 @@ class Simulator_GUI {
bind $Simulator_panel_parent._SCON_SM0 <ButtonRelease-3> "$this bit_popup_menu SM0 0 SCON 1 %X %Y"
set label [label $Simulator_panel_parent._SCON_FE \
- -text {FE} -fg $off_color -cursor hand1 \
+ -text {FE} -fg $off_color -cursor hand2 \
-bd 0 -font $bitfont -pady 0 -padx 0 \
]
pack $label -in $FE_frm -side left
@@ -1053,7 +1079,7 @@ class Simulator_GUI {
pack $Simulator_panel_parent._SCON_SM0 -in $FE_frm -side left
- setStatusTip -widget $label -text {Bit address: 0x9F -- Framing Error bit}
+ setStatusTip -widget $label -text [mc "Bit address: 0x9F -- Framing Error bit"]
bind $label <Enter> {+%W configure -font $::Simulator_GUI::bitfont_under}
bind $label <Leave> {+%W configure -font $::Simulator_GUI::bitfont}
DynamicHelp::add $label -text [subst {Clear to reset the error state, not cleared by a valid stop bit.\nSet by hardware when an invalid stop bit is detected.\nSMOD0 must be set to enable access to the FE bit}]
@@ -1084,7 +1110,7 @@ class Simulator_GUI {
{SFR 0x98: Serial port control register}
} {
incr row ;# Increment grid row
- if {$reg == {SCON} && ![$this get_feature_avaliable uart]} {
+ if {$reg == {SCON} && ![$this get_feature_available uart]} {
continue
}
@@ -1094,7 +1120,7 @@ class Simulator_GUI {
# Create register name labels
grid [label $frame1_bottom._${reg}_hex_l \
- -text {HEX} -fg $small_color -font $smallfont \
+ -text {H:} -fg $small_color -font $smallfont \
] -row $row -column 12
setStatusTip -widget $frame1_bottom._${reg}_hex_l -text [mc $stip]
@@ -1137,9 +1163,9 @@ class Simulator_GUI {
# Create label "DPTR:"
if {
- [$this get_feature_avaliable {ddp}]
+ [$this get_feature_available {ddp}]
&&
- ![$this get_feature_avaliable {hddptr}]
+ ![$this get_feature_available {hddptr}]
} then {
set text {DPTR0:}
} else {
@@ -1204,7 +1230,7 @@ class Simulator_GUI {
"Simulator_GUI::sim_entry_right $frame1_top_right_0._DPH_e $frame1_top_right_0._DPL_e"
bind $frame1_top_right_0._DPL_e <Key-Left> \
"Simulator_GUI::sim_entry_left $frame1_top_right_0._DPL_e $frame1_top_right_0._DPH_e"
- if {[$this get_feature_avaliable {ddp}]} {
+ if {[$this get_feature_available {ddp}]} {
bind $frame1_top_right_0._DPH_e <Key-Down> "
$frame1_top_right_0._DP1H_e icursor \[$frame1_top_right_0._DPH_e index insert\]
focus $frame1_top_right_0._DP1H_e"
@@ -1214,7 +1240,7 @@ class Simulator_GUI {
}
# Create vertical separator (DPTR + Clock)|(SP + SBUF)
- if {[$this get_feature_avaliable {ddp}]} {set row 3} {set row 2}
+ if {[$this get_feature_available {ddp}]} {set row 3} {set row 2}
grid [ttk::separator $frame1_top_right_0._SP_sep \
-orient vertical \
] \
@@ -1229,7 +1255,7 @@ class Simulator_GUI {
-text {SP:} -fg $name_color -pady 0 \
-font $bitfont \
] -row 2 -column 4 -sticky w
- setStatusTip -widget $frame1_top_right_0._SP_l -text {SFR 0x81: Stack pointer}
+ setStatusTip -widget $frame1_top_right_0._SP_l -text [mc "SFR 0x81: Stack pointer"]
# Create hexadecimal entry for register: SP
set ::Simulator_GUI::ENV${obj_idx}_SP {07}
@@ -1243,7 +1269,7 @@ class Simulator_GUI {
]
# Show and register created memory cell (SP)
- grid $entry -row 2 -column 5 -sticky w
+ grid $entry -row 2 -column 5
add_entry $entry
$this add_sfr_entry 129 $entry
@@ -1258,7 +1284,7 @@ class Simulator_GUI {
bind $entry <Enter> "$this create_help_window_ram SP; Sbar -freeze {SFR 0x81: Stack pointer}"
# Create DPTR1
- if {[$this get_feature_avaliable {ddp}] && ![$this get_feature_avaliable {hddptr}]} {
+ if {[$this get_feature_available {ddp}] && ![$this get_feature_available {hddptr}]} {
# Create label "DPTR1:"
grid [label $frame1_top_right_0._DPTR1_l \
@@ -1315,7 +1341,7 @@ class Simulator_GUI {
focus $frame1_top_right_0._DPL_e"
set row 4
- } {
+ } else {
set row 3
}
@@ -1332,7 +1358,7 @@ class Simulator_GUI {
-style Simulator.TEntry \
-textvariable ::Simulator_GUI::ENV${obj_idx}_CLOCK \
-font $entry_font \
- -width 6 \
+ -width 7 \
-validate all \
-validatecommand "$this clock_validate %P" \
]
@@ -1359,13 +1385,13 @@ class Simulator_GUI {
incr row
# Create label "SBUF X:"
- if {[$this get_feature_avaliable uart]} {
+ if {[$this get_feature_available uart]} {
set label [label $frame1_top_right_0._${reg}_l \
-text "${regname}:" -fg $name_color \
-font $bitfont -pady 0 \
]
grid $label -row $row -column 4
- setStatusTip -widget $label -text $stip
+ setStatusTip -widget $label -text [mc $stip]
# Create hexadecimal entry for memory cell: SBUF
@@ -1404,7 +1430,7 @@ class Simulator_GUI {
-text {PC:} -fg $name_nr_color \
-font $bitfont \
] -side left
- setStatusTip -widget $pc_lbl_but_frm._PC_l -text $stip
+ setStatusTip -widget $pc_lbl_but_frm._PC_l -text [mc $stip]
set set_pc_by_line_button [ttk::button $pc_lbl_but_frm._PC_but \
-image ::ICONS::16::2_rightarrow \
-command "::X::__simulator_set_PC_by_line" \
@@ -1412,7 +1438,7 @@ class Simulator_GUI {
]
pack $set_pc_by_line_button -side right -after $pc_lbl_but_frm._PC_l
DynamicHelp::add $set_pc_by_line_button \
- -text [mc "Set PC (Program Counter) acording to\nline number in source code"]
+ -text [mc "Set PC (Program Counter) according to\nline number in source code"]
add_entry $pc_lbl_but_frm._PC_but
setStatusTip -widget $set_pc_by_line_button \
-text [mc "Set PC by line number"]
@@ -1438,7 +1464,7 @@ class Simulator_GUI {
-validatecommand "$this sim_eval_PC hex %P" \
-font $entry_font \
]
- setStatusTip -widget $frame1_top_right_0_0._PC_hex_e -text $stip
+ setStatusTip -widget $frame1_top_right_0_0._PC_hex_e -text [mc $stip]
# Show and register created entry (PC - hex)
grid $entry -row 1 -column 2
@@ -1467,7 +1493,7 @@ class Simulator_GUI {
-validatecommand "$this sim_eval_PC dec %P" \
-font $entry_font \
]
- setStatusTip -widget $frame1_top_right_0_1._PC_dec_e -text $stip
+ setStatusTip -widget $frame1_top_right_0_1._PC_dec_e -text [mc $stip]
# Show and register created entry (PC - dec)
grid $entry -row 1 -column 2
@@ -1495,7 +1521,7 @@ class Simulator_GUI {
-style TEntry \
-textvariable ::Simulator_GUI::ENV${obj_idx}_TIME \
-state readonly \
- -font [font create -size -12 -family $::DEFAULT_FIXED_FONT] \
+ -font [font create -size [expr {int(-12 * $::font_size_factor)}] -family $::DEFAULT_FIXED_FONT] \
]
setStatusTip -widget $frame1_top_right_1._TIME_e -text [mc "Overall time"]
@@ -1513,7 +1539,7 @@ class Simulator_GUI {
set bottom_left_bottom_trow 0 ;# Row in grid
# Create controls related to Timer/Couter 2
- if {[$this get_feature_avaliable t2]} {
+ if {[$this get_feature_available t2]} {
incr bottom_left_bottom_row 4
set t2_frame [frame $bottom_left_frame.timers_f]
pack $t2_frame
@@ -1598,7 +1624,7 @@ class Simulator_GUI {
-validatecommand "$this validate_Txx $reg %P" \
-font $entry_font \
]
- setStatusTip -widget $timers_values_f._Txx${col}_e -text $stip
+ setStatusTip -widget $timers_values_f._Txx${col}_e -text [mc $stip]
# Show and register created memory cell
grid $entry -row 2 -column $col
@@ -1639,7 +1665,7 @@ class Simulator_GUI {
{Timer 2 Capture/Reload bit\nIf RCLK=1 or TCLK=1, CP/RL2# is ignored and timer is forced to auto-reload on timer 2 overflow.\nClear to auto-reload on timer 2 overflows or negative transitions on T2EX pin if EXEN2=1.\nSet to capture on negative transitions on T2EX pin if EXEN2=1.}
}
- if {[$this get_feature_avaliable t2mod]} {
+ if {[$this get_feature_available t2mod]} {
create_bitmap_register $timers_frame_reg 2 T2MOD {- - - - - - T2OE DCEN} 1 {
{Reserved}
{Reserved}
@@ -1671,7 +1697,7 @@ class Simulator_GUI {
} {
incr col ;# Increment grid column
- if {$reg == {T2MOD} && ![$this get_feature_avaliable t2mod]} {
+ if {$reg == {T2MOD} && ![$this get_feature_available t2mod]} {
continue
}
@@ -1723,38 +1749,38 @@ class Simulator_GUI {
set bottom_middle_row 0 ;# Row in grid
# Registers: AUXR, AUXR1, ACSR, EECON, SPCR, SPSR, WDTCON. IPH, SPCR
- if {[$this get_feature_avaliable t2]} {
+ if {[$this get_feature_available t2]} {
set pt2h {PT2H}
set pt2h_stip {Defines the Timer 2 interrupt priority level}
set pt2h_ttip {Timer 2 interrupt priority bit}
- } {
+ } else {
set pt2h {-}
set pt2h_stip {Not implemented}
set pt2h_ttip {Not implemented}
}
- if {[$this get_feature_avaliable uart]} {
+ if {[$this get_feature_available uart]} {
set psh {PSH}
set psh_stip {Defines the Serial Port interrupt priority level}
set psh_ttip {Serial Port interrupt priority bit}
- } {
+ } else {
set psh {-}
set psh_stip {Not implemented}
set psh_ttip {Not implemented}
}
- if {[$this get_feature_avaliable acomparator]} {
+ if {[$this get_feature_available acomparator]} {
set pch {PCH}
set pch_stip {Defines the comparator interrupt priority level}
set pch_ttip {Comparator Interrupt Priority bit}
- } {
+ } else {
set pch {-}
set pch_stip {Not implemented}
set pch_ttip {Not implemented}
}
- if {[$this get_feature_avaliable pwdex]} {
+ if {[$this get_feature_available pwdex]} {
set PWDEX {PWDEX}
set pwdex_stip {Power-down Exit Mode}
set pwdex_ttip {Power-down Exit Mode. When PWDEX = 1, wake up from Power-down is externally controlled.\nWhen PWDEX = 0, wake up from Power-down is internally timed.}
- } {
+ } else {
set PWDEX {-}
set pwdex_stip {Not implemented}
set pwdex_ttip {Not implemented}
@@ -1763,7 +1789,7 @@ class Simulator_GUI {
set EXTRAM {EXTRAM}
set extram_statustip {Internal/External RAM access using MOVX}
set extram_tooltip {Internal/External RAM access using MOVX @ Ri/@DPTR\nEXTRAM\tOperating Mode\n0\tInternal ERAM (00H-FFH) access using MOVX @ Ri/@DPTR\n1\tExternal data memory access}
- } elseif {[$this get_feature_avaliable intelpe]} {
+ } elseif {[$this get_feature_available intelpe]} {
set EXTRAM {IPE}
set extram_statustip {Intel_Pwd_Exit}
set extram_tooltip {When set, this bit configures the interrupt driven exit from power-down\nto resume execution on the rising edge of the interrupt signal. When\nthis bit is cleared, the execution resumes after a self-timed interval\n(nominal 2 ms) referenced from the falling edge of the interrupt signal.}
@@ -1773,9 +1799,9 @@ class Simulator_GUI {
set extram_tooltip {Reserved\nThe value read from this bit is indeterminate. Do not set this bit.}
}
if {
- [$this get_feature_avaliable wdtcon] ||
- ![$this get_feature_avaliable wtd] ||
- ![$this get_feature_avaliable auxrdisrto]
+ [$this get_feature_available wdtcon] ||
+ ![$this get_feature_available wtd] ||
+ ![$this get_feature_available auxrdisrto]
} then {
set DISRTO {-}
set disrto_stip {Reserved for future expansion}
@@ -1786,9 +1812,9 @@ class Simulator_GUI {
set disrto_ttip {Disable/Enable Reset out\nDISRTO\tOperating Mode\n0\tReset pin is driven High after WDT times out\n1\tReset pin is input only}
}
if {
- [$this get_feature_avaliable wdtcon] ||
- ![$this get_feature_avaliable wtd] ||
- ![$this get_feature_avaliable auxrwdidle]
+ [$this get_feature_available wdtcon] ||
+ ![$this get_feature_available wtd] ||
+ ![$this get_feature_available auxrwdidle]
} then {
set WDIDLE {-}
set wdidle_stip {Reserved for future expansion}
@@ -1798,16 +1824,16 @@ class Simulator_GUI {
set wdidle_stip {Disable/Enable WDT in IDLE mode}
set wdidle_ttip {Disable/Enable WDT in IDLE mode\nWDIDLE\tOperating Mode\n0\tWDT continues to count in IDLE mode\n1\tWDT halts counting in IDLE mode}
}
- if {[$this get_feature_avaliable ao]} {
+ if {[$this get_feature_available ao]} {
set DISALE {AO}
- } {
+ } else {
set DISALE {DISALE}
}
- if {[$this get_feature_avaliable auxr1gf3]} {
+ if {[$this get_feature_available auxr1gf3]} {
set GF3 {GF3}
set gf3_ttip {General purpose user flag}
set gf3_stip {General purpose user flag}
- } {
+ } else {
set GF3 {-}
set gf3_ttip {Reserved\nThe value read from this bit is indeterminate. Do not set this bit.}
set gf3_stip {Reserved for future expansion}
@@ -1829,8 +1855,8 @@ class Simulator_GUI {
[list - $pch $pt2h $psh PT1H PX1H PT0H PX0H] \
[list - - - - - - $PWDEX X2] \
] stip {
- {SFR 0x8E: Auxillary Register}
- {SFR 0xA2: Auxillary Register 1}
+ {SFR 0x8E: Auxiliary Register}
+ {SFR 0xA2: Auxiliary Register 1}
{SFR 0x97: Analog Comparator Control and Status Register}
{SFR 0x96: Data EEPROM Control Register}
{SFR 0xD5: SPI Control Register}
@@ -1843,14 +1869,14 @@ class Simulator_GUI {
if {$cg_left && $bottom_middle_row > $bottom_left_bottom_row} {
set left__right 1
set target_frame $bottom_left_bottom_frame
- } {
+ } else {
set left__right 0
set target_frame $bottom_middle_frame
}
switch -- $reg {
{IPH} {
- if {![$this get_feature_avaliable iph]} {
+ if {![$this get_feature_available iph]} {
continue
}
create_bitmap_register $target_frame $row $reg $bits 1 [list \
@@ -1874,9 +1900,9 @@ class Simulator_GUI {
]
}
{CLKREG} {
- if {[$this get_feature_avaliable clkreg]} {
+ if {[$this get_feature_available clkreg]} {
set reg {CLKREG}
- } elseif {[$this get_feature_avaliable ckcon]} {
+ } elseif {[$this get_feature_available ckcon]} {
set reg {CKCON}
} else {
continue
@@ -1932,7 +1958,7 @@ class Simulator_GUI {
bind $Simulator_panel_parent._EECON_RDYBSY <ButtonRelease-3> {break}
}
{WDTCON} {
- if {![$this get_feature_avaliable wdtcon] || [$this get_feature_avaliable wdtprg]} {
+ if {![$this get_feature_available wdtcon] || [$this get_feature_available wdtprg]} {
continue
}
set psx_tooltip {Prescaler bits for the watchdog timer (WDT). When all three bits are cleared\nto 0, the watchdog timer has a nominal period of 16K machine cycles,\n(i.e. 16 ms at a XTAL frequency of 12 MHz in normal mode or 6 MHz in x2 mode).\nWhen all three bits are set to 1, the nominal period is 2048K machine cycles,\n(i.e. 2048 ms at 12 MHz clock frequency in normal mode or 6 MHz in x2 mode).}
@@ -1958,7 +1984,7 @@ class Simulator_GUI {
]
}
{WDTPRG} {
- if {![$this get_feature_avaliable wdtprg] || [$this get_feature_avaliable wdtcon]} {
+ if {![$this get_feature_available wdtprg] || [$this get_feature_available wdtcon]} {
continue
}
set t_stip {Reserved}
@@ -1981,7 +2007,7 @@ class Simulator_GUI {
}
}
{SPSR} {
- if {![$this get_feature_avaliable spi]} {
+ if {![$this get_feature_available spi]} {
continue
}
create_bitmap_register $target_frame $row $reg $bits 1 {
@@ -2005,7 +2031,7 @@ class Simulator_GUI {
}
}
{SPCR} {
- if {![$this get_feature_avaliable spi]} {
+ if {![$this get_feature_available spi]} {
continue
}
create_bitmap_register $target_frame $row $reg $bits 1 [list \
@@ -2029,7 +2055,7 @@ class Simulator_GUI {
]
}
{ACSR} {
- if {![$this get_feature_avaliable acomparator]} {
+ if {![$this get_feature_available acomparator]} {
continue
}
set CMx_tooltip {Comparator Interrupt Mode\n 2 1 0\tInterrupt Mode\n--- --- ---\t---------------------------------------\n 0 0 0\tNegative (Low) level\n 0 0 1\tPositive edge\n 0 1 0\tToggle with debounce\n 0 1 1\tPositive edge with debounce\n 1 0 0\tNegative edge\n 1 0 1\tToggle\n 1 1 0\tNegative edge with debounce\n 1 1 1\tPositive (High) level}
@@ -2053,8 +2079,8 @@ class Simulator_GUI {
}
{AUXR1} {
if {
- (![$this get_feature_avaliable ddp] || [$this get_feature_avaliable wdtcon])
- && ![$this get_feature_avaliable auxr1gf3]
+ (![$this get_feature_available ddp] || [$this get_feature_available wdtcon])
+ && ![$this get_feature_available auxr1gf3]
} then {
continue
}
@@ -2079,7 +2105,7 @@ class Simulator_GUI {
]
}
{AUXR} {
- if {![$this get_feature_avaliable auxr]} {
+ if {![$this get_feature_available auxr]} {
continue
}
create_bitmap_register $target_frame $row $reg $bits 1 [list \
@@ -2129,7 +2155,7 @@ class Simulator_GUI {
if {$reg != {EECON}} {
set ::Simulator_GUI::ENV${obj_idx}_${reg} {00}
- } {
+ } else {
set ::Simulator_GUI::ENV${obj_idx}_${reg} {03}
}
@@ -2149,7 +2175,7 @@ class Simulator_GUI {
if {$left__right} {
incr bottom_left_bottom_row
incr bottom_left_bottom_trow
- } {
+ } else {
incr bottom_middle_row
}
}
@@ -2174,7 +2200,7 @@ class Simulator_GUI {
pack $bottom_right_spec_frame -anchor nw -fill both
## Create watchdog timer controls
- if {[$this get_feature_avaliable wtd]} {
+ if {[$this get_feature_available wtd]} {
set bottom_right_present 1
set watchdog_frame [frame $bottom_right_frame.watchdog_frame]
pack $watchdog_frame -anchor nw -before $bottom_right_reg_frame
@@ -2188,8 +2214,8 @@ class Simulator_GUI {
# Create ON/OFF switch
set watchdog_onoff_switch [label $watchdog_frame.on_off_switch \
-text [mc "OFF"] -fg $off_color -pady 0 \
- -bd 1 -cursor hand1 -font [font create \
- -family $::DEFAULT_FIXED_FONT -size -12 \
+ -bd 1 -cursor hand2 -font [font create \
+ -family $::DEFAULT_FIXED_FONT -size [expr {int(-12 * $::font_size_factor)}] \
-weight bold \
] \
]
@@ -2198,7 +2224,7 @@ class Simulator_GUI {
pack $watchdog_onoff_switch -side left -padx 2
# Create entryBox for watchdog prescaler
- if {[$this get_feature_avaliable wdtcon] || [$this get_feature_avaliable wdtprg]} {
+ if {[$this get_feature_available wdtcon] || [$this get_feature_available wdtprg]} {
# Create hexadecimal entry for created entry: WatchDog
set ::Simulator_GUI::ENV${obj_idx}_WatchDogP {00}
set wdt_prescaler_entry [ttk::entry $watchdog_frame._WatchDogP_e\
@@ -2263,7 +2289,7 @@ class Simulator_GUI {
{SFR 0x86: SPI Data Register}
{SFR 0xA6: Watchdog reset}
} {
- if {![$this get_feature_avaliable $feature]} {
+ if {![$this get_feature_available $feature]} {
continue
}
if {$col >= 4} {
@@ -2357,7 +2383,7 @@ class Simulator_GUI {
## Show EEPROM write progress indicator
# @return void
public method simulator_GUI_invoke_write_to_eeprom {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
# Create EEPROM indicator frame and horizonatl separator above it
set eeprom_operation_frame [frame $bottom_right_spec_frame.frame]
@@ -2409,7 +2435,7 @@ class Simulator_GUI {
## Hide EEPROM write progress indicator
# @return void
public method simulator_GUI_cancel_write_to_eeprom {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
set ::Simulator_GUI::ENV${obj_idx}_EEPROM_prg 1
if {[winfo exists $eeprom_operation_frame]} {
@@ -2421,7 +2447,7 @@ class Simulator_GUI {
# @parm Int value - New progress value in percents minus one (1..101)
# @return void
public method simulator_WTE_prg_set {value} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
if {$value < 1} {
set value 1
@@ -2445,14 +2471,14 @@ class Simulator_GUI {
$eeprom_progressbar configure -fg $clr
}
- ## Adjust watchdog on/off switch acording to current state
+ ## Adjust watchdog on/off switch according to current state
# @return void
public method simulator_evaluate_wtd_onoff_switch {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
if {[$this simulator_isWatchDogTimerRuning]} {
$watchdog_onoff_switch configure -text [mc "ON "] -fg $on_color
- } {
+ } else {
$watchdog_onoff_switch configure -text [mc "OFF"] -fg $off_color
}
}
@@ -2460,12 +2486,12 @@ class Simulator_GUI {
## Invert watchdog on/off flag
# @return void
public method simulator_invert_wtd_onoff_switch {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
if {!$sim_enabled} {return}
if {[$this simulator_isWatchDogTimerRuning]} {
$this simulator_startStopWatchDogTimer 0
- } {
+ } else {
$this simulator_startStopWatchDogTimer 1
}
simulator_evaluate_wtd_onoff_switch
@@ -2512,7 +2538,7 @@ class Simulator_GUI {
catch {
if {!$dec_value || !$sim_enabled} {
$wtd_clear_button configure -state disabled
- } {
+ } else {
$wtd_clear_button configure -state normal
}
}
@@ -2541,7 +2567,7 @@ class Simulator_GUI {
# This function cannot run multithreaded
if {$sync_Txx_in_progress} {
return 1
- } {
+ } else {
set sync_Txx_in_progress 1
}
@@ -2628,7 +2654,7 @@ class Simulator_GUI {
}
# Validation of THx, TLx or RCAPxL, RCAPxH
- } {
+ } else {
# Check for corrent value
if {![entry_2_hex_validate $content]} {
set sync_Txx_in_progress 0
@@ -2638,23 +2664,23 @@ class Simulator_GUI {
## Determinate vaiable of Tx entry and low-order and high-order bytes of Tx
# TH0 or TL0
if {$registerName == {TH0} || $registerName == {TL0}} {
- set hex_h [subst "\$::Simulator_GUI::ENV${obj_idx}_TH0"]
- set hex_l [subst "\$::Simulator_GUI::ENV${obj_idx}_TL0"]
+ set hex_h [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TH0"]
+ set hex_l [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TL0"]
set target_var "::Simulator_GUI::ENV${obj_idx}_T0"
# TH1 or TL1
} elseif {$registerName == {TH1} || $registerName == {TL1}} {
- set hex_h [subst "\$::Simulator_GUI::ENV${obj_idx}_TH1"]
- set hex_l [subst "\$::Simulator_GUI::ENV${obj_idx}_TL1"]
+ set hex_h [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TH1"]
+ set hex_l [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TL1"]
set target_var "::Simulator_GUI::ENV${obj_idx}_T1"
# TH2 or TL2
} elseif {$registerName == {TH2} || $registerName == {TL2}} {
- set hex_h [subst "\$::Simulator_GUI::ENV${obj_idx}_TH2"]
- set hex_l [subst "\$::Simulator_GUI::ENV${obj_idx}_TL2"]
+ set hex_h [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TH2"]
+ set hex_l [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_TL2"]
set target_var "::Simulator_GUI::ENV${obj_idx}_T2"
# RCAP2H or RCAP2L
} elseif {$registerName == {RCAP2H} || $registerName == {RCAP2L}} {
- set hex_h [subst "\$::Simulator_GUI::ENV${obj_idx}_RCAP2H"]
- set hex_l [subst "\$::Simulator_GUI::ENV${obj_idx}_RCAP2L"]
+ set hex_h [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_RCAP2H"]
+ set hex_l [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_RCAP2L"]
set target_var "::Simulator_GUI::ENV${obj_idx}_RCAP2"
}
@@ -2707,17 +2733,17 @@ class Simulator_GUI {
# possibly new value of bit SCON.7 (FE/SM0)
# @return void
public method simulator_gui_SMOD0_changed {} {
- set scon [subst "\$::Simulator_GUI::ENV${obj_idx}_SCON"]
+ set scon [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SCON"]
if {$scon == {}} {
set scon 0
}
set scon [expr {"0x$scon" & 0x7F}]
if {[$this get_SMOD0]} {
- if {[subst "\$::Simulator_GUI::ENV${obj_idx}_SFR(FE)"]} {
+ if {[subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR(FE)"]} {
set scon [expr {$scon | 0x80}]
}
- } {
- if {[subst "\$::Simulator_GUI::ENV${obj_idx}_SFR(SM0)"]} {
+ } else {
+ if {[subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR(SM0)"]} {
set scon [expr {$scon | 0x80}]
}
}
@@ -2737,7 +2763,7 @@ class Simulator_GUI {
# This function cannot run multithreaded
if {$bitmap_hex_validation_ena} {
set bitmap_hex_validation_ena 0
- } {
+ } else {
return 1
}
@@ -2771,7 +2797,7 @@ class Simulator_GUI {
SCON {
if {[$this get_SMOD0]} {
lset bitList 0 FE
- } {
+ } else {
lset bitList 0 SM0
}
}
@@ -2789,7 +2815,7 @@ class Simulator_GUI {
set bitVal [lindex $bits $i]
if {$bitVal} {
set color $on_color
- } {
+ } else {
set color $off_color
}
@@ -2831,7 +2857,7 @@ class Simulator_GUI {
-text "[mc $name]:" -fg $name_color \
-anchor w -pady 0 -font $bitfont \
] -row $row -column 1 -in $parent -sticky w
- setStatusTip -widget $Simulator_panel_parent._${name}_l -text $stip
+ setStatusTip -widget $Simulator_panel_parent._${name}_l -text [mc $stip]
set col 1 ;# Bit label column (2..9)
set bitNum -1 ;# Bit number (0..7)
@@ -2847,9 +2873,9 @@ class Simulator_GUI {
incr Idx
set idx $Idx
set cursor {left_ptr}
- } {
+ } else {
set color $off_color
- set cursor {hand1}
+ set cursor {hand2}
set idx {}
}
@@ -2863,7 +2889,7 @@ class Simulator_GUI {
bind $label <Enter> {+%W configure -font $::Simulator_GUI::bitfont_under}
bind $label <Leave> {+%W configure -font $::Simulator_GUI::bitfont}
}
- DynamicHelp::add $label -text [subst [mc $tooltip]]
+ DynamicHelp::add $label -text [mc [subst $tooltip]]
grid $label -row $row -column $col -in $parent
# Skip registration of empty bits
@@ -2894,7 +2920,7 @@ class Simulator_GUI {
# @parm void
public method bit_popup_menu_setto {bool} {
if {!$sim_enabled} {return}
- if {$bool != [subst "\$::Simulator_GUI::ENV${obj_idx}_SFR([lindex $bit_popup_menu_args 0])"]} {
+ if {$bool != [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR([lindex $bit_popup_menu_args 0])"]} {
eval "sim_invert $bit_popup_menu_args"
}
}
@@ -2908,7 +2934,7 @@ class Simulator_GUI {
# This function cannot run multithreaded
if {$sync_PC_in_progress} {
return 1
- } {
+ } else {
set sync_PC_in_progress 1
}
@@ -2972,7 +2998,7 @@ class Simulator_GUI {
set lineNum [$this simulator_getCurrentLine]
if {$lineNum != {}} {
$this move_simulator_line $lineNum
- } {
+ } else {
$this editor_procedure {} unset_simulator_line {}
}
}
@@ -2992,7 +3018,7 @@ class Simulator_GUI {
# This function cannot run multithreaded
if {$sync_Px_in_progress} {
return 1
- } {
+ } else {
set sync_Px_in_progress 1
}
@@ -3079,7 +3105,7 @@ class Simulator_GUI {
# This function cannot run multithreaded
if {$sync_AB_in_progress} {
return 1
- } {
+ } else {
set sync_AB_in_progress 1
}
@@ -3089,7 +3115,7 @@ class Simulator_GUI {
return 1
}
- # Determinate maximum length acording to numeric base
+ # Determinate maximum length according to numeric base
switch -- $num_base {
{hex} {set max_len 2}
{dec} {set max_len 3}
@@ -3174,15 +3200,15 @@ class Simulator_GUI {
}
# Determinate character representation
if {$dec > 31 && $dec < 127} {
- set char [subst "\\u00$hex"]
- } {
+ set char [subst -nocommands "\\u00$hex"]
+ } else {
set char {}
}
# Synchronize with other entries
foreach base {hex dec bin oct char} {
if {$base == $num_base} {continue}
- set ::Simulator_GUI::ENV${obj_idx}_${register}_$base [subst "\$$base"]
+ set ::Simulator_GUI::ENV${obj_idx}_${register}_$base [subst -nocommands "\$$base"]
}
# Synchronize with Right panel and Engine
@@ -3194,7 +3220,7 @@ class Simulator_GUI {
$this sfr_watches_sync 224 $dec_val
$this sfrmap_map_sync 224 $dec_val
# Register B
- } {
+ } else {
$this setSfr 240 $hex
set dec_val [expr "0x$hex"]
$this sfr_watches_sync 240 $dec_val
@@ -3212,8 +3238,8 @@ class Simulator_GUI {
# @return void
public method create_help_window_Rx {R_index} {
# Determinate true register address (decimal)
- set RS0 [subst "\$::Simulator_GUI::ENV${obj_idx}_SFR(RS0)"]
- set RS1 [subst "\$::Simulator_GUI::ENV${obj_idx}_SFR(RS1)"]
+ set RS0 [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR(RS0)"]
+ set RS1 [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR(RS1)"]
if {$RS0} {incr R_index 8}
if {$RS1} {incr R_index 16}
@@ -3228,11 +3254,11 @@ class Simulator_GUI {
# @parm String bit - Bit name (not address)
# @return void
public method sim_GUI_bit_set_clear {bool reg bit} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
if {$bool} {
$Simulator_panel_parent._${reg}_${bit} configure -fg $on_color
- } {
+ } else {
$Simulator_panel_parent._${reg}_${bit} configure -fg $off_color
}
}
@@ -3244,14 +3270,14 @@ class Simulator_GUI {
# @parm Bool hex_reg - Bitmap is connected to hexadecimal entry
# @return void
public method sim_invert {bitName bitNumber registerName hex_reg} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
set decVal_increment 0
# Simulator must be engaged
if {!$sim_enabled} {return}
# Determinate bit boolean value
- set bitBoolVal [subst "\$::Simulator_GUI::ENV${obj_idx}_SFR($bitName)"]
+ set bitBoolVal [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_SFR($bitName)"]
# Determinate bit decimal and hexadecimal value
set addr [symb_name_to_hex_addr $registerName]
@@ -3260,8 +3286,8 @@ class Simulator_GUI {
set bitDecVal 0
set bitmap_hex_validation_ena 0
if {$hex_reg} {
- set decVal [expr "0x[subst "\$::Simulator_GUI::ENV${obj_idx}_${registerName}"]"]
- } {
+ set decVal [expr "0x[subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_${registerName}"]"]
+ } else {
set decVal [$this getSfrDEC $addr]
}
switch -- $bitNumber {
@@ -3279,7 +3305,7 @@ class Simulator_GUI {
if {$bitBoolVal} {
$Simulator_panel_parent._${registerName}_$bitName configure -fg $off_color
set decVal_increment -$bitDecVal
- } {
+ } else {
$Simulator_panel_parent._${registerName}_$bitName configure -fg $on_color
set decVal_increment $bitDecVal
}
@@ -3434,16 +3460,16 @@ class Simulator_GUI {
{86} {return SPDR}
{96} {return EECON}
{8F} {
- if {[$this get_feature_avaliable ckcon]} {
+ if {[$this get_feature_available ckcon]} {
return {CKCON}
- } {
+ } else {
return {CLKREG}
}
}
{A7} {
- if {[$this get_feature_avaliable wdtcon]} {
+ if {[$this get_feature_available wdtcon]} {
return {WDTCON}
- } {
+ } else {
return {WDTPRG}
}
}
@@ -3453,7 +3479,7 @@ class Simulator_GUI {
## Switch active register bank (Current bank number is based on bits SFR(RS0) SFR(RS1))
# @return void
public method sim_switch_bank {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
# Determinate bank offset
set bnk [$this getBank]
@@ -3461,7 +3487,7 @@ class Simulator_GUI {
# Synchronize active bank register entries
for {set i 0} {$i < 8} {incr i} {
- set value [subst "\$::Simulator_GUI::ENV${obj_idx}_DATA([expr {$index + $i}])"]
+ set value [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_DATA([expr {$index + $i}])"]
set ::Simulator_GUI::ENV${obj_idx}_R$i $value
}
}
@@ -3661,7 +3687,7 @@ class Simulator_GUI {
# Register name (SFR only)
} else {
- set val [subst "\$::Simulator_GUI::ENV${obj_idx}_$addr"]
+ set val [subst -nocommands "\$::Simulator_GUI::ENV${obj_idx}_$addr"]
set addr [symb_name_to_hex_addr $addr]
append addr { SFR}
}
@@ -3675,9 +3701,12 @@ class Simulator_GUI {
# @return Bool - result
public method clock_validate {number} {
# Check for allowed characters
- if {![string is digit -strict $number]} {
+ if {$number == {}} {
+ set number 0
+ } elseif {![regexp {^\d+(\.\d*)?$} $number]} {
return 0
}
+ set number [string trimright $number {.}]
# Check for allowed range
if {$number > 99999} {
@@ -3697,11 +3726,11 @@ class Simulator_GUI {
# @parm String args - any arguments
# @return void
public method simulator_hexeditor {args} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
eval "$hexeditor $args"
}
- ## Binding for event CellValueChanged in hexeditor
+ ## Binding for event CellValueChanged in hex editor
# @parm Int address - Address of changed cell
# @parm Int value - New cell value
# @return void
@@ -3716,7 +3745,7 @@ class Simulator_GUI {
if {$address < 32} {
set ::Simulator_GUI::ENV${obj_idx}_DATA($address) $value
entry_bank_reg_sync $address $value
- } {
+ } else {
entry_idata_reg_sync $address $value
}
}
@@ -3729,7 +3758,7 @@ class Simulator_GUI {
public method simulator_gui_scroll_set {orient frac0 frac1} {
if {$orient == {x}} {
set scrollbar $horizontal_scrollbar
- } {
+ } else {
set scrollbar $vertical_scrollbar
}
@@ -3740,11 +3769,11 @@ class Simulator_GUI {
update
}
# Show scrollbar
- } {
+ } else {
if {![winfo ismapped $scrollbar]} {
if {$orient == {x}} {
pack $scrollbar -fill x -side top -before $scrollable_frame
- } {
+ } else {
pack $scrollbar -fill y -side left
}
}
@@ -3761,7 +3790,7 @@ class Simulator_GUI {
unset ::Simulator_GUI::ENV${obj_idx}_${var}
}
}
- if {$gui_initialized} {
+ if {$sim_gui_gui_initialized} {
menu_Sbar_remove $bitmenu
}
}
@@ -3781,14 +3810,14 @@ class Simulator_GUI {
## Change image on button "Step over" (from "Pause" to "Goto" or backwards)
# @return void
public method invert_stepover_button {} {
- if {!$gui_initialized || !$sim_enabled} {return}
+ if {!$sim_gui_gui_initialized || !$sim_enabled} {return}
# Determinate ID of the current image
set image [$ctrl_f.controls_quick_step cget -image]
# Change image
if {$image == {::ICONS::16::goto2}} {
$ctrl_f.controls_quick_step configure -image ::ICONS::16::player_pause
- } {
+ } else {
$ctrl_f.controls_quick_step configure -image ::ICONS::16::goto2
}
}
@@ -3796,14 +3825,14 @@ class Simulator_GUI {
## Change image on button "Animate" (from "Pause" to "Right arrow" or backwards)
# @return void
public method invert_animate_button {} {
- if {!$gui_initialized || !$sim_enabled} {return}
+ if {!$sim_gui_gui_initialized || !$sim_enabled} {return}
# Determinate ID of the current image
set image [$ctrl_f.controls_animate cget -image]
# Change image
if {$image == {::ICONS::16::1rightarrow}} {
$ctrl_f.controls_animate configure -image ::ICONS::16::player_pause
- } {
+ } else {
$ctrl_f.controls_animate configure -image ::ICONS::16::1rightarrow
}
}
@@ -3811,14 +3840,14 @@ class Simulator_GUI {
## Change image on button "Run" (from "Pause" to "Double right arrow" or backwards)
# @return void
public method invert_run_button {} {
- if {!$gui_initialized || !$sim_enabled} {return}
+ if {!$sim_gui_gui_initialized || !$sim_enabled} {return}
# Determinate ID of the current image
set image [$ctrl_f.controls_run cget -image]
# Change image
if {$image == {::ICONS::16::2rightarrow}} {
$ctrl_f.controls_run configure -image ::ICONS::16::player_pause
- } {
+ } else {
$ctrl_f.controls_run configure -image ::ICONS::16::2rightarrow
}
}
@@ -3826,11 +3855,11 @@ class Simulator_GUI {
## Set state of button "StepBack" on simulator control panel
# @return void
public method stepback_button_set_ena {bool} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
if {$bool} {
set state {normal}
- } {
+ } else {
set state {disabled}
}
$ctrl_f.controls_stepback configure -state $state
@@ -3839,7 +3868,7 @@ class Simulator_GUI {
## Disable simulator control panel (shoud be called after simulator engine disengagement)
# @return void
public method sim_disable {} {
- if {!$gui_initialized} {return}
+ if {!$sim_gui_gui_initialized} {return}
set sim_enabled 0 ;# Clear enabled flag
@@ -3877,7 +3906,7 @@ class Simulator_GUI {
## Enable simulator control panel (shoud be called after simulator engine engagement)
# @return void
public method sim_enable {} {
- if {!$gui_initialized} {CreateSimulatorGUI}
+ if {!$sim_gui_gui_initialized} {CreateSimulatorGUI}
set sim_enabled 1 ;# Set enabled flag
@@ -3915,7 +3944,12 @@ class Simulator_GUI {
# @parm String text - text to display
# @return void
public method sim_txt_output {txt} {
- tk_messageBox -title [mc "Simulator"] -type ok -message $txt
+ tk_messageBox \
+ -parent . \
+ -icon info \
+ -type ok \
+ -message $txt \
+ -title [mc "Simulator"]
}
## Focus on the given target entry widget if the current insertion index is equivalent to the end index
@@ -3944,10 +3978,10 @@ class Simulator_GUI {
focus $target_entry
}
- ## Get list of avaliable SFRs
+ ## Get list of available SFRs
# @return List - {{dec_addr reg_name} ...}
public method simulator_get_sfrs {} {
- if {!$gui_initialized} {CreateSimulatorGUI}
+ if {!$sim_gui_gui_initialized} {CreateSimulatorGUI}
return $sf_registers
}
@@ -3967,15 +4001,15 @@ class Simulator_GUI {
if {$bool} {
if {[$widget cget -font] == $smallfont} {
set bg $small_color
- } {
+ } else {
set bg $name_color
}
set fg {#FFFFFF}
- } {
- set bg {#EEEEEE}
+ } else {
+ set bg ${::COMMON_BG_COLOR}
if {[$widget cget -font] == $smallfont} {
set fg $small_color
- } {
+ } else {
set fg $name_color
}
}
@@ -3984,3 +4018,7 @@ class Simulator_GUI {
$widget configure -bg $bg -fg $fg
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard