code: def inc(self, r):
          
          self.set_flag(None)
  
          if not is_register(r):
              if r[0] == '(':  # a memory position, basically: inc(hl)
                  r_ = r[1:-1].strip()
                  v_ = self.getv(self.mem.get(r_, None))
                  if v_ is not None:
                      v_ = (v_ + 1) & 0xFF
                      self.mem[r_] = str(v_)
                      self.Z = int(v_ == 0)  # HINT: This might be improved
                  else:
                      self.mem[r_] = new_tmp_val()
              return
  
          if self.getv(r) is not None:
              self.set(r, self.getv(r) + 1)
          else:
              self.set(r, None)
docs: Does inc on the register and precomputes flags