Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
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: 37
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
lda ($bb),y
eor ($bb),y
sta dest,x
bne decmore

And encoding is done with a small Python script:

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

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
lda #$19
sta $D018
lsr $01
lda ($39),y ;current basic line number
rla ($39),y ;current basic line number
sta ($fe),y
bne copymore
inc $ff
inc $3a
bne copymore
rol $01

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!
2018-04-01 13:17
Rastah Bar

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

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

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

Registered: Oct 2012
Posts: 154
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: 37
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!
2018-04-09 10:31

Registered: Dec 2001
Posts: 241
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
Users Online
Rock/Finnish Gold
Guests online: 42
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 Comaland 100%  (9.6)
5 The Shores of Reflec..  (9.6)
6 Wonderland XII  (9.6)
7 Lunatico  (9.6)
8 We Come in Peace  (9.5)
9 Incoherent Nightmare  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 FMX Music Demo  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Pandemoniac Part 2 o..  (9.5)
4 Treu Love [reu]  (9.5)
5 Merry Xmas 2017  (9.4)
6 Arok 20 Invitation  (9.4)
7 Dawnfall V1.1  (9.4)
8 In Memoriam BHF  (9.4)
9 Dawnfall  (9.4)
10 Synthesis  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.4)
5 Crest  (9.3)
Top Graphicians
1 Razorback  (10)
2 Mirage  (9.8)
3 Archmage  (9.7)
4 JonEgg  (9.7)
5 DocJM  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.07 sec.