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 14:44
Pex Mahoney Tufvesson

Registered: Sep 2003
Posts: 36
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 15:17
Color Bar

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

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

Registered: Sep 2003
Posts: 1161
Worst abuse of rules. Brilliant! ;)
2018-04-01 19:21
Color Bar

Registered: Oct 2012
Posts: 150
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 19:28
Pex Mahoney Tufvesson

Registered: Sep 2003
Posts: 36
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 12:31
Copyfault

Registered: Dec 2001
Posts: 238
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
Moloch/TRIAD
E$G/I-IokutO ForcE
Groepaz
Fuerst Release
Dymo/G★P
skull
Sokratekk
Ziggy72
Elder0010/Onslaught
saimo
Guests online: 35
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 The Shores of Reflec..  (9.6)
5 Comaland 100%  (9.6)
6 We Come in Peace  (9.6)
7 Lunatico  (9.6)
8 Incoherent Nightmare  (9.5)
9 Wonderland XII  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Synthesis  (9.5)
3 FMX Music Demo  (9.5)
4 Pandemoniac Part 2 o..  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Treu Love [reu]  (9.5)
7 Merry Xmas 2017  (9.4)
8 Dawnfall  (9.4)
9 Gubbdata 2017 Invite  (9.3)
10 SidRok  (9.3)
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 NTSC-Fixers
1 Pudwerx  (10)
2 Horizon  (9.8)
3 The Mind Slayer  (9.7)
4 The Shadow  (9.7)
5 Stormbringer  (9.6)

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