Page 1 of 1

trs-80 target - Graphics for animation and sprites

Posted: Wed Nov 11, 2020 4:19 am
by pedgarcia
Hi,

I am beginning to experiment with z88dk creating some graphics/animation for the TRS-80 Model 3. At first, I create a very slow sprite function using plot/unplot but I am not happy with the results.

I noticed that there are sprite related functions in the SDK, but it is my understanding they are not meant for the TRS-80 low-res graphics. I wonder if there is something already out there that shows how to design a sprite function..

Did anyone here manage to do something similar for this platform?

Thanks!

Re: trs-80 target - Graphics for animation and sprites

Posted: Wed Nov 11, 2020 10:29 pm
by dom
The putsprite() function should work on the TRS80, it similarly uses plot/unplot but may well be a bit quicker than what you've written, however, given that we're printing characters rather than pixels there's only so fast it can go!

It's possible to create optimised putsprite() functions for a target, for example, the Colour Genie has one, but I can't see anything for a vanilla TRS80.

Re: trs-80 target - Graphics for animation and sprites

Posted: Thu Nov 12, 2020 2:11 am
by pedgarcia
Thanks, dom, I will take a look at putsprite. I was trying to use the "bksave" first, but I got all sorts of errors so I assume these functions weren't supported.

I just found under examples folder a graphics folder so I was trying to compile the spritest.c with the command:

Code: Select all

zcc +trs80 -vn spritest.c -create-app -subtype=disk -lndos -lm -o spritest
But I got these errors:

Code: Select all

Error at file 'getsprite.asm' line 59: symbol 'pixeladdress' not defined
Error at file 'getsprite.asm' line 105: symbol 'pixeladdress' not defined
Errors in source file /Users/pgarcia/_privcloud/z88dk/lib/config/../..//lib/target/trs80/classic/trs80_crt0.asm:
Error at file 'getsprite.asm' line 59: symbol 'pixeladdress' not defined
Error at file 'getsprite.asm' line 105: symbol 'pixeladdress' not defined
Am I missing a parameter or something? (Not sure if matters but I am using macOS with zcc version v16905-8b62708-20200825)

Thanks again

Paulo

Re: trs-80 target - Graphics for animation and sprites

Posted: Thu Nov 12, 2020 2:47 am
by pedgarcia
I just found some examples that are working (wall, dstar, microman). I think I can now have a better understanding of the putsprite function!

Thanks

Re: trs-80 target - Graphics for animation and sprites

Posted: Thu Dec 31, 2020 2:34 pm
by stefano
The errors you got were caused by a placeholder function, getsprite() is missing on many targets, I should really think at a slow generic function based on getpixel()

Re: trs-80 target - Graphics for animation and sprites

Posted: Sun Jan 03, 2021 7:39 pm
by stefano
I checked the source code tree for the classic library, there could be still a bit of regression after the last sorting out.
Some of the functions inserted in the list for the 'narrow' graphics won't work with the text modes and should be overriden (e.g. the 'getsprite2.asm' alternative could be better on the trs80). I still haven't found the cleanest way to fix it, though.

Re: trs-80 target - Graphics for animation and sprites

Posted: Sun Jan 03, 2021 8:38 pm
by dom
Yeah, the graphics was a bit of a mess and I tried to organise things a bit more sensibly, somethings may have got lost in the cleanup though.

Regarding this, it's probably easiest/best to add gfx/narrow/getsprite2 to gfx/text/gfx_test.lst above the @gfx/narrow/gfx_narrow.lst - I'm guessing that getsprite2 would be better for all text based graphics? - I don't think there exists a text display with > 256x256 characters?

Re: trs-80 target - Graphics for animation and sprites

Posted: Sun Jan 03, 2021 10:11 pm
by stefano
perfect then, it was what I was going to do :)
I'll take a while to test the result but consider it addressed. .

Re: trs-80 target - Graphics for animation and sprites

Posted: Tue Jan 05, 2021 12:30 pm
by stefano
TEXT, TEXT6 and ZX81 modes should now be fixed ;)

Re: trs-80 target - Graphics for animation and sprites

Posted: Tue Jan 05, 2021 5:33 pm
by stefano
..for the record, I should have sorted out also the TS2068 port.
There is still a bit of overlapping/redundant elements here, and I've been probably too conservative but it is back in working order :)

Re: trs-80 target - Graphics for animation and sprites

Posted: Tue Jan 05, 2021 6:22 pm
by dom
stefano wrote: Tue Jan 05, 2021 5:33 pm ..for the record, I should have sorted out also the TS2068 port.
There is still a bit of overlapping/redundant elements here, and I've been probably too conservative but it is back in working order :)
I thought the TS2068 was working - the graphics functions were meant to follow the screen mode, so supporting regular, hires and hi-colour screen modes. I suspect getsprite() might have been broken, but it looks like now clg() will clear the second screen then in regular ZX screen mode?

Re: trs-80 target - Graphics for animation and sprites

Posted: Tue Jan 05, 2021 7:54 pm
by stefano
I used chessboard.c (configured as for the c128 build hint) and mandel.c (to check getmaxx and getmaxy). Spritest for getsprite.