LPRINT on ZX81?
Font updated and line spacing added. The full ASCII font is a hidden option, which can be enabled, tuned and integrated with extra characters for special needs. There is a problem on a single pixel, so a vertical pixel line shows the glitch .. I don't know if it will happen on the real HW, but if so it is a problem on the buffer printing code rather than on lprintc5().
Could these extra characters also be used for Olli's ZEDIT, where some special characters are multi-byte characters (>0x80)?stefano wrote:The full ASCII font is a hidden option, which can be enabled, tuned and integrated with extra characters for special needs.
Do you mean the "buffer printing code" in ROM?... but if so it is a problem on the buffer printing code rather than on lprintc5().
Some of us have rom-patches for own printers (like Centronics printers or my "network printer" via ZeddyNet).
So if that rom code is used (at least in TEXT mode 32 chars/line), lprintc will probably work also with a patched rom for other printers (if the patched rom code has the same entry points).
Which lprint variants use the rom code for printing?
Siggi
zx_lprintc() ROM based. zx_lprintc5() calls a custom driver printing 256 graphics bytes from a buffer at once. this driver could need more tuning (e.g I notice the bottom row in a text line in your photo not being regular and on the emulator I noticed some error of few pixels) but I think I'm lucky it works on the real hw
I'll probably write the whole zx printer driver for zedit, there is so little to add
The fonts are my own creations,
I'll probably write the whole zx printer driver for zedit, there is so little to add
The fonts are my own creations,
Hi Stefano
using the build date Aug. 8 printing does not woek perfectly:
using this code the ZX81 (also EO) the program the screen get flickering and the program does not continue
Everything works perfectly, when I call zx_fast() before and zx_slow() after lprint.
And: the Z88DK print routines should not call zx_slow/zx_fast!
They should switch only temporarily to FAST and should return to the same mode before print has been calledd (could also be FAST!)
The original rom print routines use this calls:
Siggi
using the build date Aug. 8 printing does not woek perfectly:
using this code the ZX81 (also EO) the program the screen get flickering and the program does not continue
Code: Select all
void lprint(unsigned char *text)
{
while (*text)
{
zx_lprintc(*text++);
}
}
fgets(message, 100, stdin);
lprint(message);
printk("Done\n");
And: the Z88DK print routines should not call zx_slow/zx_fast!
They should switch only temporarily to FAST and should return to the same mode before print has been calledd (could also be FAST!)
The original rom print routines use this calls:
Code: Select all
CALL 02E7,SET-FAST
..
CALL 0207,SlOW-FAST
hello Siggi, I can't understand the reason for the pattern oddity, I'll investigate (slowly because I'll be on holiday for a while) .
also the slow/ fast issue requires some work, because there are many different versions of zx_fast / zx_slow depending on the current clib configuration. it is strange that forcing fast is solving the problem this is one more thing to understand
also the slow/ fast issue requires some work, because there are many different versions of zx_fast / zx_slow depending on the current clib configuration. it is strange that forcing fast is solving the problem this is one more thing to understand
I still need to check the WRX case, but the test program works correctly for me on EO with both zx_lprintc and zx_lprintc5.
#include <stdio.h>
#include <stdlib.h>
#include <zx81.h>
void lprint(unsigned char *text)
{
while (*text)
{
zx_lprintc5(*text++);
}
}
void main()
{
char message[100];
fputc_cons("___ ");
fgets(message, 100, stdin);
lprint(message);
printk("Done\n");
}
#include <stdio.h>
#include <stdlib.h>
#include <zx81.h>
void lprint(unsigned char *text)
{
while (*text)
{
zx_lprintc5(*text++);
}
}
void main()
{
char message[100];
fputc_cons("___ ");
fgets(message, 100, stdin);
lprint(message);
printk("Done\n");
}
I have downloaded the current nightly z88dk build.
Nevertheless the program fails (EO V0.52) after the first lprint ("DONE" is still printed):
compiled using
zcc +zx81 -startup=2 -Cz--disable-autorun -create-app -vn -O3 -o ptest.bin printtest.c
I have entered the text "huhu". The text is terminated by <LF> (10)
???
Siggi
Nevertheless the program fails (EO V0.52) after the first lprint ("DONE" is still printed):
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <zx81.h>
#include <string.h>
#include <input.h>
void lprint(unsigned char *text)
{
while (*text)
{
zx_lprintc(*text++);
}
}
void main()
{
unsigned int i;
char message[100];
// fputc_cons("___ ");
fgets(message, 100, stdin);
for (i = 0; i < strlen(message); i++)
printk("%u:%u\n", i, (unsigned int) message[i]);
in_Wait(2000);
lprint(message);
printk("Done\n");
in_Wait(2000);
lprint("longlonglonglonglonglonglonglonglong\r");
printk("done CR\n");
in_Wait(2000);
lprint("longlonglonglonglonglonglonglonglong\n");
printk("done LF\n");
in_Wait(2000);
}
zcc +zx81 -startup=2 -Cz--disable-autorun -create-app -vn -O3 -o ptest.bin printtest.c
I have entered the text "huhu". The text is terminated by <LF> (10)
???
Siggi
When I surround lprint by zx_fast/slow, everthing works as expected:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <zx81.h>
#include <string.h>
#include <input.h>
void lprint(unsigned char *text)
{
while (*text)
{
zx_lprintc(*text++);
}
}
void main()
{
unsigned int i;
char message[100];
// fputc_cons("___ ");
fgets(message, 100, stdin);
for (i = 0; i < strlen(message); i++)
printk("%u:%u\n", i, (unsigned int) message[i]);
in_Wait(2000);
zx_fast();
lprint(message);
zx_slow();
printk("Done\n");
in_Wait(2000);
zx_fast();
lprint("longlonglonglonglonglonglonglonglong\r");
zx_slow();
printk("done CR\n");
in_Wait(2000);
zx_fast();
lprint("longlonglonglonglonglonglonglonglong\n");
zx_slow();
printk("done LF\n");
in_Wait(2000);
}
Hi Stefanostefano wrote:hello Siggi, I can't understand the reason for the pattern oddity, I'll investigate
I have downloaded Z88DK (ZIP for WINDOOFS) and used it as is. I did not MAKE any ZX81 specific lib, because WIN does not MAKE anything
Is that the reason that I get different results like you have?
Siggi
Hi Stefano
using the nightly build the state is the same: printing works, when printing is done in fast mode, like this:
What must I do to get 64 chars/line on printer, like the ANSI mode does on screen?
Currently I get 32 chars/line using the code above. I compile using this:
zcc +zx81 -DHIRES_SCREEN=49152 -O3 -vn -clib=ansi -subtype=_wrx -create-app -llibsocket -o irc-ansi.bin irc.c inputline.c statusline.c output.c ircsvrmsg.c usercmd.c -DUSE_ANSI_MODE
The "funny pixel pattern " I noticed before might be caused by a rom patch of my ZX81 rom. Are the rom printer routines used during ANSIMODE printing?
Siggi
using the nightly build the state is the same: printing works, when printing is done in fast mode, like this:
Code: Select all
void lprintc (unsigned char c)
{
if (c == '\n')
zx_fast(); /* Workaround for Z88DK problem during print */
zx_lprintc(c);
if (c == '\n')
zx_slow();
}
Currently I get 32 chars/line using the code above. I compile using this:
zcc +zx81 -DHIRES_SCREEN=49152 -O3 -vn -clib=ansi -subtype=_wrx -create-app -llibsocket -o irc-ansi.bin irc.c inputline.c statusline.c output.c ircsvrmsg.c usercmd.c -DUSE_ANSI_MODE
The "funny pixel pattern " I noticed before might be caused by a rom patch of my ZX81 rom. Are the rom printer routines used during ANSIMODE printing?
Siggi
Hello Siggi,
the direct text output on the ZX_PRINTER at the moment permit only 32 columns (zx_lprintc) and 51 columns (zx_lprintc5) only, with the standard ZX81 text characters.
The hardcopy function will work in the current graphics mode, though. A possible approach for a long printed banner trying to save memory could be, in example, to work in 64 rows WRX mode and split your artwork/text into pieces printing them sequentially.
So, the ANSIMODE printing is still absent but feasible. To extend the library furtherly we must first decide how we want it to work.. probably it is just a matter of providing yet another function in parallel to zx_lprintc, say zx_glprintc, which could pick the text settings from the ANSI VT engine.
the direct text output on the ZX_PRINTER at the moment permit only 32 columns (zx_lprintc) and 51 columns (zx_lprintc5) only, with the standard ZX81 text characters.
The hardcopy function will work in the current graphics mode, though. A possible approach for a long printed banner trying to save memory could be, in example, to work in 64 rows WRX mode and split your artwork/text into pieces printing them sequentially.
So, the ANSIMODE printing is still absent but feasible. To extend the library furtherly we must first decide how we want it to work.. probably it is just a matter of providing yet another function in parallel to zx_lprintc, say zx_glprintc, which could pick the text settings from the ANSI VT engine.
Yes, zx_fast() is also necessary for usual text mode (EO also shows the problem).
Maybe its not a problem or registers, but system variables (which are also set/reset by zx_slow/zx_fast)?
I thought, that zx_lprintc() would use the same font/characters that are used for current screen output. So only one function would be needed for text and ANSI mode.
My current project is the IRC chat program, where each char written to screen should also be printed (if the user is absent, he could later read on the printer, what has been discussed meanwhile).
Hardcopy would be possible, but prints more things than necessary (e. g. bottom status line and the input line of the chat program).
IRC chat is available in lowres text version and ANSI mode.
Maybe its not a problem or registers, but system variables (which are also set/reset by zx_slow/zx_fast)?
I thought, that zx_lprintc() would use the same font/characters that are used for current screen output. So only one function would be needed for text and ANSI mode.
My current project is the IRC chat program, where each char written to screen should also be printed (if the user is absent, he could later read on the printer, what has been discussed meanwhile).
Hardcopy would be possible, but prints more things than necessary (e. g. bottom status line and the input line of the chat program).
IRC chat is available in lowres text version and ANSI mode.
Hi Stefano,stefano wrote:I'm also thinking at the zx_fast() workaround. zx_lprintc should have been safe, because it is restoring the registers before doing ROM related stuff but obviously something is not working.. is zx_fast() needed also when you run in other modes than WRX ?
the routine "SLOW/FAST" called at end of printing in ROM:
Code: Select all
08DE COPY-END CALL 0207,SlOW-FAST
POP BC
Code: Select all
THE DISPLAY ROUTINES:
i) Test for SLOW or FAST Mode.
The SLOW flag, Bit 6 of CDFLAG is tested, and a return is made if the program is in FAST mode or 'SLOW' display is not available.
0207 SLOW/FAST LD HL,+CDFLAG
LD A,(HL)
RLA
XOR (HL)
RLA
RET NC
LD A,+7F
EX AF,A'F'
LD B,+ll
OUT (+FE),A
0216 LOOP-11 DJNZ 0216,LOOP-11
OUT (+FD),A
EX AF,A'F'
RLA
JR NC,0226,NO-SLOW
SET 7,(HL)
PUSH AF
PUSH BC
PUSH DE
PUSH HL
JR 0229,DISPLAY-1
0226 NO-SLOW RES 6,(HL)
RET
Siggi