"""Buffered one-timer for a human pass receiver (onetimer.s)."""
ORIGIN = 0x2E1000
NEAR_PX = 0


def install(data, assemble, patch):
    code = assemble('onetimer', ORIGIN)
    assert len(code) < 0x200
    patch(ORIGIN, b'\xFF' * len(code), code)
    # The fourth export exists only in the contact-safe profile.
    if code[12:14]==bytes.fromhex('6000'):
        patch(0xB810,bytes.fromhex('4eb9000fee60'),bytes.fromhex('4ef9002e100c'))
    patch(0x15EF2, bytes.fromhex('4eb9000fd78a'), bytes.fromhex('4eb9002e1004'))
    patch(0xB6C8, bytes.fromhex('0801000567005082'), bytes.fromhex('4ef9002e10004e71'))
