home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
apps
/
dtp
/
pgsmodst
/
atariprt
/
neccp7.s
< prev
next >
Wrap
Text File
|
1991-05-23
|
7KB
|
381 lines
include "prtequ.h"
*
* Nec P7 color print driver
*
CYAN equ 2
MAGENTA equ 1
YELLOW equ 4
BLACK equ 0
CR equ $d
LF equ $a
FF equ $c
ESC equ $1b
FS equ $1c
SECTION printer,CODE,PUBLIC
***************************************************************
***************************************************************
***************************************************************
dumbentry:
clr.l d0
rts
dc.l "PRNT"
dc.w 200
*
* distribute the calls to the appropriate routines
*
NeccP7: move.l a0,table
lsl.w #2,d0
lea prntbl,a1
move.l 0(a1,d0.w),a1
jmp (a1)
*
* identify who I am, and set up who I like to speak to.
*
p_ident:
move.l #driver,pdrvrnm(a0) ;pointer to string for driver name
move.w #PARALLEL+ASCENDING,device(a0)
prtok: moveq #1,d0
rts
*
* initialize the table of printer specific routines
*
p_init: clr.b pdl(a0) ;no page description language
clr.b pmult(a0) ;automatically print mulitiple copies?
clr.b pman(a0) ;handle manual feed?
move.b #PRT_CMYK,ptype(a0) ;printer type?
move.l sendout(a0),send+2 ;self-modifing code, tisk, tisk!
*
* pminlft and pmaxw must be evenly divisible by 16
* this is the part that should be worked out
*
move.w pdensity(a0),d0
cmp.w #7,d0
bcs pint1
moveq #6,d0
pint1: lsl.w #1,d0
lea xdpi_tbl,a1
move.w 0(a1,d0.w),pxdpi(a0) ;x resolution
lea ydpi_tbl,a1
move.w 0(a1,d0.w),pydpi(a0) ;y resolution
lea minl_tbl,a1
move.w 0(a1,d0.w),pminlft(a0) ;pixels from the left
lea minr_tbl,a1
move.w 0(a1,d0.w),pminrht(a0) ;pixels from the right
lea mint_tbl,a1
move.w 0(a1,d0.w),pmintop(a0) ;pixels down from top
lea minb_tbl,a1
move.w 0(a1,d0.w),pminbot(a0) ;pixels up from bottom
lea xover_tbl,a1
move.w 0(a1,d0.w),pxover(a0) ;percentage of x overlap of dots
lea yover_tbl,a1
move.w 0(a1,d0.w),pyover(a0) ;percentage of y overlap of dots
lea rowht_tbl,a1
move.w 0(a1,d0.w),prowht(a0) ;rows height modula
move.w 0(a1,d0.w),rowht
lea rows_tbl,a1
move.w 0(a1,d0.w),rows
lea grmode_tbl,a1
move.w 0(a1,d0.w),grmode
lsl.w #1,d0
lea maxw_tbl,a1
move.l 0(a1,d0.w),pmaxw(a0) ;maximum # pixels across
lea maxh_tbl,a1
move.l 0(a1,d0.w),pmaxh(a0) ;maximum # pixels down
bra prtok
*
* going to begin printing a document
*
p_bgndoc:
move.b #ESC,d0 ;unidirectional print
bsr send
move.b #"U",d0
bsr send
move.b #1,d0
bra send
*
* about to start printing of a page
*
p_bgnpage:
bra prtok
*
* about to print a new tile for the page
*
p_bgntile:
bra prtok
*
* print a block to the printer
*
p_block:
move.l table,a0
move.l pblockplane(a0),pplane
move.l pblockw(a0),d0
move.w d0,width
move.l pblockptr(a0),a1
move.l (a1),a1
add.l pblockoff(a0),a1
move.l a1,v_base
*
*print the block
*
move.w rows,count
printt: move.l v_base,a0 ;yellow
add.l pplane,a0
add.l pplane,a0
move.b #YELLOW,d0
bsr putline
move.l v_base,a0 ;magenta
add.l pplane,a0
move.b #MAGENTA,d0
bsr putline
move.l v_base,a0 ;cyan
move.b #CYAN,d0
bsr putline
move.l v_base,a0 ;black
add.l pplane,a0
add.l pplane,a0
add.l pplane,a0
move.b #BLACK,d0
bsr putline
move.b #FS,d0 ;set line spacing to 1/360"
bsr send
move.b #"3",d0
bsr send
move.b #1,d0
bsr send
move.w #LF,d0
bsr send
moveq #0,d0
move.w width,d0
add.l d0,v_base
subq.w #1,count
bne printt
*
move.b #FS,d0 ;set line spacing to 1/360"
bsr send
move.b #"3",d0
bsr send
move.w #48,d0
sub.w rows,d0
bsr send
move.b #LF,d0
bra send
**************************************
putline:
move.l a0,lineptr
move.w d0,-(sp)
lea setcolor,a0
bsr sendline
move.w (sp)+,d0
bsr send
move.l lineptr,a0
move.w #0,twidth
move.w #23,d1
print0: move.w width,d0
print1: tst.b -1(a0,d0.w)
bne print2
subq.w #1,d0
bne print1
moveq #1,d0
print2: cmp.w twidth,d0
blt print3
move.w d0,twidth
print3:
move.w rows,d3
pri1:
add.w width,a0
sub.w #1,d3
bgt pri1
*
dbf d1,print0
*
lea setgr,a0
bsr sendline
move.w grmode,d0
bsr send
move.w twidth,d0 ;send number of graphic bytes to follow
lsl.w #3,d0
bsr send
move.w twidth,d0
lsr.w #5,d0
bsr send
move.w twidth,d2 ;length of the data in byte
print4: move.w d2,twidth
moveq #7,d4
print6: move.w d4,pixel
moveq #2,d3
move.l lineptr,a0
print5: move.w d3,bytes
moveq #7,d1
moveq #0,d0
*
s1: btst d4,(a0)
beq s2
bset d1,d0
s2:
move.w rows,d3
pri2:
add.w width,a0
sub.w #1,d3
bgt pri2
*
dbf d1,s1
move.l a0,-(sp)
bsr send
move.l (sp)+,a0
*
move.w pixel,d4
move.w bytes,d3
dbf d3,print5
*
move.w pixel,d4
dbf d4,print6
*
add.l #1,lineptr
move.w twidth,d2
subq.w #1,d2
bgt print4
*
move.w #CR,d0
bra send
************************************
*
* just finished describing current tile
*
p_endtile:
move.l table,a0
move.l pblockh(a0),d0
mulu #360,d0
divu pydpi(a0),d0
move.w d0,scroll
pend1: tst.b scroll
beq pend2
move.b #FS,d0
bsr send
move.b #"3",d0
bsr send
move.b #255,d0
bsr send
move.b #LF,d0
bsr send
sub.w #255,scroll
bra pend1
pend2: tst.w scroll
beq prtok
move.b #FS,d0
bsr send
move.b #"3",d0
bsr send
move.w scroll,d0
bsr send
move.b #LF,d0
bra send
*
* just finished describing all tiles for this page
*
p_endpage:
bra prtok
*
* finished printing the document
*
p_enddoc:
bra prtok
*
* user requested stop
*
p_break:
bra p_endtile
***************************************************
*** these are the send routines for the ***
*** dot matrix driver. ***
***************************************************
sendline:
move.b (a0)+,d0
beq prtok
move.l a0,-(sp)
bsr send
move.l (sp)+,a0
bra sendline
send: jmp $ffffff
***********************************
*** ***
***********************************
SECTION printer,DATA,PUBLIC
prntbl: dc.l prtok,prtok,prtok,prtok,p_init
dc.l p_bgndoc,p_bgnpage,p_bgntile
dc.l p_block
dc.l p_endtile,p_endpage,p_enddoc
dc.l p_break,p_ident
xdpi_tbl: dc.w 60,90,120,180,180,360,360
ydpi_tbl: dc.w 180,180,180,180,360,180,360
minl_tbl: dc.w 10,20,30,45,45,90,90
minr_tbl: dc.w 10,20,30,45,45,90,90
mint_tbl: dc.w 0,0,0,0,0,0,0
minb_tbl: dc.w 0,0,0,0,0,0,0
maxw_tbl: dc.l 816,1232,1632,2464,2464,4928,4928
maxh_tbl: dc.l 0,0,0,0,0,0,0
xover_tbl: dc.w 0,10,10,20,20,30,30
yover_tbl: dc.w 0,0,0,0,50,0,50
rowht_tbl: dc.w 24,24,24,24,48,24,48
rows_tbl: dc.w 1,1,1,1,2,1,2
grmode_tbl: dc.w 32,38,33,39,39,40,40
driver: dc.b "NecP7 color v2.0.1 Beta",0
setcolor: dc.b ESC,"r",0
setgr: dc.b ESC,"*",0
SECTION printer,BSS,PUBLIC
table: ds.l 1
twidth: ds.w 1
pixel: ds.w 1
v_base: ds.l 1
bytes: ds.w 1
lineptr: ds.l 1
width: ds.w 1
pplane: ds.l 1
count: ds.w 1
grmode: ds.w 1
rows: ds.w 1
rowht: ds.w 1
scroll: ds.w 1
; v2.0.1 - didn't send lf to scroll to top of next page in endtile