; Note: This program will only work on a ZENITH 29 or 29A terminal ;======================================================================== ;= = ;= Programmer: Hunter Goatley = ;= Program: SCREEN.MAR = ;= Language: VAX-11 MACRO32 assembly language = ;= Purpose: Saves a Z29 screen in a file (SCREEN.SAVE) = ;= System: VAX 11/785 VAX/VMS v4.4 = ;= Date: July 1, 1986 = ;= = ;======================================================================== ; $FABDEF ; File Access Block symbols $RABDEF ; Record Access Block symbols $RMSDEF ; RMS symbols $IODEF ; I/O symbols ESC = 27 CR = 13 ; .PSECT SCREEN_DATA,LONG,NOEXE,WRT ; OUTFAB: ; The File Access Block $FAB FNM=, - ; Filename.ext RAT=CR, - ; Implied cariiage return ORG=SEQ, - ; Sequential file FAC=PUT ; Access is put ; OUTRAB: $RAB FAB=OUTFAB, - ; The Record Acess Block RBF=SCREEN, - ; The buffer to write from RSZ=0 ; The # of chars to write ; ... (will be filled in later) OUTSIGN: ; Buffer to hold numeric string .BYTE 0 ; ... from conversion from hex OUTPUT: .BYTE 0,0 ; ... to packed to decimal .ALIGN LONG WORK_PACKED: ; Work location to hold packed .LONG 0 ; ... decimal value SCREEN: .BLKB 256 ; Buffer for the data read from ; ... the screen TMASK: .QUAD 0 ; Terminator mask TTCHAN: .WORD 0 ; Channel for terminal I/O TTNAME: .ASCID /SYS$COMMAND/ ; Name of input channel ONE: .ASCII /[01;1H//[1p/ ; Z29 escape sequence to send ONE_L = . - ONE ; ... cursor to line 1, col. 1, ; ... and transmit the current ; ... line ;=============================================================================== ; .PSECT SCREEN_SAVE,EXE,NOWRT .ENTRY SCREEN_SAVE,^M<> ; $CREATE FAB=OUTFAB ; Open the output file BLBS R0,10$ ; Error? Report and die BRW ERROR ; ... 10$: $CONNECT RAB=OUTRAB ; Connect the RAB BLBS R0,20$ ; Error? Report and die BRW ERROR ; ... 20$: $ASSIGN_S - ; Assign an I/O channel to CHAN=TTCHAN, - ; ... SYS$COMMAND DEVNAM=TTNAME ; ... BLBS R0,30$ ; Error? Report and die BRW ERROR ; ... 30$: MOVZBL #1,R4 ; Current line number on screen ; ... is in R4 MAINLOOP: MOVZWL #256,R2 ; Init read counter (# of bytes ; ... to read from terminal MOVAL SCREEN,R3 ; Get address of buffer $QIOW_S CHAN=TTCHAN, - ; Send the cursor to the line FUNC=#IO$_WRITEVBLK, - ; ... indicated by R4 and tell P1=ONE, - ; ... the terminal to transmit P2=#ONE_L ; ... that line BLBS R0,READLOOP ; Error? Report and die BRW ERROR ; ... ; READLOOP: ; $QIOW_S CHAN=TTCHAN, - ; Read the line, one byte at a FUNC=#IO$_READVBLK!IO$M_NOECHO, - P1=(R3), - ; ... time, placing each byte in P2=#1 ; ... buffer SCREEN BLBC R0,ERROR ; Error? Report and die CMPB #13,(R3) ; Was a read? BEQLU HERE ; Yes -- end of the line -- go ; ... write the buffer out to ; ... the file and bump line # CMPB #0,(R3) ; If a NULL byte is read, take BEQLU HERE ; ... that is end of line, too INCL R3 ; No -- bump up buffer pointer SOBGTR R2,READLOOP ; Loop until all or 256 chars ; ... are read HERE: ; ;===== Trim any blanks off the end of the record ; 20$: CMPB #^A/ /,-1(R3) ; Is the last character a blank? BNEQU 30$ ; No -- found non-blank DECL R3 ; Decrement the buffer pointer BRB 20$ ; Go check the next character ; 30$: SUBL2 #SCREEN,R3 ; Get the length of the line MOVW R3,OUTRAB+RAB$W_RSZ ; Move the length to RAB $PUT RAB=OUTRAB ; Write the line to the file BLBC R0,ERROR ; Error? Report and die ; ; Loop until all 24 lines of screen are read ; AOBLEQ #24,R4,5$ ; If all lines have NOT been ; ... read yet, go convert ; ... line # in R4 to ASCII BRB 10$ ; If all HAVE been read, leave ; 5$: CVTLP R4,#2,WORK_PACKED ; Convert line # to packed CVTPS #2,WORK_PACKED,#2,OUTSIGN ; Packed line # to numeric str MOVW OUTPUT,ONE+2 ; Move numeric part to ESCape ; ... sequence (advance to next ; ... line) BRW MAINLOOP ; Go read next line ; ; Here to leave ; 10$: $CLOSE FAB=OUTFAB ; Close the output file ERROR: $EXIT_S CODE=R0 ; Exit to VMS .END SCREEN_SAVE