home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG001.ARK
/
HYS13.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
4KB
|
220 lines
.title 'Diablo Hytype I Printer Routine Z-80 VERSION'
.sbttl 'Copyright 1976 by Technical Design Labs, inc.'
; VERSION 1.6
; DIABLO HYTYPE I PRINTER ROUTINE
;
;COPYRIGHT 1976 BY TECHNICAL DESIGN LABS, INC.
; WRITTEN BY TOM KIRK
;
; SO LONG AS THE ORIGINATOR AND THE LIST
; OF MODIFIERS IS INSERTED INTO THE SOURCE
; CODE, AND KEPT INTACT, PERMISSION IS
; HEREBY GIVEN TO COPY, MODIFY, AND
; DISTRIBUTE FOR NON-COMMERCIAL PURPOSES.
;
; MODIFIED BY:
;
; DEC 22, 1976
;
; LIMITS ON TYPING AREA
WIDTH = 132 ; WIDTH IN TENTHS OF AN INCH
;
; TYPE SIZE PARAMETERS
LPINCH = 6 ; LINES PER INCH
CPINCH = 10 ; CHARACTERS PER INCH
;
; CALCULATION OF PROGRAM CONSTANTS
LSTEP = 48/LPINCH ; STEPS PER LINE
;
WIDE = WIDTH*6 ; STEPS WIDE
WIDXX = WIDE/256*256
WIDHR = WIDE/256 ; RESET CARRAGE
WIDLR = WIDE-WIDXX ; COUNTERS
CSTEP = 60/CPINCH ; STEPS PER CHARACTER
LMARGN = 60*2 ;LEFT HAND MARGIN
;
; INTERFACE PORTS
HTPD1 = 06H ; FIRST DATA PORT
HTPD2 = 07H ; SECOND DATA PORT
HTPS = 06H ; STATUS PORT
BS = 008H
LF = 00AH
CR = 00DH
CRBIT = 004H
LFBIT = 008H
PWBIT = 001H
CKBIT = 002H
LFSTB = 008H
CRSTB = 020H
PWSTB = 010H
RESTR = 080H
;
RAM = 0 ;PLACE STORAGE
; AT OTHER THAN END OF PROGRAM
HERE = 0fc00h
;
; PLUG IN MONITOR PATCH
.LOC 0F812H ;LINE PRINTER VECTOR
JMP HYTYPE ;AL=L
;
.LOC HERE ;RELOCATABLE
;
HYTYPE: PUSH H ; SAVE EVERYTHING
PUSH D
PUSH B
PUSH PSW
;
NOP ; MOV C,B FOR ALS8
;
MOV A,C ;TEST CHARACTER
ANI 7FH
CPI ' '+1 ; FOR CONTROL
JM CNTRL
CPI 7FH
JZ HYTP1
;
CALL TYPE ; SO PRINT IT
JMP STEP
;
HYTP1: POP PSW ; RESTORE EVEYTHING
POP B
POP D
POP H
MOV A,C ;NOP FOR ALS-8
RET
;
TYPE: LHLD CRPOS ; MOVE
XCHG ; CARRAGE
LHLD CRCNT ; IF
SHLD CRPOS ; NEEDED
CALL DSPLCE
MOV A,H
ORA L
CNZ SPACE
;
TYPE1: MOV L,C ;TYPE
CALL PRINT ; CHARACTER
RET
;
DSPLCE: MOV A,D ; ONE'S COMPLEMENT
CMA ; DE
MOV D,A
MOV A,E
CMA
MOV E,A
INX D ; TWO'S COMPLEMENT DE
DAD D ; DE IS NOW -DE
MOV A,H ; SET SIGN BIT
ORA A ; AS A RESULT
RP
MOV A,L ; BACKWARD
CMA ; DISPLACEMENT
INR A ; IS
MOV L,A ; POSITIVE
MOV A,H ; NUMBER
CMA ; WITH
ACI 0 ; SET
ORI 0FCH ; SIGN
MOV H,A ; BIT
RET
;
SPACE: CALL CHECK ; IS
IN HTPS ; CARRAGE
ANI CRBIT ; BUZY?
JNZ SPACE
MVI A,CRSTB ; MOVE
JMP HTPCRL ; CARRAGE
;
LNFEED: ; IS
IN HTPS ; PLATTEN
ANI LFBIT ; BUZY?
JNZ LNFEED
MVI A,LFSTB ; ROLL
JMP HTPCRL ; PLATTEN
;
PRINT: ; IS
IN HTPS ; PRINT WHEEL
ANI PWBIT ; BUZY?
JNZ PRINT
MVI A,PWSTB ; SPIN
JMP HTPCRL ; PRINT WHEEL
;
CHECK: IN HTPS ; IS
ANI CKBIT ; PRINTER
RNZ ; OK?
MVI A,RESTR ; RESTORE
LXI H,0 ; PRINTER
SHLD CRPOS ; TO
LXI H,0
SHLD CRCNT ; LEFT
CALL HTPCRL
LXI H,LSTEP
CALL LNFEED
RET
;
HTPCRL: PUSH PSW
MOV A,L ; SEND
CMA ; LOW BYTE
OUT HTPD1 ; OF DATA
;
MOV A,H ; SEND
ANI 7 ; HIGH 3
MOV H,A ; BITS
CMA ; OF
OUT HTPD2 ; DATA
;
POP PSW ; SET UP
ANI 0F8H ; AND
ORA H ; ACTIVATE
CMA ; CONTROL
OUT HTPD2 ; STROBE
;
MOV A,H ; REMOVE
CMA ; CONTROL
OUT HTPD2 ; STROBE
RET
CNTRL: CPI ' ' ; MOVE DESIRED CARRAGE
JNZ CNTR1 ; POSITION
STEP: LXI D,CSTEP ; 1 CHARACTER
LHLD CRCNT ; TO
DAD D ; THE
SHLD CRCNT ; RIGHT.
MOV A,H ; RESET CARRAGE
CPI WIDHR ; COUNTER AFTER
JC HYTP1 ; RIGHT HAND LIMIT
MOV A,L ; IS REACHED
CPI WIDLR
JC HYTP1 ; DON'T RUN INTO
LXI H,LMARGN ;END STOP.
SHLD CRCNT ; NEW LINE
LXI H,LSTEP ; TOO.
CALL LNFEED
JMP HYTP1
;
CNTR1: CPI CR ; SET DESIRED
JNZ CNTR2 ; CARRAGE
LXI H,LMARGN ;POSITION
SHLD CRCNT ; TO
JMP HYTP1 ; LEFT MARGIN.
;
CNTR2: CPI LF ; MOVE DESIRED
JNZ CNTR3 ; PLATTEN POSITION
LXI H,LSTEP ; UP BY
CALL LNFEED ; ONE LINE.
JMP HYTP1
;
CNTR3: CPI BS ;BACK
JNZ HYTP1 ;SPACE
LHLD CRCNT ;ONE
LXI D,-CSTEP
DAD D ;CHARACTER
SHLD CRCNT
JMP HYTP1
;
.IFN RAM,[ ;LOCATION OF STORAGE
.LOC RAM ;IF NON-ZERO]
CRPOS: .WORD 0 ; SPACE POS NOW
CRCNT: .WORD 0 ; SPACE POS FUTURE
;
.end