Plot function in z88dk
Plot function in z88dk
Sorry for this beginner’s question, but how would you implement a Plot() function in z88dk, allowing you to set or clear each block of the 64x48 screen?
The trick is obviously to fill the right parts of the screen memory.
I have made my first little experiments with Z88DK, and the speed of the resulting program (compared to Basic) gives me motivation for further work...
The trick is obviously to fill the right parts of the screen memory.
I have made my first little experiments with Z88DK, and the speed of the resulting program (compared to Basic) gives me motivation for further work...
Last edited by RobertK on Wed Jan 31, 2018 3:54 pm, edited 1 time in total.
Re: Plot function in Z88DK
If you want to plot in LOWRES, you could call the BASIC PLOT routine from Z88DK to plot using BASIC:
an expample for PLOT is here:
https://www.z88dk.org/wiki/doku.php?id= ... 1&s[]=plot
If you want to plot in HIRES, use the "graphic"-library:
https://www.z88dk.org/wiki/doku.php?id= ... []=graphic
HTH Siggi
an expample for PLOT is here:
https://www.z88dk.org/wiki/doku.php?id= ... 1&s[]=plot
If you want to plot in HIRES, use the "graphic"-library:
https://www.z88dk.org/wiki/doku.php?id= ... []=graphic
HTH Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Plot function in Z88DK
Thanks. I have tried the first method and it works, but unfortunately its speed is exactly the same as if it was done entirely in BASIC. About six seconds for plotting a border around the screen like this:
Is there a more efficient way to implement PLOT() in low-res? Maybe by writing directly to the appropriate address of the video memory?
The hires functions in graphics.h look very interesting as well, but I assume that this requires WRX, right?
Code: Select all
10 FOR X=0 TO 63
20 PLOT X,43
30 PLOT X,0
40 NEXT X
50 FOR Y=1 TO 42
60 PLOT 0,Y
70 PLOT 63,Y
80 NEXT Y
The hires functions in graphics.h look very interesting as well, but I assume that this requires WRX, right?
Re: Plot function in Z88DK
Seems there is MID-RES if you have UDG capable hardware. Unfortunately it seems pseudo HIRES is not supported.
Re: Plot function in Z88DK
Yes, your hardware (or EO

https://www.z88dk.org/wiki/doku.php?id= ... ersion_1.8
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Plot function in Z88DK
Thanks, I will try writing WRX programs later, but back to my initial question: the target machine for my first program would be an unmodified 16K ZX81/TS1000, and I would like to plot/unplot blocks in low-res 64x48 mode. Any suggestions how this could be achieved efficiently in Z88DK?
I had a look at the source of the Z8048 game, and there the drawGrid() function fills the appropriate parts of the screen memory to display the grid, however using "text mode". Maybe the same can be achieved in low-res graphics?
I had a look at the source of the Z8048 game, and there the drawGrid() function fills the appropriate parts of the screen memory to display the grid, however using "text mode". Maybe the same can be achieved in low-res graphics?
Re: Plot function in Z88DK
It can be done fairly quickly BUT... you have to ensure that the d-file is fully expanded i.e. 24 rows of 33 bytes each, that way the screen position can be calculated quite easily and the. Some jiggery pokery with bit manipulation can set / unset a quarter block for you.... Will sort out some assembler code later for you.
what's that Smell.... smells like fresh flux and solder fumes...
Re: Plot function in Z88DK
right then.... as promised.... i dont really do the Z88dk thing.... but i know that you can run native Z80 code so you should be able to adapt this code.
anyway HTH
Andy
p.s just re-read previous post.... working on unplot now hahaha
anyway HTH
Andy
p.s just re-read previous post.... working on unplot now hahaha
what's that Smell.... smells like fresh flux and solder fumes...
Re: Plot function in Z88DK
Thanks Andy, the speed is impressive!
I may seem entirely hopeless, but can anyone please assist me in wrapping this ASM code into a C function? I know that you need to put the ASM code between #asm and #endasm, but everything else regarding ASM in z88dk is currently trial and error for me.
I should have checked the z88dk forums first, because here is a discussion on exactly this PLOT topic. I have tried using the final "CALLEE" function from there, and it compiles ok, but for some reason the plotted blocks just don't appear on the screen. Maybe I will post that later as well.
I may seem entirely hopeless, but can anyone please assist me in wrapping this ASM code into a C function? I know that you need to put the ASM code between #asm and #endasm, but everything else regarding ASM in z88dk is currently trial and error for me.
I should have checked the z88dk forums first, because here is a discussion on exactly this PLOT topic. I have tried using the final "CALLEE" function from there, and it compiles ok, but for some reason the plotted blocks just don't appear on the screen. Maybe I will post that later as well.
Re: Plot function in z88dk
i'll have a look with the Z88dk thing....
what's that Smell.... smells like fresh flux and solder fumes...