Changes

Jump to: navigation, search

Programming:Unlocking ASIC

451 bytes removed, 30 March
/* Madram version */
This version still uses some magic numbers.
In Z80 Assembler:
<pre>
UnlockAsic
ei
ret
</pre>
 
In Python:
<pre>
def unlock_asic():
b, c, h, l = 0xBC, 0xFF, 0x90, 0xEA # Initialize registers
out(b, c)
out(b, 0)
 
while c != 0x4D:
out(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
 
out(b, 0xCD)
out(b, 0xCD)
 
def out(port, value):
print(f"Port: {hex(port)}xx Out: {hex(value)}")
 
unlock_asic()
</pre>
13,023
edits