is there any high level support of the printer (Sinclair printer routines in ROM) of a ZX81 in z88dk?
I am thinking of writing a network printer, running on a ZX81+printer (using ZeddyNet)

Siggi
PS: e. g. the BASIC program line interface???
Code: Select all
;THE 'LPRINT-CH' SUBROUTINE
;Characters are added one by one to the printer buffer. Once the buffer is full, or a N/L character is entered the buffer is emptied.
0851 LPRINT-CH
CP +76
JR Z,0871,COPY-BUFF
LD C,A
LD A,(PR-CC)
AND +7F
CP +5C
LD L,A
LD H,+40
CALL Z,0871,COPY-BUFF
LD (HL),C
INC L
LD (PR-CC),L
RET
Code: Select all
I have attached the source code for a simple printer driver which
uses the same protocol as the built ZX LPRINT commands.
I wrote it as part of the WRX16 hires package to print HIRES screens
to the 2040 and similar printers.
It is easier to understand than the ZX ROM code and may shed some
light on the way that the ZX81 sends print data and tests printer
status. Unlike the the ROM code it sends the bitmapped HIRES display
file directly to the printer without converting character codes to
graphics bits. Hope this helps.
Best regards.
PWRX16 - HIRES GRAPHICS ROUTINE FOR THE ZX81 PRINTER
by W.RIGTER
A 52 BYTE PRINTER DRIVER FOR PRINTING A WRX16
BITMAPPED HIRES SCREEN THE ZX AND 2050 PRINTERS.
ILLUSTRATION OF THE ZX81 CORE PRINTER I/O PROTOCOL.
COMPARE THIS ROUTINE TO THE ZX81 ROM ROUTINE WHICH FIRST
CONVERTS CHARACTER CODES TO 64 GRAPHICS BITS BEFORE PRINTING
PWRX16 CALL 0F23 ;SET FAST MODE
LD E,CO ;REGISTER E = 192 LINES (192 X LOOP1)
LD HL,(ARRAY) ;REGISTER HL POINTS TO 256X192 BIT ARRAY
XOR A ;SET REGISTER BITS 0-7 TO ZERO
OUT FB,A ;START PRINTER (BIT 2=0)
LOOP1 IN A,FB ;GET PRINTER STATUS BYTE
RLA ;ROTATE BIT 7 (LF BUSY) TO C FLAG
JR NC,LOOP1 ;LOOP IF LINEFEED IS BUSY (C=0)
LD D,20 ;32 BYTES (256 BITS) PER LINE
LOOP2 LD B,08 ;REGISTER B = 8 X LOOP2 COUNTER
LD C,(HL) ;REGISTER C = 8 BITS TO BE PRINTED
LOOP3 IN A,FE ;GET PRINTER STATUS
RRA ;ROTATE BIT 0 (DATA READY) INTO C FLAG
JR NC LOOP3 ;LOOP IF DATA
LD A,C ;COPY C TO A
AND 80 ;REGISTER A BIT 7 IS PRINTER DATA BIT
OUT FB,A ;SEND DATA BIT TO PRINTER
RL C ;ROTATE NEXT DATA BIT TO BIT 7
DJNZ LOOP3 ;REPEAT 8 TIMES (BYTE = 8 BITS)
INC HL ;INCREMENT ARRAY POINTER TO NEXT BYTE
DEC D ;DECREMENT LOOP2 COUNTER
JR NZ LOOP2 ;REPEAT 32 TIMES
DEC E ;DECREMENT LOOP1 COUNTER
JR NZ LOOP1 ;REPEAT 192 TIMES
LD A,04 ;BIT 2 IS PRINTER ON/OFF BIT
OUT FB,A ;TURN OFF PRINTER
CALL 0F2B ;RESTORE SLOW MODE
RET ;BACK TO THE CALLING PROGRAM
Code: Select all
#define K_SWITCH 'm' /* [SPACE] */
#define K_EXIT 'g' /* [Esc]/[Quit] */
#define K_CLEAR 'h'
// added by SE 21-07-2018
#define K_HARDCOPY 'z' /* COPY */
Code: Select all
#include <sound.h>
// added by SE 21-07-2018
#include <zx81.h>
#include <string.h>
Code: Select all
case K_CLEAR:
#ifdef SOUND
bit_fx4 (3);
#endif
SetupLevel();
break;
// added by SE 21-07-2018
case K_HARDCOPY:
zx_lprints("Hardcopy\r\n");
zx_hardcopy();
break;
Code: Select all
void zx_lprints(char *s)
{
int i;
for (i=0; i < strlen(s); i++)
zx_lprintc(i);
zx_lprintc(10);
zx_lprintc(13);
}