Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Rodrigo Yeowtch ! (Registered 2024-11-24) You are not logged in - nap
CSDb User Forums


Forums > CSDb Entries > Release id #163421 : Smallest We Can [30 bytes]
2018-04-01 12:44
Pex Mahoney Tufvesson

Registered: Sep 2003
Posts: 52
Release id #163421 : Smallest We Can [30 bytes]

When trying to make the font creation even smaller than 39 bytes, I decided to put parts of the code into the filename.

Since the 128b compo clearly states that the entry is to be handed in as prg, the filenames needs to be Win/linux/osx compatible:

OSX is pretty forgiving: Filenames may not contain 0x00, ":" or "/". Seems ok.

Windows is a little stricter: Filenames may not contain 0x00-0x1f, may not end with space, may not end with ".", cannot contain either of
the chars <>:"/|\=*

But, it seems Vice (at least v3.1 on OSX) filter the filenames as well, it only permits chars a-zA-Z0-9!#%$@&()=+-;<>_^*'?

So, the least common denominator is !a-zA-Z0-9#%$@&()=+-;_^'

I decided to encode 4 bits in every char. Decoder takes 28 bytes:
org $0801
.word $0809,$d000
.byte $9e,"2061",0,0,0
decmore:
lda ($bb),y
asl
asl
asl
asl
iny
eor ($bb),y
sta dest,x
inx
iny
bne decmore
dest:

And encoding is done with a small Python script:

from shutil import copyfile
fn = open("into_filename.prg",'r+b')
fileprg = fn.read()
fn.close()

odds = "pabcdefghijklmno"
name = ""

for byt in fileprg:
oddchar = odds[byt & 0x0f]
byt2 = byt ^ (ord(oddchar) - 0x20)
evenchar = odds[byt2 >> 4]
name = name + evenchar
name = name + oddchar

print ("name length=%d" % len(name))
name = name + ".prg"
print ("name=%s" % name)
copyfile("mahoneyfont2.prg", name)


The program encoded in the filename is:
; A rom-based font in < 128 bytes by Pex Mahoney Tufvesson,
; created for the CSDb 128b font compo initiated by lft.

org $081d
sei
lda #$19
sta $D018
lsr $01
copymore:
lda ($39),y ;current basic line number
rla ($39),y ;current basic line number
sta ($fe),y
iny
bne copymore
inc $ff
inc $3a
bne copymore
rol $01
rts

which results in the filename: chnieilmehhppfdaoagigcgimaknhhhpkgjfkojfgjhpkaffdacp.prg

...making a custom font in 28+2 bytes!

Anyway, it happened to work with my setup: MacOS, x64sc and vice v3.1

Putting the program on a d64 wouldn't work, since filenames on disk are limited to 16 chars.
Putting the program into a .t64 file wouldn't work, since filenames in that file format are limited to 16 bytes.
However, filenames on Datasette (.tap-files are the closes we'll come in emulator-land) can use 187 chars, so as a tape loaded font creation, it would be ok!


Peace, love and font creation! / Pex
---
Have a noise night!
http://mahoney.c64.org
2018-04-01 13:17
Rastah Bar
Account closed

Registered: Oct 2012
Posts: 336
Thanks for the explanation. Very interesting!
2018-04-01 13:35
Mixer

Registered: Apr 2008
Posts: 447
Pex taking it to level 2 again :), but... now i can't count the bytes, they're meaningless! :(
2018-04-01 13:39
tlr

Registered: Sep 2003
Posts: 1787
Worst abuse of rules. Brilliant! ;)
2018-04-01 17:21
Rastah Bar
Account closed

Registered: Oct 2012
Posts: 336
On a real C64, which characters are not allowed in a filename?
The code below copymore: without the ROL $01 is 16 bytes ...
2018-04-01 17:28
Pex Mahoney Tufvesson

Registered: Sep 2003
Posts: 52
On a d64, filenames are padded with an $a0, so I guess that's illegal.
And a .t64 file (which indeed has _nothing_ to do with a real Datasette), filenames are padded with $20.
Apart from that, I guess it will be fine. So, no JSR $xxxx or LDY #$xx
:)
---
Have a noise night!
http://mahoney.c64.org
2018-04-09 10:31
Copyfault

Registered: Dec 2001
Posts: 474
First of all: f**cking ace decompression algo, Mahoney! As you said several times, it's the fun part of madness. Can it adequately be put into words what this c64 drives us to ;) ? Guess never ever!

I gave this approach a go but wanted to stick to real hw with a 1541 disc drive. Ended up quite Font-o-holic [31 bytes].

That jmp($00bb) was utilised amongst other things. Do not exactly know which characters are not allowed, but it really made the task even more difficult. A pity lft did not bend the rules to allow at least this case. But ofcourse I can live with it ;)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
katon/Lepsi De
Grue/Extend
Jetboy/Elysium
iAN CooG/HVSC
CopAss/Leader
Barfly/Extend
Visage/Lethargy
Krill/Plush
Airwolf/F4CG
Francois Prijt/Audia..
Electric/Extend
Fresh
Brush/Elysium
EALL/HT
bexxx
krissz
Guests online: 119
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Wonderland XIV  (9.6)
8 Comaland 100%  (9.6)
9 What Is The Matrix 2  (9.6)
10 No Bounds  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Libertongo  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Morph  (9.5)
9 Dawnfall V1.1  (9.5)
10 It's More Fun to Com..  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Nostalgia  (9.3)
5 Censor Design  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.056 sec.