Printer driver for IS-DOS
ZXNet echo conference «zxnet.soft»
From Felix Knyazev → To Dima Boyko 14 December 2000
Greetings, Dima!
[Monday 11 December 2000] at [09:46:36] Dima Boyko wrote a letter to
Eugene Palenock.
They discussed the topic "Printer driver for IS-DOS." Let's continue what we started...
EP>> And you have a table of marks for setting up the driver when moving
Did you do EP>> in memory? In ISDOS, the driver can be moved
EP>> can,
EP>> and the system for addressing them via JP, CALL, etc. must according to this
EP>> fix the table.
DB> Well, I don’t know how to code under IS. :(
Here is an example of a subject source for the MC6312 printer (it does not contain pseudographics and
because of this, a conversion table is included in the driver). Centronics in Speck
made on KR580VV55A. You assemble in iS-ASSM and link also in iS-DOS
linker (link.com) with the key /res (!).
BB55 ports:
#3f - data
#5f - strobe (bit0/out); busy (bit7/in)
#7f - RUS (control word register BB55)
============== here we will start the file "s55profi.C" ================
;Printer driver: "s_scorp.lpr" (183 bytes).
;Redesigned for MS KP580BB55A with decoding from Profi.
;Link with the key /res.
;----------------------------------------
;s: Also “alt”, but without pseudo-graphics, which
; which is replaced by the characters *|-+.
; The characters F0..FF are replaced with spaces.
; - MS 6312;----------------------------------------------------
ORG 50000; любой, => 1
DEFW INIT55; иницилализация KP580BB55A
DEFW PRINTA
DEFW INIT_I
DEFW INIT_I
DEFB #00,#00,#00,#00,#00,#01,#00,#00
LL8011 DEFB #2A,#2A,#2A,#7C,#7C,#7C,#7C,#2B
DEFB #2B,#7C,#7C,#2B,#2B,#2B,#2B,#2B
DEFB #2B,#2B,#2B,#7C,#2D,#2B,#7C,#7C
DEFB #2B,#2B,#2B,#2B,#7C,#2D,#2B,#2D
DEFB #2D,#2D,#2D,#2B,#2B,#2B,#2B,#2B
DEFB #2B,#2B,#2B,#2A,#2A,#2A,#2A,#2A
PRINTA PUSH AF
LD C,#12
RST #10
EXX
POP AF
CP#0D
JR NZ,LL8057
BIT 0,(HL)
JR Z,LL8079
CH1 CALL LL8079
RET C
LD A,#0A
JR LL8079
LL8057 BIT 1,(HL)
JR Z,LL8079
CP#B0
JR C,LL8079
CP#F0
JR NC,LL8075
CP#E0
JR NC,LL8079
SUB#B0
PUSH HL
CH2 LD HL,LL8011
LD E,A
LD D,#00
ADD HL,DE
LD A,(HL)
POP HL
JR LL8079
LL8075 LD A,#20
JR LL8079
LL8079 LD E,A
BUSY_EI
LD C,#09
RST #10
JR Z,LL808B
LD C,#07
RST #10
CP#10; "SS+A"
JR Z,EXIT__
CP#16; "CS+BS=BREAK"
JR Z,EXIT__
LL808B D.I
IN A,(#5F)
RLA
JR C,BUSY__
LD A,E
OUT(#3F),A; вывод данных.
XOR AOUT(#5F),A; strobe to "0"
;but here we should insert a delay.
INC A
OUT(#5F),A; strobe at "1"
EI
INIT_I RET
INIT55 INC A
RET Z; 'A' had #FF
INC A
RET Z; 'A' had #FE
LD A,%10011000
OUT(#7F),A
LD A,1
OUT(#5F),A; Set STROBE_OFF
XOR A
RET
EXIT__ LD A,#97
SCF
RET
============== here we will end the file "s55profi.C" ================
============== here we will start the file "IsDosDRV.C" ================
Info on the driver structure:
=====cut=====
4. RESIDENCE PROGRAMS
Resident program in the system
IS-DOS is called the program, constantly
located in a special memory area -
ty and, therefore, available for work in
any time without loading it from disk.
Working with the resident program under
is divided into three stages:
1. Installation (loading) into memory from the disk
ka, setting to address and initializing
tion.
2. Main work
3. Removing a program from memory
The 1st and 3rd stages are carried out
set.com team. She also creates 18-bye
commercial channel describing the resident
program.
Installed (loaded) rubber
dental programs can be seen when
the power of show.com and eliminat.com programs.
You can contact resident programs
but by names from the command line, use-
using the DOS built-in command "@",example:
@date+3
or
@scan ch+ *.*
The last line contains 2 at once
names of residents. This is due to the fact that
Some residency programs are designed
designed to work in tandem with special
service residents - scan.res and
univ.res. These service residents
select files (by mask, from
label, etc.) and transferring them as
parameter to the resident running in pair
with them.
That. You are launching service res-
dental program, indicating as
the first parameter is the name of the working resident
ta, and as the second - a key or a mass
ku for selecting files. Service rubber
dent determines the channel number by name
working resident, remembers it and
repeatedly launches by number, pre-
carefully opening the next file, suitably
corresponding to the specified mask or key.
Residents working in tandem with residents
dents scan.res and univ.res usually have
special protection against direct handling
to them via the "@" command.
Residency program structure:
****************************************
offset length comment
0 2 Address of the initialization procedure -
tions. It is called when
relocation (at the same time in reg. A
served FF) or delete
(in reg. A FE is supplied) prog.
by SET.com. If thisaddress is 0, then the procedure
not called. This program
must connect if it is
necessary, the resident to the center
interruption kidney or other
goy program, intercept
restarts and restore
them.
2 2 Main entrance address, i.e.
launch procedures by name
restarts $exebat(#44) and
$run(#48) or by ca- number
restart $exeres(#53)
If the address is 0, then
starts from the 4th byte.
4 R The body of the program - actually
machine code
R+4 2 #FFFF - separates the body pro-
grams from the subsequent service
personal information
R+6 2n table of configurable addresses
sov - 1. Offsets from the beginning
are calculated using LSA. Unit
subtracted for the sake of simplicity -
you setting up such commands
like: CALL, JP, LD HL,
LD A,(nn), most often
encountered in the program.
With the advent of assembler programs and
faucet (as.com and link.com) takes care of everything
about separator and custom table
The programmer no longer has addresses. To
you only need to assemble a resident task
reserve 4 bytes at the beginning of the file (2
words) for entry point addresses (see.the structure just given) and from
link object file(s) with key
/res. Don't forget to install ORG
non-zero so that address #FFFF is not
got confused with the separator!
5. DEVICE DRIVERS
The driver is a resident program
special purpose. He serves
physical or logical device
any of three types:
1. Block devices: *.blk files,
F8..FF driver channel numbers, numbers
device channels - 00..07
2. Character output devices: files
type *.typ and *.lpr, driver channel numbers
ver F0..F7, device channel numbers -
08..0F
3. Character input devices: files
type *.key driver channel numbers
E8..EF, device channel numbers -
10..1F
The driver installed on the system has
There is only an 8-letter name (type in channel
not stored). typ can be distinguished from lpr
by 0th bit in the 13th byte of the driver
(5th byte in vector g_typ(#12)). In na-
at the front of each driver there is a century-
torus of standard structure:
****************************************
offset length name comment
0 2 INST Program, initialization
tions called as and
for all residents
program SET.com, and
also with each re-
turning on the device,
serviced driverrum At the same time, in the region
page A number is given
devices
2 2 ENTRY1 1st entry point
4 2 ENTRY2 2nd entry point
6 2 ENTRY3 3rd entry point
8 8 service information,
also stored in
description of the channel
triplets and in vector
devices - registers
states, addresses
ferov, etc.
16...driver body
The INST entry point can be used
to switch the driver to co-
corresponding device (enabled
in sys_driv and in hard drive drivers), and
also informs the driver (and resident) about
that it has been moved or turned off.
All information is supplied in register A:
A=0..7 - number of the device to which
driver switches
A=FE - driver (resident) is disabled,
i.e. will be removed or just te-
the current device will be coming soon
replaced. This is done on that
case if the driver is working
state intercepts feedback
to any restart or
to another driver.
A=FF - driver (resident) just
moved
Inputs ENTRY1, 2, 3 correspond to
IS-DOS system restart groups:
****************************************Driver ENTRY1 ENTRY2 ENTRY3
blk $read $write $binit
typ $type $tycpl $typos
key $key $kwait $ktest
Appendix: Driver Structure
IS-DOS devices
****************************************
blk - block device
0 2 INSTL - switch to device
or reinstallation
(if the value is 0,
then the procedure is not needed)
2 2 BREAD ┐ entry points
4 2 BWRIT │ for restarts
6 2 BINIT ┘ (only for disk drives
with removable media)
8 1 SCCSR - status register:
bits 0...2 - device number for
cache memory
bit 3 - 0 - driver with buffer
1 - driver without buffer
bit 4 - 0 - do not execute
autoflush
1 - perform autoflush
with each modification
cation of blocks in cache
bit 5 - 0 - read prohibition for
restarts
1 - read resolution
for restarts
bit 6 - 0 - write prohibition for
restarts
1 - recording resolution
for restarts
bit 7 - 0 - do not use cache
1 - use cache
9 1 DRCSR - also a status register:bit 0 - 0 - do not execute the request
at QVST
(vector g_cnfg shifted
communication +40) when communicating
growth to block
device
1 - execute the request
bit 1 - autoflush flag
specified by the user)
bit 2 - 0 - TR-DOS disk
1 - non-TR-DOS disk
bits 3...6 - not used
bit 7 - 0 - do not process
errors ($erdrv)
1 - handle errors
10 2 OFIM2 - offset from the beginning
drivers up to IM2 code
in the restoration procedure
switching IM2 mode to select-
progress from the driver.
If the value is 0,
then IM2 is not output
is installed
12 1 TPSYS - TR-DOS type:
0 - 5.01
1 - 5.03 and above)
14 2 TMBUF - driver buffer address,
Buffer volume - 1Kb.
........
20 2 ..... - current sector number
in the driver buffer
........
30 1 ..... - drive type:
bit 0 - 0 - 40 tracks
1 - 80 tracks
bit 1 - 0 - one-way
1 - double-sided
31 1 TMWT - reading start delaysectors
32 1 HTIME - holo movement time
wok drive
33 1 ..... - disk type:
bit 0 - 0 - 40 tracks
1 - 80 tracks
bit 1 - 0 - one-way
1 - double-sided
34 1 ..... - sector size, value
of this byte:
1 - 256 bytes
2 - 512 bytes
4 - 1024 bytes
35 1 ..... - number of sectors per
path
36 16 ..... - table of sect numbers
ditch on the path
Note: bytes 8...15 are also stored
in the channel and in the vector of the block device
stva. Bytes 33...51 are read from disk,
this is nothing more than bytes 23...25 and
64...79 from the zero block of the dis-
ka. We'll talk more about disks in a moment.
later, when describing the restart of $binit.
****************************************
typ - display output device
0 2 ..... - as a rule, not used
zuzyatsya
2 2 TYPE ┐ entry points for
4 2 TYCPL │ print restarts
6 2 TYPOS ┘ characters
8 1 ..... - width of the character matrix
in points (6 for ty42 and
4 for ty64). Using
is determined by restarts y___ and
n___ WIN level
9 4 ..... - reserved
13 1 ..... - must be equal to 0
(typ sign)14 2 ..... - reserved
16 2 GSZ character generator size
in bytes
18 GSZ actual character generator -
torus driver
Note: bytes 8...15 are also stored
in the channel and in the vector of the symbolic device
output quality. Bytes corresponding to
reserved are used there for
storage of current print coordinates and ad-
resa error handling procedures sim-
free output device.
****************************************
lpr - printer output device
0 2 ..... - port initialization
printer, if this is not
bypassed
2 2 ..... - procedure for printing symbols
la, filed in reg. A,
4 9 ..... - reserved
13 1 ..... - must be equal to 1
(lpr sign)
14 2 ..... - reserved
Note: bytes 8...15 are also stored
in the channel and in the vector of the symbolic device
output quality.
****************************************
key:
0 2 ..... - as a rule, not used
zuzyatsya
2 2 TTYIN ┐ entry points for
4 2 KWAIT │ input restarts
6 2 KTEST ┘ from keyboard
8 1 K_CSR - status register:
bit 0 - 0 - lowercase
1 - uppercase
bit 1 - 0 - Latin
1 - Russians
bit 2 - 0 - text
1 - pseudographicsbit 3 - 0 - kwait resolution
1 - kwait prohibition(1)
this bit is cleared
itself with an empty buffer
9 1 M_CSR - shift permission mask
corresponding bits
register K_CSR
1 - shift allowed
10 1 KLAST - code of the last pressed
keys
11 1 REPD - interval between first
two identical keys
vishami (delay auto-
repeat), value by
default - 29
12 1 REPP - interval between successive
sharing the same keys
vishami (frequency auto-
repeat), value by
default - 1
13 2 IKEYB - address of the survey procedure
keyboards
14 2 ..... - reserved
16 2 KS - Code table size
keys
18 KS ..... - the table itself
keys
............
KS+18 1 PNKEY - number of keys pressed
KS+19 1 - offset in the buffer
vish to code for TTYIN
(INC)
KS+20 32 ..... - buffer of pressed keys
(filled and emptied)
via INC)
=====cut=====
.
============== here we will end the file "IsDosDRV.C" ================Best regards, Felix.
[I.ZX]