Skip to content

Instantly share code, notes, and snippets.

@tako2
tako2 / dumplist.py
Created April 1, 2021 07:47
Dump binary file with check sums like pages published on retro pc magazines.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser
#==============================================================================
def dump_block(addr, data):
print('Add +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F :Sum')
idx = 0
@tako2
tako2 / img2pdf.py
Created June 14, 2021 15:33
画像ファイルを PDF に出力
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PIL import Image
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib import pdfencrypt
from reportlab.lib.units import mm
from reportlab.lib.units import cm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from optparse import OptionParser
import sys
import os
#==============================================================================
def put_chunk(f, chunk):
checksum = ((~sum(chunk)) + 1) & 0xff
@tako2
tako2 / bin2mi.py
Created February 1, 2025 07:40
Translate binary file to .mi file (for GOWIN FPGA Designer)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser
#==============================================================================
def dump_bin(out_fp, top_addr, data, size):
for addr in range(0, size, 16):
out_fp.write('{:04X}:'.format(top_addr + addr))