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 | |
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')
-rw-r--r-- | bin/README.md | 1 | ||||
-rw-r--r-- | bin/handler.py | 2 | ||||
-rw-r--r-- | bin/world.py | 14 |
3 files changed, 14 insertions, 3 deletions
diff --git a/bin/README.md b/bin/README.md index 059439d..6bb42a5 100644 --- a/bin/README.md +++ b/bin/README.md @@ -22,6 +22,7 @@ $ ./bin/salis.py load --file 16.sim |`S` |Scroll to top (PROCESS and WORLD page) | |`A` |Scroll to left (PROCESS page) | |`zx` |Zoom in/out (WORLD page) | +|`i` |Toggle IP view (WORLD page) | |`op` |Select previous/next organism | |`g` |Toggle data/gene view (PROCESS page) | |`c` |Open console (pauses simulation) | diff --git a/bin/handler.py b/bin/handler.py index b675159..9305d14 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -94,6 +94,8 @@ class Handler: self.__printer.proc_scroll_to_selected() elif cmd == ord("g"): self.__printer.proc_toggle_gene_view() + elif cmd == ord("i"): + self.__printer.world.toggle_ip_view() elif cmd == ord("\n"): self.__printer.run_cursor() elif cmd == ord("c"): 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 |