Custom Fonts and the programmers that love them.
Custom Fonts and the programmers that love them.
So looking through OUTLET and the rather excellent work of djnzx48
viewtopic.php?f=6&t=425&hilit=font#p5596
got my noggin' jogging - is there an easy way to load a font to use in a.) a BASIC program b.) an Assembly program.
Being a simple potato while I appreciate the work of the 64 column fonts I gotta lay it out for you fellows I don't quite get how to load the font data so you can use it in a program. I get whats happening in the program - the juicy code is the binary. My problem is this is a masterpiece in compact coding. As a starchy beginner a more basic example would be much appreciated.
I remember looking through some of the spectrum books there was one reference to using a custom font, but my memory fails me what the book was. Any link to a book or a article in the magazine would be much appreciated. If anyone is feeling generous a explanation on how to do it would be fantastic.
I can't remember the book but the sentiment of the statement I did recall 'You should use a custom font when creating a program. Don't be lazy!' Have to say I agree with the author and I have this feeling I am being a giant hack by not doing this with my programs in the past. I want to fix this.
viewtopic.php?f=6&t=425&hilit=font#p5596
got my noggin' jogging - is there an easy way to load a font to use in a.) a BASIC program b.) an Assembly program.
Being a simple potato while I appreciate the work of the 64 column fonts I gotta lay it out for you fellows I don't quite get how to load the font data so you can use it in a program. I get whats happening in the program - the juicy code is the binary. My problem is this is a masterpiece in compact coding. As a starchy beginner a more basic example would be much appreciated.
I remember looking through some of the spectrum books there was one reference to using a custom font, but my memory fails me what the book was. Any link to a book or a article in the magazine would be much appreciated. If anyone is feeling generous a explanation on how to do it would be fantastic.
I can't remember the book but the sentiment of the statement I did recall 'You should use a custom font when creating a program. Don't be lazy!' Have to say I agree with the author and I have this feeling I am being a giant hack by not doing this with my programs in the past. I want to fix this.
- Alessandro
- Dynamite Dan
- Posts: 1910
- Joined: Wed Nov 15, 2017 11:10 am
- Location: Messina, Italy
- Contact:
Re: Custom Fonts and the programmers that love them.
Standard, 32-characters per line fonts, can be customized this way.
For Z80 assembly programs, just have your font in memory at an address, say FONT_ADDRESS, and then you have to make CHARS (23606) point at it:
In BASIC:
For Z80 assembly programs, just have your font in memory at an address, say FONT_ADDRESS, and then you have to make CHARS (23606) point at it:
Code: Select all
LD HL,FONT_ADDRESS-256
LD (23606),HL
Code: Select all
POKE 23606,FONT_ADDRESS-256*INT (FONT_ADDRESS/256)
POKE 23606+1,INT (FONT_ADDRESS/256)
Re: Custom Fonts and the programmers that love them.
Thanks Alessandro, much appreciated.
I should have dug harder and actually googled this.
10 year old blog post:
http://szeligaski.blogspot.co.uk/2008/1 ... r-set.html
3 months ago:
https://markhardisty.wordpress.com/2018 ... ames-font/
I should have dug harder and actually googled this.
10 year old blog post:
http://szeligaski.blogspot.co.uk/2008/1 ... r-set.html
3 months ago:
https://markhardisty.wordpress.com/2018 ... ames-font/
- Einar Saukas
- Bugaboo
- Posts: 3099
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Custom Fonts and the programmers that love them.
A very easy method is, load a custom font at address 64000, then POKE 23607,249
You can find lots of custom fonts in ZX-ALFA.
Code: Select all
10 CLEAR 63999
20 LOAD ""CODE 64000
30 POKE 23607,249
Re: Custom Fonts and the programmers that love them.
Obrigado, muito agradável.
Re: Custom Fonts and the programmers that love them.
I'm a big fan of Einar's FZX proportional fonts. I'm even using it in Robotron where the font is almost (but not quite) fixed width.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Custom Fonts and the programmers that love them.
In assembly, write your own print routine, then the font can be any form you want. Or you write the routine around how the font is stored.
You can load a font in memory and POKE the system variables to point to it then use ROM printing if you like things slow.
You can load a font in memory and POKE the system variables to point to it then use ROM printing if you like things slow.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Custom Fonts and the programmers that love them.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
- PeteProdge
- Bugaboo
- Posts: 3572
- Joined: Mon Nov 13, 2017 9:03 am
Re: Custom Fonts and the programmers that love them.
Last week I watched ChinnyVision's review of Toobin'. It's a multi-format review, so as well as covering the Spectrum, platforms such as the C64, Amiga, PC, etc, are in there.
What really surprised me is the 16-bits using the Sinclair ROM font!
https://www.youtube.com/watch?v=htk_JW-s74M
Strangely, the Spectrum version uses a custom font.
What really surprised me is the 16-bits using the Sinclair ROM font!
https://www.youtube.com/watch?v=htk_JW-s74M
Strangely, the Spectrum version uses a custom font.
Reheated Pixels - a combination of retrogaming, comedy and factual musing, is here!
New video: Nine ZX Spectrum magazine controversies - How Crash, Your Sinclair and Sinclair User managed to offend the world!
New video: Nine ZX Spectrum magazine controversies - How Crash, Your Sinclair and Sinclair User managed to offend the world!
Re: Custom Fonts and the programmers that love them.
[media]https://www.youtube.com/watch?v=3sXQoGcMN1U[/media]PeteProdge wrote: ↑Tue May 01, 2018 5:41 pm What really surprised me is the 16-bits using the Sinclair ROM font!
Strangely, the Spectrum version uses a custom font.
That is so random...
Re: Custom Fonts and the programmers that love them.
Speaking of FZX, I'm working on a crap game and I tried for several hours to get the latest Z88DK (1.99B and the nightly) to link and use FZX fonts.
I remember it was pretty easy 5 years ago, but now that they are built in to Z88DK it seems to be more complicated.
The example project has a bunch of weird parameters on the command line (-vn, -clib=new, -startup=31) but I tried those and it still refused to link.
I gave up and wrote my own (limited) routines in C.
Does anyone have a dummy's guide for FZX & the latest Z88DK?
I remember it was pretty easy 5 years ago, but now that they are built in to Z88DK it seems to be more complicated.
The example project has a bunch of weird parameters on the command line (-vn, -clib=new, -startup=31) but I tried those and it still refused to link.
I gave up and wrote my own (limited) routines in C.
Does anyone have a dummy's guide for FZX & the latest Z88DK?
Re: Custom Fonts and the programmers that love them.
I use it with asm, so afraid not. I know AA has put a bunch of effort into additional features, so he’d be the best person to ask, I should think.
I think it has those parameters because he’s used it to implement stdout in some of the runtimes, so you can set up scrolling windows and use printf() or whatever you C guys do.
In its assembly form it’s about as simple to use as the ROM print routines, for sure. You could probably still manually use it like that, but I can just hear AA in my head saying that wouldn’t be a good idea
I think it has those parameters because he’s used it to implement stdout in some of the runtimes, so you can set up scrolling windows and use printf() or whatever you C guys do.
In its assembly form it’s about as simple to use as the ROM print routines, for sure. You could probably still manually use it like that, but I can just hear AA in my head saying that wouldn’t be a good idea
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
- bob_fossil
- Manic Miner
- Posts: 654
- Joined: Mon Nov 13, 2017 6:09 pm
Re: Custom Fonts and the programmers that love them.
This seemed to work when I was playing around with it a couple of months ago:
Code: Select all
// main.c
#include <arch/zx.h> // INK / PAPER #defines
#include <font/fzx.h>
#include <rect.h>
// fzx state
struct fzx_state fs;
// rectangles defining areas on screen
struct r_Rect16 screen = { 0, 256, 0, 192 }; // whole screen
char txt_intro[] = "www.spectrumcomputing.co.uk";
main()
{
fzx_state_init(&fs, &ff_dkud3_Notes, &screen); // sets xor mode by default
fs.fgnd_attr = INK_BLACK | PAPER_WHITE;
fs.fgnd_mask = 0;
fs.y = 32;
fs.x = 0;
fzx_puts(&fs, txt_intro);
return 0;
}
Code: Select all
zcc +zx -vn -startup=31 -clib=new main.c -o fzx.bin -pragma-include:zpragma.inc
Code: Select all
// COMPILE TIME CRT CONFIGURATION
#pragma output CRT_ORG_CODE = 32768 // org of compile
#pragma output REGISTER_SP = 0x7500 // typical stack location when using sp1
#pragma output CLIB_MALLOC_HEAP_SIZE = 0 // no malloc heap
#pragma output CLIB_STDIO_HEAP_SIZE = 0 // no stdio heap (no files)
#pragma output CLIB_FOPEN_MAX = -1 // no FILE* list
#pragma output CLIB_OPEN_MAX = -1 // no fd table
Re: Custom Fonts and the programmers that love them.
Thanks for the pointers!