# Path: dragonpy/utils/humanize.py
# def nice_hex(v):
#     """
#     >>> nice_hex(0x1)
#     '$01'
#     >>> nice_hex(0x123)
#     '$0123'
#     """
#     if v < 0x100:
#         return f"${v:02x}"
#     if v < 0x10000:
#         return f"${v:04x}"
#     return f"${v:x}"


import logging
from MC6809.core.memory_info import BaseMemoryInfo
from dragonpy.utils.humanize import nice_hex

if __name__ == "__main__":
    #     mem_info = VectrexMemInfo(print_out)
    #
    #     # 0xaf-0xaf - TRON/TROFF trace flag - non zero for TRON
    #     mem_info(0xaf)
    #     mem_info(0xaf, shortest=False)
    #     print
    #
    #     # 5x entries
    #     mem_info(0xbff0)
    #     mem_info(0xbff0, shortest=False)
    #     print
    #
    #     # 0xf-0x18 - Temporary results
    #     mem_info(0xf)
    #     mem_info(0xf, shortest=False)
    #     print
    #     mem_info(0x10)
    #     mem_info(0x10, shortest=False)
    #     print
    #     mem_info(0x18)
    #     mem_info(0x18, shortest=False)
    #     print
    #
    #     print "\n --- END --- \n"
    for s, e, txt in VectrexMemInfo.MEM_INFO:
        if s == e:
            addr = nice_hex(s)
        else:

# Path: dragonpy/utils/humanize.py
# def nice_hex(v):
#     """
#     >>> nice_hex(0x1)
#     '$01'
#     >>> nice_hex(0x123)
#     '$0123'
#     """
#     if v < 0x100:
#         return f"${v:02x}"
#     if v < 0x10000:
#         return f"${v:04x}"
#     return f"${v:x}"


# Path: dragonpy/vectrex/mem_info.py
import logging
from MC6809.core.memory_info import BaseMemoryInfo
from dragonpy.utils.humanize import nice_hex


if __name__ == "__main__":
    #     mem_info = VectrexMemInfo(print_out)
    #
    #     # 0xaf-0xaf - TRON/TROFF trace flag - non zero for TRON
    #     mem_info(0xaf)
    #     mem_info(0xaf, shortest=False)
    #     print
    #
    #     # 5x entries
    #     mem_info(0xbff0)
    #     mem_info(0xbff0, shortest=False)
    #     print
    #
    #     # 0xf-0x18 - Temporary results
    #     mem_info(0xf)
    #     mem_info(0xf, shortest=False)
    #     print
    #     mem_info(0x10)
    #     mem_info(0x10, shortest=False)
    #     print
    #     mem_info(0x18)
    #     mem_info(0x18, shortest=False)
    #     print
    #
    #     print "\n --- END --- \n"
    for s, e, txt in VectrexMemInfo.MEM_INFO:
        if s == e:
            addr = nice_hex(s)
        else:

            addr = f"{nice_hex(s)}-{nice_hex(e)}"