M EQU Byte Ptr 0[BX] TITLE 'Graphics Commands for DIABLO 150C' DGROUP GROUP DATA ; **************************************************************************** ; * * ; * ZDIABLOC : Support Enter/Exit Graphics Mode Commands for the * ; * DIABLO 150C COLOR Printer * ; * * ; **************************************************************************** ; * ; Revision : Jan. 12, 1984 FILE "ZDIABLOC.A86" GSX_86 V1.3 1-1 * ; * ;***** MODE NOTES : ********************************************************* ; * ; PRINTER DEPENDENT SETUP MODULE * ; * ; SUPPORT PRINTER ENTER/EXIT GRAPHIC MODE COMMANDS * ; ALLOCATE FOUR COLOR BITMAP BUFFERS * ; Function : * ; * ; GENTER : Enter Graphics Mode * ; GLF : Graphics Line Feed * ; ZFORM : Form Feed * ; GEXIT : Exit Graphics Mode * ; GCODE : Converts No. of Graphic bytes to ASCII bytes * ; Setup Color Index Table * ; GSETUP : Setup Printer for Graphics output * ; (for DIABLO : Setup right Margin for 8 inch plots) * ; Printer_Out : Output Data string to List device * ; Input : * ; BWIDE : No. of Graphics Bytes per Print Line * ; CCODE : Color Code Command designating the Color and Line no. of * ; the graphics data that follows. * ; * ; Program constants : * ; * ; PIXL : No. of pixel per graphic byte sent to the printer (DIABLO = 8)* ; WIRE : No. of pixel wire per print pass (DIABLO = 4) * ; * ; Output : * ; * ;----------------------------------------------------------------------------+ cseg PUBLIC GENTER, GCODE, ZFORM, GEXIT, GLF, GSETUP Extrn Printer_out:near dseg public pixl, wire, ccode, BWIDE PUBLIC BITMAP, MAP1, MAP2, MAP3, BSIZE PUBLIC MAPADR, WORDCOUNT, cormap_size PUBLIC CBITS, COLORBIT EXTRN BYTEND:word, MAPEND:word, XW:word ;----------------------------------------------------------------------------+ ; BITMAP Buffer ALLOCATION + ;----------------------------------------------------------------------------+ Bufsize Equ 15392 ; Total buffer size in bytes needed Wcount Equ 7696 ; No. of words Corsize Equ 3848 ; Single Color bit map buffer size Count4 Equ 1924 ; Single buffer size in words WORDCOUNT DW WCOUNT BSIZE dw BUFSIZE cormap_size dw corsize ; single buffer size in bytes BITMAP RS CorSIZE ; Color buffer for index 0 (black) MAP1 RS CorSIZE ; Color buffer for index 1 (magenta) MAP2 RS CorSIZE ; Color Buffer for Index 2 (Yellow) MAP3 RS CorSIZE ; Color Buffer for Index 3 (Cyan) MAPADR DW Offset BITMAP ; Buffer Address Pointers dw Offset MAP1 dw Offset MAP2 dw Offset MAP3 BWIDE Rs 02 ;----------------------------------------------------------------------------+ ; Define Color Table Parameters for DIABLO C150 + ;----------------------------------------------------------------------------+ ; Seven Colors ; Four Primary Colors : Black, Magenta, Yellow, Blue ; Three Secondary Colors produced by overlaying: ; Red = Magenta + Yellow ; Green = Yellow + Blue ; Purple = Magenta + Blue ; Color Overlay Byte COLORBIT is used by SET PIXEL (SETBIT), indicating ; whether or not a color plane needs to be SET to produce the color ; 0 = No Overlay, 1 = Yes ; Color Overlay byte defined: Lsb 0:Black Plane, 1:Magenta Plane ; 2:Yellow Plane, 3:Blue (Cyan) Plane CBITS db 00000000b ; White db 00000110b ; Red = Magenta and Yellow db 00001100b ; Green = Yellow and Blue db 00001000b ; Blue db 00001010b ; Purple = Magenta and Blue db 00000100b ; Yellow = Yellow db 00000010b ; Magenta db 00000001b ; Black COLORBIT db 00000110b ; Current Color byte ;----------------------------------------------------------------------------+ ; PRINTER CONSTANTS (DIABLO C150 Color printer) + ;----------------------------------------------------------------------------+ PIXeL EQU 8 ;8 pixels printed per graphic byte PWIRE EQU 4 ; 4 print wires per print pass ESC EQU 1BH ;Escape Code FF EQU 0CH ;Form Feed CR EQU 0DH ;CR LF Equ 0Ah ;LF PIXL dw pixel ;No. of pixels per data byte WIRE DW PWIRE ;---------------------------------------------------------------------+ ; Graphics Commands for the Printer + ;---------------------------------------------------------------------+ ccode db 30h ; Black Color, top print line command ; Graphics mode : ESC,g,ccode,n1,n2,n3,',' Graph_mode Db 07, Esc, 67h Color_code Db 30h Gn2 Db 30h Gn1 Db 30h Gn0 Db 30h, 2Ch ; No. of graphics bytes in 3 ASCII bytes ; Designat 8.5 inches from left edge. Esc, r, n1, n2 Margin_set Db 05, Esc, 72h, 38h, 35h, 0Ah ; Micro line feed : Esc,k,'1' New_line Db 04, Esc, 6Bh, 31h, CR Two_inch Db 12, LF, LF, LF, LF, LF, LF, LF, LF, LF, LF, LF, LF cseg ;----------------------------------------------------------------------------+ ; Setup printer for graphics + ; Mapend = BYTEND - XW : Start byte address in bit map to scan data + ; Graphics data byte format = bit map data format + ;----------------------------------------------------------------------------+ GSETUP: Mov Ax, Word Ptr BYTEND ; Lasr byte in bit map Sub Ax, Word Ptr XW ; Offset to first byte of last line MOV Word Ptr MAPEND, Ax ; Upon Power-up or remote reset, the printable surface is set ; to 7 inches, Change the right margin to support 8 inches ; Graphics image plot Mov Cx, (Offset Margin_set) Call Printer_out Ret ;-------------------------------------------------------------------+ ; Enter Graphics dot Image Mode + ;-------------------------------------------------------------------+ ; Graphic setup for the printer GENTER: Push Cx Mov Cl, Byte Ptr CCODE Mov Byte Ptr Color_code, Cl ; Designate Color and Line No. MOv Cx, (Offset Graph_mode) Call Printer_out Pop Cx RET ;-------------------------------------------------------------------+ ; Convert No. of graphics bytes to 3 ASCII byte format + ;-------------------------------------------------------------------+ GCODE: Mov gn2, 30h mov ax, word ptr bwide Cmp Ax, 100 ; N2 = bwide / 100 Jb Gtwo Inc gn2 Sub Ax, 100 ; get Remainder(bwide/100) Gtwo: mov dx, 0 mov bx, 10 ; N1 = remainder / 10 div bx add al, 30h mov gn1, al add dl, 30h mov gn0, dl ; N0 = remainder RET ;--------------------------------------------------------------------+ ; Do a FormFeed, Send 12 Line feeds + ;--------------------------------------------------------------------+ ZFORM: Mov Cx, (Offset Two_inch) Call Printer_out RET ;--------------------------------------------------------------------+ ; Exit graphic mode + ;--------------------------------------------------------------------+ GEXIT: RET ;-------------------------------------------------------------------+ ; Graphic Line Feed + ;-------------------------------------------------------------------+ GLF: Push Cx Mov Cx, (Offset New_line) Call Printer_out Pop Cx Ret END