8 Bit fonts from C64 games

Previous topic - Next topic

Kitty Hello

http://kofler.dot.at/c64/font_01.html has some fonts as bitmaps, so I think you can use them 1:1 in your games.
...pay attention to copyrights.

ampos

I remember "ripping" the font charsert (16x16 pixels) of RAMBO game and making a video-titler for my father wedding videos... LOL.

I am still amazed I was able to do this with 17 years...

Ruidesco

Wedding videos with Rambo lettering, now that is something you don't see every day. =D

ampos

They were not so bad... considering my other fonts were drawn with the original C64 font grafics (they look as letters made with pipes):


Ruidesco

I didn't mean they were bad, they were pretty nice all considered. What I mean is that they are army-like chars being used in a wedding video. :P

Slydog

Quote from: ampos on 2011-Nov-09
I remember "ripping" the font charsert (16x16 pixels) of RAMBO

16x16?  Wasn't the custom fonts limited to 8x8?
Did you have to make a custom 'print' routine that would plot a 2x2 custom font character to make up one letter?
Or were they sprites?  (but if I recall, you didn't have many sprites to play with)

But still, very talented at 17!
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

ampos

Yes, the big one, 16x16s.

In C64 it was very easy to print big letters, as you can insert cursor movements inside a string (do you remember the black chars inside the ""?)

It was some thing like

Code (glbasic) Select
ch$(33)="QW(left)(left)(down)AS")

So if you do

Code (glbasic) Select
Print ch$(33)

you got

Code (glbasic) Select
QW
AS


In a Vic20 Karate game I did, there was 2 characters on screen that fills the entire screen. I move them just with a print command, as the string itself was full of cursor movements...

Ah, they was the days...




Hatonastick

LOL That was exactly the reasoning behind my push for our first computer too ie. "We bought it to help with your homework", but like everyone else I spent more time playing games (and programming) than doing homework on it. :)
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

fuzzy70

I wrote a little proggy to convert the C64 files from the site Kitty linked into a usable bitmap for LOADFONT. The source & the files are all in the zip.

There are a few "To-do's" like the double width, height etc so this just rips the standard 8x8 chars. The normal fonts are the same name with .bmp bolted on & I couldn't work out what to do with the rest (ascii wise) so just dumped them into another file with the extension "_udg.bmp". Most are all upper case thanks to the way the files are laid out so if you want both upper & lower happy editing in photoshop or whatever  :D

Excuse the code, not the best I have written but then again its not a program I have spent much time on & just a quick hack.

Lee

Code (glbasic) Select
// --------------------------------- //
// Project: 64fontToGLB
// Start: Wednesday, November 09, 2011
// IDE Version: 10.159

TYPE Tgrid8x8
xpos%
ypos%
ENDTYPE

GLOBAL grid%[] AS Tgrid8x8, charbytes%[], charpixels%[], stdchars%[]

LOCAL files$[], getlist%, xgrid%, ygrid%,tcount%=0

DIM grid%[256]
DIM charbytes%[8]
DIM charpixels[8][8]
DIM stdchars[64]

RESTORE c64mappings
FOR tcount%=0 TO 63
READ stdchars%[tcount%]
NEXT

tcount% = 0 // Reset tempcount variable

FOR ygrid%=0 TO 15 // Populate the grid% array with
FOR xgrid%=0 TO 15 // the x & y positions to help
grid%[tcount%].xpos% = xgrid%*8 // plot the chars in the right place
grid%[tcount%].ypos% = ygrid%*8
INC tcount%,1
NEXT
NEXT

SETCURRENTDIR("Input") // go to C64 files

getlist% = GETFILELIST("*.64c", files$[])

FOR i=2 TO BOUNDS(files$[], 0)-1

IF files$[i]<>"." AND files$[i]<>".." THEN readfile(files$[i])
USESCREEN -1
DRAWSPRITE 1,0,0
DRAWSPRITE 2,0,129
PRINT "Processing char set "+i,0,380
SHOWSCREEN

NEXT
PRINT "COMPLETE - Press mouse to exit",0,400
SHOWSCREEN
MOUSEWAIT

