Skip to content

Commit

Permalink
Documented usage of the lz4_8088 decompressor, and added crab source …
Browse files Browse the repository at this point in the history
…images
  • Loading branch information
foone committed Jun 4, 2022
1 parent 38a08f9 commit 6e7876c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Type ```VGAPRIDE LIST | MORE``` to see a list of included flags

# Building

This project uses Borland Turbo C++ 3.0.
This project uses Borland Turbo C++ 3.0 and Borland Turbo Assembler 5.0.

1. First, you need to create the EGAVGA.OBJ file. Use the BGIOBJ.EXE file in TC\BGI to compile it with ```BGIOBJ EGAVGA```
2. Copy the resulting OBJ file into the main project directory
Expand All @@ -18,4 +18,6 @@ This project uses Borland Turbo C++ 3.0.

# License

The code is licensed under the terms of the GPL, version 3.
The code is licensed under the terms of the GPL, version 3.

It uses Jim Leonard's [lz4_8088](http://www.oldskool.org/pc/lz4_8088), which is under the the Demoscene License.
9 changes: 9 additions & 0 deletions crabs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Useful commands:

```
convert crabgay.png -colors 256 crabgay256.png
identify -verbose crabgay256.png
python planize.py
lz4 -c2 stdin trans0.dat.lz4 0<trans0.dat
xxd -i crab0.dat.lz4 >> ../crabs.c
```
Binary file added crabs/crabgay256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crabs/crabtran256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions crabs/planize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from PIL import Image
im=Image.open('crabtran256.png')
w,h=im.size
buffers=[[],[],[],[]]
bits=[1<<i for i in range(8)][::-1]
for y in range(h):
for x in range(w):
v=im.getpixel((x,y))
for o in range(4):
buffers[o].append(1 if v&(1<<o) else 0)
outbuffers=[]
for buffer in buffers:
cbuffer=[]
for i in range(0,len(buffer),8):
x=buffer[i:i+8]
v=sum([a*b for (a,b) in zip(x,bits)])
#print v ,x
cbuffer.append(chr(v))
outbuffers.append(cbuffer)
for i,buffer in enumerate(outbuffers):
with open('trans{}.dat'.format(i),'wb') as f:
f.write(''.join(buffer))


Binary file added crabs/transparent_crab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crabs/undithered_crab_pride.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crabs/undithered_crab_trans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e7876c

Please sign in to comment.