; Program to print screen dumps created by 'COCOCAD', a nice ; public domain program for the Radio Shack Color Computer used ; to generate schematics. ; Mike Allen 8/10/86 ; ; Added OKI92 equate for Okidata ML-92/93 printers. ; John D. Osnes 10/3/86 NO EQU 0 YES EQU NOT NO EPSON EQU YES ; Epson mx80 OKI92 EQU NO ; Okidata ml-92/93 WBOOT EQU 0 ; Warm boot BDOS EQU 5 ; Bdos call OPENF EQU 0FH ; Bdos open file SETDMA EQU 1AH ; Bdos set dma READSQ EQU 14H ; Bdos read sequental CLOSEF EQU 10H ; Bdos close file LSTOUT EQU 5 ; Bdos list out MAGIC EQU -7BH-256+1 ; Magic number for data offset CR EQU 0DH ; Carrige return LF EQU 0AH ; Line feed ESC EQU 1BH ; Escape FF EQU 0CH ; Form feed ORG 100H LXI H,0 DAD SP SHLD OLDSP ; Save old stack ptr LXI SP,STKTOP ; Set local stack IF EPSON MVI E,ESC ; Put mx80 in 8/72 mode CALL LISTIT ; Esc, 'A', 08h sequence MVI E,'A' CALL LISTIT MVI E,8 CALL LISTIT CALL CRLF ; Set mx80 for 8/72 per line ENDIF ; Epson IF OKI92 MVI E,18H ; Set up oki92 printer CALL LISTIT ; Reset (18h) MVI E,1CH ; 12 cpi CALL LISTIT MVI E,0DH ; Return carriage CALL LISTIT MVI E,03H ; Graphic mode CALL LISTIT LXI B,468 ; Set up buffer for excess bits LXI H,EXCESS ; (oki92 only prints 7 pixels/line, SHLD EXSPTR ; instead of 8 pixels/line, so must INIOKI: MVI M,0 ; save excess bits for next line) INX H DCX B MOV A,B ORA C JNZ INIOKI ENDIF ; Oki92 LXI H,FCB0 ; Load up fcbs for first three files SHLD PTR1 LXI H,FCB1 SHLD PTR2 LXI H,FCB2 SHLD PTR3 CALL BIGLOOP ; Print them LXI H,FCB3 ; Load up fcbs for next three files SHLD PTR1 LXI H,FCB4 SHLD PTR2 LXI H,FCB5 SHLD PTR3 CALL BIGLOOP ; Print them LXI H,FCB6 ; Load up fcb for final three files SHLD PTR1 LXI H,FCB7 SHLD PTR2 LXI H,FCB8 SHLD PTR3 CALL BIGLOOP ; And print them IF EPSON MVI E,ESC ; Esc, 'A', 0Ch puts mx80 back CALL LISTIT ; to 12/72 spacing MVI E,'A' CALL LISTIT MVI E,12 CALL LISTIT ; Restore line spacing CALL CRLF ENDIF ; Epson IF OKI92 LXI H,NSHIFT MOV A,M CPI 7 MVI C,1 CNZ OKILL ; Print excess bits, if any MVI E,03H ; Reset oki92 printer CALL LISTIT ; Exit graphic mode MVI E,02H CALL LISTIT MVI E,18H ; Reset CALL LISTIT ENDIF ; Oki92 MVI E,FF CALL LISTIT ; Send out a form feed EXIT: LHLD OLDSP ; Restore the stack SPHL RET ; Return to ccp CRLF: MVI E,CR ; Sends cr/lf pair to printer CALL LISTIT MVI E,LF ; Fall thru listit LISTIT: MVI C,LSTOUT ; Enter with character in e JMP BDOS ; Bdos supplies the ret OPENIT: SHLD TMPFCB ; Open file - enter with fcb pointer in hl XCHG ; Put fcb pointer in de MVI C,OPENF CALL BDOS ; Open it INR A JZ EXIT ; Ff means bad open RET RDLOOP: LHLD TMPPTR ; Pointer to dma area XCHG ; Into de MVI C,SETDMA CALL BDOS ; Set dma area for read LHLD TMPPTR LXI D,128 DAD D SHLD TMPPTR ; Get ready for next read LHLD TMPFCB XCHG MVI C,READSQ CALL BDOS ; Read next record (or try to) ORA A JZ RDLOOP ; Record was there, try for more LHLD TMPPTR LXI D,-128 DAD D SHLD TMPPTR ; End of file - readjust pointer LHLD TMPFCB XCHG MVI C,CLOSEF CALL BDOS ; Close the file INR A JZ EXIT ; Bad close RET LINELP: MVI B,156 ; Initialize character loop PUSH B ; Save 'em LHLD TMPPTR CHRLP: LXI D,-32 DAD D XCHG PUSH D ; Calculate new entry into table and save it LDAX D ; Get char from data CMA ; Invert all bits IF OKI92 MVI D,8 ; Oki92 only prints 7 pixels/line, with REVRSE: RAR ; top pixel in least significant bit MOV B,A ; Consequently, must first reverse the MOV A,C ; order of the bits RAL MOV C,A MOV A,B DCR D JNZ REVRSE XRA A ; Then, shift so that any excess bits NSHIFT EQU $+1 ; from preceding lines are in least MVI D,7 ; significant bits (top of line) with SHIFT: MOV B,A ; no pixel in the most significant MOV A,C ; bit RAR MOV C,A MOV A,B RAR DCR D JNZ SHIFT RAR LHLD EXSPTR ORA M MOV M,C ; Store excess bits shifted out of INX H ; current line for printing on next SHLD EXSPTR ; line CPI 03H JNZ OKILST MOV E,A CALL LISTIT MVI A,03H OKILST EQU $ ENDIF ; Oki92 MOV E,A CALL LISTIT POP H ; Put last entry point in hl POP B DCR B PUSH B ; Decrement chr counter and save it MOV A,B ORA A JNZ CHRLP ; Not done with line, so repeat POP B RET LOOP3: MVI C,30 ; Initialize line loop LOOPLN EQU $ IF EPSON PUSH B MVI E,ESC ; Mx80 in lo-res, 468 points/line CALL LISTIT ; Esc, 'K', (468 mod 256), (468 div 256) MVI E,'K' CALL LISTIT MVI E,212 CALL LISTIT MVI E,1 CALL LISTIT ; Put mx-80 in lo-res graphics, 468 horiz pts. POP B ENDIF ; Epson LHLD PTR3 ; Print 156 pts from 3rd active file SHLD TMPPTR CALL LINELP LHLD TMPPTR INX H SHLD PTR3 LHLD PTR2 ; Print 156 pts from 2nd active file SHLD TMPPTR CALL LINELP LHLD TMPPTR INX H SHLD PTR2 LHLD PTR1 ; Print 156 pts from 1st active file SHLD TMPPTR CALL LINELP PUSH B LHLD TMPPTR INX H SHLD PTR1 IF EPSON CALL CRLF ; End of line, send cr/lf ENDIF ; Epson IF OKI92 OKCRLF: MVI E,03H ; Graphic lf/cr for oki92 printer CALL LISTIT MVI E,0EH CALL LISTIT LXI H,EXCESS SHLD EXSPTR LXI H,NSHIFT DCR M JNZ NXTLIN POP B OKILL: PUSH B ; Every 7 lines, there are 7 excess MVI M,8 ; bits shifted out of the preceding LXI B,468 ; line, so dump these bits to print EXSLIN: PUSH B ; an 8th line LHLD EXSPTR MOV E,M MVI M,0 INX H SHLD EXSPTR MVI A,03H CMP E JNZ EXSLN2 CALL LISTIT MVI E,03H EXSLN2: CALL LISTIT POP B DCX B MOV A,B ORA C JNZ EXSLIN JMP OKCRLF NXTLIN EQU $ ENDIF ; Oki92 POP B DCR C ; Decrement line counter JNZ LOOPLN ; Not done, so repeat RET BIGLOOP:LHLD PTR1 ; Get fcb of 1st active file CALL OPENIT LHLD OLDPTR SHLD TMPPTR CALL RDLOOP LHLD TMPPTR LXI D,MAGIC DAD D SHLD PTR1 LHLD PTR2 ; Get fcb of 2nd active file CALL OPENIT CALL RDLOOP LHLD TMPPTR LXI D,MAGIC DAD D SHLD PTR2 LHLD PTR3 ; Get fcb of 3rd active file CALL OPENIT CALL RDLOOP LHLD TMPPTR LXI D,MAGIC DAD D SHLD PTR3 CALL LOOP3 ; Print these three files RET FCB0: DB 0,'PRT PG0',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB1: DB 0,'PRT PG1',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB2: DB 0,'PRT PG2',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB3: DB 0,'PRT PG3',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB4: DB 0,'PRT PG4',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB5: DB 0,'PRT PG5',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB6: DB 0,'PRT PG6',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB7: DB 0,'PRT PG7',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FCB8: DB 0,'PRT PG8',0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 OLDPTR: DW BUFFER OLDSP EQU $ STKTOP EQU OLDSP+66 ; 32-level stack plus storage for ; user's stack pointer TMPPTR EQU STKTOP PTR1 EQU TMPPTR+2 PTR2 EQU PTR1+2 PTR3 EQU PTR2+2 TMPFCB EQU PTR3+2 IF EPSON FREESP EQU TMPFCB+2 ENDIF ; Epson IF OKI92 EXSPTR EQU TMPFCB+2 EXCESS EQU EXSPTR+2 ; Buffer for excess bits (468 bytes/line) FREESP EQU EXCESS+468 ENDIF ; Oki92 BUFFER EQU FREESP END