Changes

Programming:Unlocking ASIC

50 bytes removed, 30 March
/* Optimized versions */
def unlock_asic():
b, c, h, l = 0xBC, 0xFF, 0x90, 0xEA # Initialize registers
port_outout(b, c) port_outout(b, 0)
while c != 0x4D:
port_outout(b, c)
h, l = l, ((h << 1) | (h >> 7)) & 0xFF # Rotate h and swap h,l
c = ((c >> 1) & ~(1 << 3)) | (l & 0x88) # Modify c
port_outout(b, 0xCD) port_outout(b, 0xCD)
def port_outout(port, value):
print(f"Port: {hex(port)}xx Out: {hex(value)}")
def unlock_asic():
b, c = 0xBC, 0xFF
port_outout(b, c) port_outout(b, 0)
a = c
while True:
port_outout(b, a)
d = a
a = (((a << 2 | a >> 6) ^ d) & 0x7F) ^ d
if a == c: break
def port_outout(port, value):
print(f"Port: {hex(port)}xx Out: {hex(value)}")
13,147
edits