.TITLE RECALLABLE .IDENT /V1.0/ ; This is a Macro-32 version of Dana Schwartz's program that ; calls DTR in such a way as to allow previous command line ; recall through the SMG routines. I did it because not ; everyone has FORTRAN, and because people might want to ; see how to call DTR from Macro. ; ; B. Z. Lederman 18-Jul-1986 $SMGDEF ; define SMG constants $DSCDEF ; define descriptor constants .LIBRARY /DAB.MLB/ ; my own private library which holds: $DABDEF ; my DTR DAB definition macro. .PSECT $PDATA, PIC, CON, REL, LCL, SHR, NOEXE, RD, NOWRT, LONG ; Constants semi_C: .LONG DTR$K_SEMI_COLON_OPT hundred: .LONG 100 OPTIONS: .LONG DTR$M_OPT_CONTROL_C ! DTR$M_OPT_STARTUP ! - DTR$M_OPT_FOREIGN ! DTR$M_OPT_BANNER ! DTR$M_OPT_CMD .PSECT $LOCAL, PIC, CON, REL, LCL, NOSHR, NOEXE, RD, WRT, LONG ; Variables LINE: .BLKB 255 line_len = . - line .EVEN KEYBOARD: .BLKL 1 TABLE: .BLKL 1 TERM: .BLKL 1 REC_LENGTH: .BLKL 1 ; String Descriptors desc_msg: .WORD DTR$MSG_BUF_LEN .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS DTR$MSG_BUF desc_aux: .WORD DTR$AUX_BUF_LEN .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS DTR$AUX_BUF desc_line: .WORD line_len .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS LINE ; All purpose string descriptor str_siz: .WORD 0 ; length set later .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S str_adr: .LONG 0 ; address also set later ; Argument lists for various calls (SMG and DTR) cvk_arg: .LONG 1 .ADDRESS KEYBOARD ckt_arg: .LONG 1 .ADDRESS TABLE ini_arg: .LONG 5 .ADDRESS DAB .ADDRESS hundred .ADDRESS desc_msg .ADDRESS desc_aux .ADDRESS semi_c ; DTR$K_SEMI_COLON_OPT dtr_arg: .LONG 2 .ADDRESS DAB .ADDRESS OPTIONS rcl_arg: .LONG 12 .ADDRESS KEYBOARD .ADDRESS TABLE .ADDRESS desc_line ; LINE .ADDRESS str_siz ; MSG_BUF ? .ADDRESS REC_LENGTH .LONG 0 ; null arguments .LONG 0 .LONG 0 .LONG 0 .LONG 0 .LONG 0 .ADDRESS TERM cmd_arg: .LONG 2 .ADDRESS DAB .ADDRESS str_siz fin_arg: .LONG 1 .ADDRESS DAB .PSECT $CODE, CON, REL, LCL, SHR, EXE, RD, NOWRT, LONG ; Program starts here .entry recallable_dtr, ^M CALLG cvk_arg, G^SMG$CREATE_VIRTUAL_KEYBOARD CALLG ckt_arg, G^SMG$CREATE_KEY_TABLE CALLG ini_arg, G^DTR$INIT CALLG dtr_arg, G^DTR$DTR ; check DTR link MOVL R0, R12 ; save status return MOVAL SMG$K_TRM_CR, TERM MOVAL DTR$_EXIT, R2 ; 141 DO WHILE ( ( DTR_STATUS .NE. %LOC(DTR$_EXIT) ) .AND. ; 1 ( TERM .NE. %LOC(SMG$K_TRM_CTRLZ) ) ) loop: CMPL R12, R2 ; is DTR_STATUS = DTR$_EXIT? BEQL finish ; branch if yes MOVAL SMG$K_TRM_CTRLZ, R0 ; get constant CMPL TERM, R0 ; did we get a Control-Z? BEQL finish ; branch if yes CVTWL DAB$W_MSG_LEN, R0 ; convert data types MOVW R0, str_siz ; length of DTR$MSG_BUF MOVAB DTR$MSG_BUF, str_adr ; address of DTR$MSG_BUF CALLG rcl_arg, G^SMG$READ_COMPOSED_LINE ; read line from terminal MOVW REC_LENGTH, str_siz ; length of line MOVAB LINE, str_adr ; address of line CALLG cmd_arg, G^DTR$COMMAND ; send a command to DTR CALLG dtr_arg, G^DTR$DTR ; check DTR status MOVL R0, R12 ; and save it BRB loop ; repeat until done NOP ; longword align NOP finish: CALLG fin_arg, G^DTR$FINISH ; clean up interface $EXIT_S ; go byebye .END RECALLABLE_DTR