M EQU Byte Ptr 0[BX] TITLE 'CLOSE/UPDATE/CLEAR WORKSTATION ' ; ************************************************************************* ; * * ; * CLEAR : Paper Form Feed and OUTPUT graph same as CLOSE * ; * WORKSTATION * ; * CLOSE : Close and Update outputs the graph, but do not * ; * form feeds. * ; * UPDATE WORKSTATION : The Object List is cleared and the Temporary * ; * file deleted. * ; * the OBJECT list buffer is CLEARed and the * ; * temporary file, if created, is deleted. * ; * * ; ************************************************************************* ; * ; Revision : Feb. 01, 1984 File "A:ZCLWKNEW.A86" GSX-86 V1.3b 1-0 * ; Feb-01-84 Deallocate memory for CP/M * ; Jan-26-84 Cleanup routine zeroes object count and delete tmp file * ; Dec-22-83 Free Allocated memory block under PC DOS V2.0 * ; Nov-27-83 Modified for OS check and printer allocation * ; Nov-21-83 Do not reset Attribute Settings to default for Clear Wk * ; * ; Opcode = 3, Clear Workstation * ; form feed, call zclwk * ; retaine all the attribute settings * ; Opcode = 2, Close Workstation * ; Opcode = 4, Update Workstation * ; Zclwk (objcnt, objlst) * ; Zupdwk(objcnt, objlst) * ; * ; call rasout ;raster convert vector list into bitmap * ; call scaner ;scan bit image from bit map to the printer * ; clear object list buffer, delete temporary file if created * ; * ;************************************************************************** PUBLIC ZCLRWK, ZCLWK, ZUPDWK, CLEANUP EXTRN DOFLOW:near, DOEND:near, MSGOUT:near DSEG EXTRN XMAX:word, YMAX:word, XMIN:word, YMIN:word, OBJCNT:word EXTRN OBJLST:word, NDLNSZ:word, ndinit:word EXTRN Version:Word, Abort_flg:byte, Error_flg:byte Extrn Bitmap_Segment:Word, Allocated:byte Extrn Mcb:word, M_ext:byte Finn Db 0 CSEG ;---------------------------------------------------------------------+ ; Operating System Equates + ;---------------------------------------------------------------------+ BDOS Equ 224 CPM_Type equ 0 MPM_Type equ 1 CCPM_Type equ 4 CPM equ 20H CPMPLUS equ 30H CCPM2 equ 20H CCPM3 equ 30H PCDOS1 equ 0F1H PCDOS2 equ 0F2H MSDOS equ 0FFH CPM_V equ 0001H MPM_V equ 0002H CPMPLUS_V equ 0003H CCPM2_V equ 0004H CCPM3_V equ 0005H PCDOS1_V equ 00F1H PCDOS2_V equ 00F2H MSDOS_V equ 00FFH ; EXTRN RASOUT:near, ZFORM:near ;----------------------------------------------------------------------------+ ; Clear Workstation + ;----------------------------------------------------------------------------+ ZCLRWK: CALL Zform ; FORM FEED Call Zupdwk ; replace the default attrributes by the current attributes, ; open workstation is the only time the default settings are ; used, a clear workstation should put the current settings into ; the default area, so the next graph can assume that the previous ; attributes are still current. Push Es Mov Ax, Ds Mov Es, Ax Mov Di, (Offset NDINIT) Mov Si, (Offset NDLNSZ) ; The attributes settings Mov Cx, 32 ; made during this session replaces Rep MOVSW ; the default attributes Pop Es Ret ;----------------------------------------------------------------------------+ ; Close Workstation + ;----------------------------------------------------------------------------+ ZCLWK: Mov Byte Ptr Finn, 0ffh ZUPDWK: Call doplot ;---------------------------------------------------------------------+ ; Clear OBJLST, Objcnt = 0, reset Max/Min Plot extents + ;---------------------------------------------------------------------+ CLEANUP: MOV Word Ptr OBJCNT,0 MOV Word Ptr XMAX,0 MOV Word Ptr YMAX,0 ; ; Clean UP : Delete Object List File If Created ; CALL DOEND Mov Byte Ptr Abort_flg, 0 Mov Byte Ptr Error_flg, 0 Cmp Byte Ptr Finn, 0 ; Deallocate resources only if Jne Close_it ; this is close workstation Jmp Done Close_it: Mov Byte Ptr Finn, 0 ; Reset Op Flag ; Deallocate the printer resource if in a shared OS mov ax,Version cmp ax,CPM_V je CPM_V_CW cmp ax,CPMPLUS_V je CPMPLUS_V_CW cmp ax,MPM_V je MPM_V_CW cmp ax,CCPM2_V je CCPM2_V_CW cmp ax,CCPM3_V je CCPM3_V_CW cmp ax,PCDOS2_V je PCDOS_V_CW ; Free allocated memory under DOS V2.0 Jmp Done ; Memory is not allocated under DOS V1.1 CCPM2_V_CW: CCPM3_V_CW: Push Es mov cl,9FH int 224 Pop Es CPM_V_CW: CPMPLUS_V_CW: MPM_V_CW: ; Free Memory Block if it has been allocated. Cmp Byte Ptr Allocated, 0ffh ; Flag Set ? Je M_Free Jmp Done M_free: Mov Byte Ptr Allocated, 0 Mov Byte Ptr M_ext, 0 Mov Cl, 039h Mov Dx, (Offset MCB) Int BDOS Jmp Done PCDOS_V_CW: ; Check the memory allocation flag and free the memory block ; if it has been allocated Cmp Byte Ptr Allocated, 0ffh ; Flag set ? Jne Done Mov Byte Ptr Allocated, 0 Mov Ax, Word Ptr Bitmap_segment Mov Es, Ax Mov Ax, 04900h ; Ah = 49H, Free allocated memory Int 21h Done: RET ;----------------------------------------------------------------------------+ ; Update Workstation + ;----------------------------------------------------------------------------+ DOPLOT: MOV BX,Word Ptr OBJCNT MOV AL,BH ;Object Count = 0 ? OR AL,BL JZ ZJ02 CALL DOFLOW ;SetUp for OBJLST buffer Accessing CALL RASOUT ;Raster Convert and Scan Output to Printer ZJ02: RET END