*####################################################################### * PROGRAM PRINT...CP/M 68k Print Utility * ====================================== * This program first chains to PIP to * print the specified file and then * to program T to send a formfeed to * the printer. * ====================================== * * Dr. David C. Wilcox * DCW Industries, Inc. * 5354 Palm Drive, La Canada, CA 91011 * 818/790-3844 * * August 1, 1985 *####################################################################### boot equ 00 *warm boot print equ 09 *print string chain equ 47 *chain to program lf equ 10 *line feed cr equ 13 *carriage return space equ 32 *ascii space extral equ 11 *bytes in command leadin extrat equ 07 *bytes in command tail bdos equ $0002 *BDOS entry point *####################################################################### * * Special registers: * * a4 = address of 1st parsed FCB * a5 = address of DMA buffer * d5 = number of characters in input file name * d6 = total characters in chain command (d5+extral+extrat) * *####################################################################### * * Locate FCB and DMA (for portability) * link a6,#0 *mark stack frame move.l 8(a6),a0 *get base page address lea $5c(a0),a4 *get address of 1st parsed file name lea $80(a0),a5 *get address of DMA buffer clr.l d2 *make sure d2 is empty * * Check for no file specified * cmpi.b #space,$1(a4) bne start move.l #usage,d1 *if no parameters... move.w #print,d0 *display instructions trap #bdos jsr quit *and exit to CP/M * * Determine number of characters in file name and add * 'extral' and 'extrat' for chain command string count * start: movea.l a5,a1 *point to DMA move.b (a1)+,d6 *put total characters in d6 move.b d6,d2 *transfer to d2 which will be counter addi #extral,d6 *adjust for command leadin addi #extrat,d6 *adjust for command tail * * Save file name at 'source' * clr.l d5 *make sure d5 is empty movea.l #source,a0 *get the source file name sfile: move.b (a1)+,(a0)+ addq #1,d5 subq #1,d2 *make sure we're not out of characters blt error *before we find the null cmpi.b #0,(a1) bne sfile * * Copy command string count and command leadin to DMA * movea.l a5,a0 *point to the DMA move.b d6,(a0)+ *put character count in first byte move.w #extral,d2 *prepare to move 'extral' bytes movea.l #leadin,a1 *point to command leadin jsr movmem *and copy to DMA * * Copy source file name to DMA * move.b d5,d2 *retrieve number of chars in file name movea.l #source,a1 *point to source file name jsr movmem *and copy to DMA * * Copy command tail and concluding null to DMA * move.b #extrat,d2 *prepare to move 'extrat' bytes movea.l #tail,a1 *now add the command tail jsr movmem *and copy to DMA move.b #0,(a0) *conclude with a null * * Invoke the chain command * move.w #chain,d0 *now let PIP do the rest trap #bdos *####################################################################### * Subroutines *####################################################################### * * Quit to CP/M * quit: move.w #boot,d0 trap #bdos * * Report file error * error: move.l #errmsg,d1 move.w #print,d0 trap #bdos bra quit * * Move d2 bytes from a1 to a0 * movmem: move.b (a1)+,(a0)+ subq #1,d2 bne movmem rts *####################################################################### * Messages and storage area *####################################################################### source: ds.b 32 usage: dc.b lf,cr,'Correct usage: PRINT filename' dc.b lf,cr,lf,cr,'$' errmsg: dc.b 'File name error...PRINT aborted',cr,lf,'$' leadin: dc.b 'A:PIP LST:=' tail: dc.b '[RT8]!T' *####################################################################### end