Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Disgusted by FreeDOS 1.3RC installation CD (Users)

posted by Ringding, 03.05.2021, 20:36

This reproduces the function of REPACK.C in Python:

import sys
def main():
    outl = []
    bb = b"".join(open(sys.argv[1], "rb").read().split(b"\r\n"))
    for p in range(0, len(bb)-1, 16):
        t = bb[p:p+16]
        d = 0
        for n in range(4):
            v = 0
            for m in reversed(t[:4]):
                v = v*92 + m-34
            d = (d<<26) + v
            t = t[4:]
        outl.append(d.to_bytes(13, "big"))
    lcorr = bb[-1]-34-52
    assert lcorr<0
    open(sys.argv[2], "wb").write(b"".join(outl)[:lcorr])
main()

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 75 users online (0 registered, 75 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum