diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
commit | da015293b605f82399361f12cff367ebf70eaf69 (patch) | |
tree | 28efbb24001ca9f3d4daa3136bac5c2e073f52f4 /bin/world.py | |
parent | 8998e2eb104c0965b0c9f190705b70abc16b62d7 (diff) |
User may now toggle IP color layer on/off.
[#12] Allowing to toggle the IP layer (white) can help the user
better visualize of the underlying memory block structure.
Diffstat (limited to 'bin/world.py')
-rw-r--r-- | bin/world.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/world.py b/bin/world.py index 99b7724..2bfdefa 100644 --- a/bin/world.py +++ b/bin/world.py @@ -24,6 +24,7 @@ class World: self.__printer = printer self.__sim = sim self.__set_world_colors() + self.__show_ip = True self.pos = 0 self.zoom = 1 @@ -139,6 +140,13 @@ class World: else: raise RuntimeError("Error: scrolling to an invalid address") + def toggle_ip_view(self): + """ Turn on/off IP visualization. Turning off IPs might make it easier + to visualize the underlying memory block structure. + """ + if self.__is_world_editable(): + self.__show_ip = not self.__show_ip + def __set_world_colors(self): """ Define color pairs for rendering the world. Each color has a special meaning, referring to the selected process IP, SP and memory @@ -196,11 +204,11 @@ class World: # No pair has been selected yet; select pair based on bit-flags. if not "pair" in locals(): - if byte >= 0x80: + if self.__show_ip and byte >= 0x80: pair = self.pair_ip - elif byte >= 0x40: + elif (byte % 0x80) >= 0x40: pair = self.pair_mbstart - elif byte >= 0x20: + elif (byte % 0x40) >= 0x20: pair = self.pair_alloc else: pair = self.pair_free |