change default font with FZX in nirvana

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
fupinet
New member
Posts: 5
Joined: Wed Aug 17, 2022 9:30 pm

change default font with FZX in nirvana

Post by fupinet »

Hello everyone! :) I have a project on nirvana and i was trying to change fonts and using fzx and i am not sure if it is compatible or not.

I have seen this example, even I get it to work it is impossible to use it with my nirvana project
https://github.com/z88dk/z88dk/blob/mas ... x_reader.c

the problem is that in the example it uses -startup=31 and in the nirvana project use -startup=1

my compile code is:

Code: Select all

zcc +zx -vn -SO3 -startup=1 -clib=sdcc_iy --max-allocs-per-node200000 nirvanadem.c btile.asm -o nirvanadem
appmake +zx -b nirvanadem_NIRVANAP.bin -o nirvanap.tap --noloader --org 56323 --blockname NIRVANAP
appmake +zx -b nirvanadem_CODE.bin -o nirvanadem.tap --noloader --org 32768 --blockname nirvanadem

The error is:

Errors in source file c:\z88dk199c\Lib\Config\\..\..\\libsrc\_DEVELOPMENT\target\zx\zx_crt.asm:

if I put the -startup=1 or -startup=5, no error comes out but it seems that it ignores the fzx

The files I'm using can be downloaded from Cristian's github, author of games created with nirvana.
He changes the fonts of his games using asm. Is it possible to use FZX to change the font in nirvana or is it better to use asm pointing to the address?
https://github.com/cmgonzalez/nirvanap_demo

Thank you!
derekfountain
Member
Posts: 121
Joined: Mon Mar 26, 2018 1:49 pm

Re: change default font with FZX in nirvana

Post by derekfountain »

The nirvana example uses printf(), and hence requires stdio. To use FZX with stdio you need to use a stdio driver which supports it. There are two of those: number 8, which enables FZX but doesn't support control codes embedded in the output string, and number 9, which enables FZX and does support embedded control codes (and hence is larger).

The nirvanademo uses control codes for string positioning, so you want to use -startup=9 when building:

Code: Select all

zcc +zx -vn -SO3 -startup=9 -clib=sdcc_iy --max-allocs-per-node200000 nirvanadem.c btile.asm -o nirvanadem
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: change default font with FZX in nirvana

Post by Timmy »

fupinet wrote: Thu Aug 18, 2022 3:19 pm Hello everyone! :) I have a project on nirvana and i was trying to change fonts and using fzx and i am not sure if it is compatible or not.
Short answer: No.

Long answer:

It's probably, in theory, possible to use a combination of fzx and nirvana, as shown in https://worldofspectrum.org/forums/disc ... le-routine (somewhere middle on page, not the first post).

And if you're not using them at the same time and not in the same screen locations, it could work.

If you want try it, I'm certainly not going to stop you.
derekfountain
Member
Posts: 121
Joined: Mon Mar 26, 2018 1:49 pm

Re: change default font with FZX in nirvana

Post by derekfountain »

Really Timmy? I tried the demo the OP linked to with stdio and -startup=9 and it seems to work fine:

Image
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: change default font with FZX in nirvana

Post by Timmy »

Oh, in that case it's all cool then. I was always told they were mostly incompatible.

Thanks!
fupinet
New member
Posts: 5
Joined: Wed Aug 17, 2022 9:30 pm

Re: change default font with FZX in nirvana

Post by fupinet »

Thank you very much! It has worked for me.
I've tried various fonts and some have more height and sit a bit down. There are parameters with fzx offset.

and another question, testing without nirvana using -clib=ansi and setting #pragma define ansicolumns=42 could change the number of columns... is there a similar parameter in fzx or using -clib=sdcc_iy?
derekfountain
Member
Posts: 121
Joined: Mon Mar 26, 2018 1:49 pm

Re: change default font with FZX in nirvana

Post by derekfountain »

fupinet wrote: Mon Aug 22, 2022 8:58 am and another question, testing without nirvana using -clib=ansi and setting #pragma define ansicolumns=42 could change the number of columns... is there a similar parameter in fzx or using -clib=sdcc_iy?
What exactly are you trying to achieve? Specifying a number of columns with proportionally spaced fonts doesn't seem to make a lot of sense?
fupinet
New member
Posts: 5
Joined: Wed Aug 17, 2022 9:30 pm

Re: change default font with FZX in nirvana

Post by fupinet »

sorry I didn't think they were proportional fonts, I was looking to change the default font and after trying the fonts by varying the column number I thought it could be done. And then I've seen that some are a little down, so I asked if there is a parameter to move the source
derekfountain
Member
Posts: 121
Joined: Mon Mar 26, 2018 1:49 pm

Re: change default font with FZX in nirvana

Post by derekfountain »

FZX is a font engine for the Spectrum:

https://spectrumcomputing.co.uk/entry/2 ... ectrum/FZX

It's been integrated into z88dk so you can use its features from C.

As you were unaware of that I suspect it's probably not what you should be using at the moment. :)
fupinet
New member
Posts: 5
Joined: Wed Aug 17, 2022 9:30 pm

Re: change default font with FZX in nirvana

Post by fupinet »

Hello, I have seen this documentation:

https://github.com/z88dk/z88dk/blob/mas ... cification

parameters:
height, tracking and lastchar


but I don't quite understand how they are used, I don't see an example code.
fupinet
New member
Posts: 5
Joined: Wed Aug 17, 2022 9:30 pm

Re: change default font with FZX in nirvana

Post by fupinet »

hello, the fzx.lib file is not in the z88dk folder, is it necessary to include it for fzx to work? I have been testing and got the following error: file open: fzx.lib
derekfountain
Member
Posts: 121
Joined: Mon Mar 26, 2018 1:49 pm

Re: change default font with FZX in nirvana

Post by derekfountain »

I've never used FZX and I'm not sure how much knowledge there is about it in the z88dk world.

You could try starting a new thread with an appropriate subject line and your example code so far.
Post Reply