M EQU Byte Ptr 0[BX] TITLE 'DDPGIOS - GSX-86 PRINTER DRIVER' DGROUP GROUP DATA ; **************************************************************************** ; * * ; * DDPGIOS : PRINTER DRIVER - MAIN MODULE * ; * * ; * Get the Parameter Block Address Pointer from DS:Dx and * ; * Jump to the Program identified by the Opcode in Contrl(1) * ; * * ; **************************************************************************** ; * ; Revision : Jan. 27, 1984 File "DDPGIOS.A86" GSX-86 V1.3b V1-1 * ; * ; DDRIVER (Pbptr) * ; * ; Input : Parameter Block * ; * ; DS:DX Address of Control Array (CONTRL) * ; DS:DX+2 Address of Input Parameter Array (INTIN) * ; DS:DX+4 Input Point Coordinate Array (PTSIN) * ; DS:DX+6 Output Parameter Array (INTOUT) * ; DS:DX+8 Output Point Coordinate Array (PTSOUT) * ; * ; Output : * ; * ; Opcode Dependent, Output returned to GSX in Array CONTRL, INTOUT, * ; and PTSOUT * ; * ; Program Jump Table : * ; * ; OPTBL : Sequence of addresses pointing to the start address of * ; a number of different programs supporting the graphic * ; function required * ; i.e. OPTBL(6) = Start address of the Polyline routine * ; Opcode 6 identifies a Polyline call * ; * ; * ; CALL DDPGIOS * ; DS:Dx = Address of Parameter Block * ; * ;***************************************************************************** CSEG EXTRN RASOUT:near, Check_abort:near, Cleanup:near EXTRN ZOPWK:near, ZCLRWK:near, ZCLWK:near, ZFORM:near EXTRN ZUPDWK:near, ZPL:near, ZFA:near, ZTX:near EXTRN ZPM:near, ZGDP:near EXTRN ZCHSZ:near, ZCHRT:near, ZLNCO:near, ZLNTY:near EXTRN ZMKTY:near, ZMKCO:near, ZMKSZ:near EXTRN ZFITY:near, ZINTY:near, ZTXCO:near EXTRN ZFICO:near, ZESCAP:near, ZCELL:near, zrite:near ; ;The following equates are for BP addressing the arguments ;passed into the GIOS device driver ; OLD_BP EQU 0 CONTRL_O EQU 2 ;offset control array CONTRL_S EQU 4 ;segment control array CONTRL EQU dword ptr CONTRL_O INTIN_O EQU 6 ;offset integer in array INTIN_S EQU 8 ;integer in array INTIN EQU dword ptr INTIN_O PTSIN_O EQU 10 ;offset points in array PTSIN_S EQU 12 ;segment points in array PTSIN EQU dword ptr PTSIN_O INTOUT_O EQU 14 ;offset of integer out array INTOUT_S EQU 16 ;segment of integer out array INTOUT EQU dword ptr INTOUT_O PTSOUT_O EQU 18 ;offset pts out array PTSOUT_S EQU 20 ;segment pts out array PTSOUT EQU dword ptr PTSOUT_O ; ;The following equates are for integer array indexing W_1 EQU word ptr 0 W_2 EQU word ptr 2 W_3 EQU word ptr 4 W_4 EQU word ptr 6 W_5 EQU word ptr 8 W_6 EQU word ptr 10 W_7 EQU word ptr 12 W_8 EQU word ptr 14 W_9 EQU word ptr 16 W_10 EQU word ptr 18 Eject ; Upon entry to the driver from GSX, Ds:Dx points to the parameter block. ; All other registers are undefined. ; The driver should use its own stack, to avoid overflowing the Gdos caller's. DDENTRY: Mov Ax,Sp ; Save caller's stack Mov Bx,Ss Mov Cx,Seg DriverStack ; Point stack at our area Pushf ; Save the interrupt state Pop SI ; in SI Cli ; Clear the interrupts before ; changing the stack segment Mov Ss,Cx Mov Sp,Offset DriverStackTop Push SI ; Restore the Interrupt state Popf ; into the flag register ; Now in driver's stack Pushf ; Save Caller's flags Push Bx ; Preserve caller' stack base Push Ax ; and offset Push DS ; and his DS ; Put the parameter block on the stack for Bp addressing. Mov Si,Dx ; Point Ds:Si at parameter block Add Si,18 ; Point at last word Mov Cx,10 ; 10 words of pointers Std ; Work down in address ParamPushLoop: LODSW ;Get a parameter pointer word Push Ax ; Push onto my stack Loop ParamPushLoop ; Loop until all 5 Dword Ptrs pushed Push Bp ; Point Bp at Contrl offset, preserving Mov Bp,Sp ; the caller's for politeness ; Point Ds to our data segment Mov Ax,Seg OPTBL ; Segment base of our data Mov Ds,Ax ; No further need for caller's Ds ;The following routine does a computed call based on the function op code ;passed in CONTRL(1) CLD ; CLear the Direction Flag Les DI,CONTRL[BP] ;ES:DI -> control array Mov ES:W_3[DI],0 ;clear contrl(3) Mov BX,ES:[DI] ;get the function number into BX Cmp Bx, 1 ;always process the open wk call Je Operate ; Check Error Abort flag : Error abort flag is set by : ; 1. Disk Full error - Vector list generator finds there is not enough ; room on the disk to create the temporary disk overflow file. ; 2. Console key pressed to stop output demand. Cmp Byte Ptr Error_flg, 0FFh Jne Stop_chk Cmp Bx, 5 ; Check for Clear/Close/Update Wk Jnb Done ; which indicates end of current plot, Mov Byte Ptr Error_flg, 0 ; Reset error flag for next plot. Call Cleanup ; Reset Object Count and Delete Jmp Done ; Tmp File. ; Check console abort key command Stop_chk: Call Check_abort Cmp Byte Ptr Abort_flg, 0FFh ; Check abort flag and Jne Operate ; continue if not set Mov Byte Ptr Error_flg, 0FFh ; Set the Error Flag which Jmp Done ; is used as a stop output ; indicator. Operate: Shl BX,1 ;make it a word pointer Call OPTBL[BX] ;call the proper routine Done: Pop BP ;restore the old BP Add Sp,20 ; Remove parameter block from stack Pop DS ; recover the DS Pop Ax ; Ax <- caller's Sp Pop Bx ; Bx <- caller's Ss Popf ; Restore Flags Pushf ; Save the interrupt state Pop CX ; in CX Cli ; clear the interrupts before ; changing the stack segment Mov Ss,Bx ; Restore the caller's stack Mov Sp,Ax ; Pair Push CX ; restore the interrupt state Popf ; in the flag register RETF ; return to the driver caller ;----------------------------------------------------------------------------+ ; No Action Opcode Supports + ;----------------------------------------------------------------------------+ NOACT: RET ; Return to Caller Dseg Public Error_flg Extrn Abort_flg:byte Error_flg Db 0 ;----------------------------------------------------------------------------+ ; The Opcode Program Jump Table + ;----------------------------------------------------------------------------+ OPTBL DW (Offset noact) ; Opcode = 0 DW (Offset ZOPWK) ; Open Workstation, Opcode = 1 DW (Offset ZCLWK) ; Close Workstation, Opcode = 2 DW (Offset ZCLRWK) ; Clear Workstation, Opcode = 3 DW (Offset ZUPDWK) ; Update Workstation,Opcode = 4 DW (Offset ZESCAP) ; Escape Sequences, Opcode = 5 DW (Offset ZPL) ; PolyLine, Opcode = 6 DW (Offset ZPM) ; Polymarker, Opcode = 7 DW (Offset ZTX) ; Text, Opcode = 8 DW (Offset ZFA) ; Fill Area, Opcode = 9 DW (Offset ZCELL) ; Cell Array, Opcode = 10 DW (Offset ZGDP) ; GDP Opcode = 11 DW (Offset ZCHSZ) ; Set Char Height Opcode = 12 DW (Offset ZCHRT) ; Set Char Up Vector Opcode = 13 DW (Offset noact) ; Set Color Rep Opcode = 14 DW (Offset ZLNTY) ; Set Polyline Type Opcode = 15 DW (Offset noact) ; Set Polyline Width Opcode = 16 DW (Offset ZLNCO) ; Set Polyline Color Opcode = 17 DW (Offset ZMKTY) ; Set Polymarker Typ Opcode = 18 DW (Offset ZMKSZ) ; Set Polymarker Scl Opcode = 19 DW (Offset ZMKCO) ; Set Polymarker Clr Opcode = 20 DW (Offset noact) ; Set Text Font Opcode = 21 DW (Offset ZTXCO) ; Set Text Color Opcode = 22 DW (Offset ZFITY) ; Set Fill Int Style Opcode = 23 DW (Offset ZINTY) ; Set Fill Sty Index Opcode = 24 DW (Offset ZFICO) ; Set Fill Color Opcode = 25 DW (Offset noact) ; Inq Color Rep Opcode = 26 DW (Offset noact) ; Inq Cell Array Opcode = 27 DW (Offset noact) ; Input Locator Opcode = 28 DW (Offset noact) ; Input Valuator Opcode = 29 DW (Offset noact) ; Input Choice Opcode = 30 DW (Offset noact) ; Input String Opcode = 31 DW (Offset zrite) ; Set Writing Mode Opcode = 32 DW (Offset noact) ; Set Input Mode Opcode = 33 ; Sseg ; Driver stack DriverStack Rs 256 ; Adjust before shipping DriverStackTop Rs 0 End