FUNCTION readfile: file$
LOCAL charcount%=0,rbyte%,cline%=0,fonttype%=0,udgchar%=0,outfile$
CREATESCREEN 0,1,128,128
CREATESCREEN 1,2,128,128
CREATESCREEN 2,3,128,128
OPENFILE(1,file$,1)
IF INSTR(file$,"_multi.64c")<>-1 THEN RETURN
IF INSTR(file$,"_x.64c")<>-1 THEN fonttype%=1
IF INSTR(file$,"_y.64c")<>-1 THEN fonttype%=2
IF INSTR(file$,"_xy.64c")<>-1 THEN fonttype%=3
FILESEEK 1,2,0
WHILE NOT ENDOFFILE(1)

READBYTE 1,rbyte%

    SELECT fonttype%
    CASE 0
IF charcount%<=63
USESCREEN 0
bytetobits(rbyte%,cline%)
INC cline%,1
IF cline%>=8
cline%=0
drawchar(8,8,stdchars%[charcount%])
INC charcount%,1
ENDIF
ELSE
USESCREEN 1
bytetobits(rbyte%,cline%)
INC cline%,1
IF cline%>=8
cline%=0
drawchar(8,8,udgchar%)
INC udgchar%,1
ENDIF
ENDIF
CASE 1
// todo
CASE 2
// todo
CASE 3
// todo
ENDSELECT
WEND

CLOSEFILE 1

IF fonttype%=0
USESCREEN 2
DRAWRECT 0,0,128,128,RGB(0,0,0)
DRAWSPRITE 1,0,0
outfile$=file$+".bmp"
SAVESPRITE outfile$,3
ENDIF

IF udgchar%>0
USESCREEN 2
DRAWRECT 0,0,128,128,RGB(0,0,0)
DRAWSPRITE 2,0,0
outfile$=file$+"_udg.bmp"
SAVESPRITE outfile$,3
ENDIF

ENDFUNCTION

FUNCTION bytetobits: byte%,lineno%
LOCAL bittest% , bitcount%
FOR bitcount%=0 TO 7
bittest%=bAND(byte%,128)
IF bittest%
charpixels%[bitcount%][lineno%]=1
ELSE
charpixels%[bitcount%][lineno%]=0
ENDIF
byte%=ASL(byte%,1)
NEXT
ENDFUNCTION

FUNCTION drawchar: sizex%,sizey%,charpos%
LOCAL x%,y%
FOR y%=0 TO sizex%-1
FOR x%=0 TO sizey%-1
IF charpixels%[x][y]
SETPIXEL x%+grid%[charpos%].xpos,y%+grid%[charpos%].ypos,RGB(255,255,255)
ENDIF
NEXT
NEXT
ENDFUNCTION


STARTDATA c64mappings:
// Data = GLBasic(Ascii) position

// char 0, @
DATA 64

// Chars 1-26, A-Z
DATA 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90

// Chars 27-29, [ £ ]
DATA 91,163,93

// Chars 30-31, Up & left arrow graphic
DATA 128,129

// Chars 32-47, Space ! " # $ % & ' ( ) * + , - . /
DATA 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47

// Chars 48-57 , 0 1 2 3 4 5 6 7 8 9
DATA 48,49,50,51,52,53,54,55,56,57

// Chars  58-63, : ; < = > ?
DATA 58,59,60,61,62,63
ENDDATA



[attachment deleted by admin]
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Ruidesco

Awesome! :nw:
PS. This forum needs a "thanks for this post" button so bad. =D

erico

Quote from: ampos on 2011-Nov-09
I am still amazed I was able to do this with 17 years...

That is the least I expect from a movie actor!! :nana:

chve

#11
A wondefull code which helps a lot   :good:

I like to see those "small" and great pieces of code "translated" into bmp fonts  :enc:

Thank  you very much  fuzzy70  :)

r0ber7


fuzzy70

Quote from: r0ber7 on 2011-Nov-18
Nice one fuzzy70.  :good:

Ty :)

Being the sad retro freak that I am work is nearly complete on a GLB program that reads real Amiga fonts & creates a bitmap/sprite sheet lol

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

r0ber7

Quote from: fuzzy70 on 2011-Nov-18
Quote from: r0ber7 on 2011-Nov-18
Nice one fuzzy70.  :good:

Ty :)

Being the sad retro freak that I am work is nearly complete on a GLB program that reads real Amiga fonts & creates a bitmap/sprite sheet lol

Lee

!!!!! Could you share the source? I haven't found a font yet and being an Amiga fan still, I'd absolutely love to use an Amiga font in my game!  <3