Custom Fonts and the programmers that love them.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Kweepa
Manic Miner
Posts: 311
Joined: Sat Feb 03, 2018 6:14 pm
Location: Albuquerque, New Mexico

Re: Custom Fonts and the programmers that love them.

Post by Kweepa »

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? :)
User avatar
Seven.FFF
Manic Miner
Posts: 736
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Custom Fonts and the programmers that love them.

Post by Seven.FFF »

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 :D
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
User avatar
bob_fossil
Manic Miner
Posts: 654
Joined: Mon Nov 13, 2017 6:09 pm

Re: Custom Fonts and the programmers that love them.

Post by bob_fossil »

Kweepa wrote: Tue May 01, 2018 6:09 pm Does anyone have a dummy's guide for FZX & the latest Z88DK? :)
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;
	}
and then to compile:

Code: Select all

zcc +zx -vn -startup=31 -clib=new main.c -o fzx.bin -pragma-include:zpragma.inc
where zpragma.inc contains:

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
User avatar
Kweepa
Manic Miner
Posts: 311
Joined: Sat Feb 03, 2018 6:14 pm
Location: Albuquerque, New Mexico

Re: Custom Fonts and the programmers that love them.

Post by Kweepa »

Thanks for the pointers!
Post Reply