.TITLE RECALLABLE .IDENT /V1.1/ ; 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 ; 20-Apr-1987 fixes (such as 132 column display) $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 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 INIT_OPTIONS:: .LONG DTR$K_SEMI_COLON_OPT ! DTR$K_UNQUOTED_LIT ! - DTR$K_SYNTAX_PROMPT .PSECT $LOCAL, PIC, CON, REL, LCL, NOSHR, NOEXE, RD, WRT, LONG ; Variables LINE:: .BLKB 255 LINE_LEN == . - LINE ; Although a message buffer and auxiliary buffer are defined by the ; DAB, they are not long enough for 132 column screen operation: ; therefore, replacements are defined here. MSG_BUF:: .BLKB 132 MSG_BUF_LEN == . - MSG_BUF AUX_BUF:: .BLKB 132 AUX_BUF_LEN == . - AUX_BUF .LONG KEYBOARD:: .BLKL 1 TABLE:: .BLKL 1 TERM:: .BLKL 1 REC_LENGTH:: .BLKL 1 ; String Descriptors DESC_MSG:: .WORD MSG_BUF_LEN ; was DTR$MSG_BUF_LEN .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS MSG_BUF ; was DTR$MSG_BUF DESC_AUX:: .WORD AUX_BUF_LEN ; was DTR$AUX_BUF_LEN .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS AUX_BUF ; was 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) ; (when doing repetitive calls with the same ; arguments, it makes more sense to set up ; an argument list rather than push the ; arguments onto the stack each time the ; call is made). CVK_ARG:: ; SMG Create Vitual Keyboard .LONG 1 .ADDRESS KEYBOARD CKT_ARG:: ; SMG Create Key Table .LONG 1 .ADDRESS TABLE INI_ARG:: ; Datatrieve Init. .LONG 5 .ADDRESS DAB .ADDRESS HUNDRED .ADDRESS DESC_MSG .ADDRESS DESC_AUX .ADDRESS INIT_OPTIONS DTR_ARG:: ; Datatrieve Status .LONG 2 .ADDRESS DAB .ADDRESS OPTIONS RCL_ARG:: ; SMG Read Composed Line .LONG 12 .ADDRESS KEYBOARD .ADDRESS TABLE .ADDRESS DESC_LINE ; line .ADDRESS STR_SIZ .ADDRESS REC_LENGTH .LONG 0 ; null arguments .LONG 0 .LONG 0 .LONG 0 .LONG 0 .LONG 0 .ADDRESS TERM CMD_ARG:: ; Datatrieve Command .LONG 2 .ADDRESS DAB .ADDRESS STR_SIZ FIN_ARG:: ; Datatrieve Finish .LONG 1 .ADDRESS DAB .PSECT $CODE, CON, REL, LCL, SHR, EXE, RD, NOWRT, LONG ; Program starts here .ENTRY RECALLABLE_DTR, ^M ; Initialize SMG CALLG CVK_ARG, G^SMG$CREATE_VIRTUAL_KEYBOARD CALLG CKT_ARG, G^SMG$CREATE_KEY_TABLE ; Initialize Datatrieve 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 ; set normal carriage return ; terminates user input MOVAL DTR$_EXIT, R2 ; save this address (used often) LOOP:: CMPL R12, R2 ; is DTR_STATUS = DTR$_EXIT? BEQL FINISH ; branch if yes (DTR want's to quit) MOVAL SMG$K_TRM_CTRLZ, R0 ; get constant CMPL TERM, R0 ; did we get a Control-Z? BEQL FINISH ; branch if yes (user want's to leave) CVTWL DAB$W_MSG_LEN, R0 ; convert data types MOVW R0, STR_SIZ ; length of DTR$MSG_BUF MOVAB MSG_BUF, STR_ADR ; address of MSG_BUF ; was DTR$MSG_BUF CALLG RCL_ARG, G^SMG$READ_COMPOSED_LINE ; read line from user 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 FINISH:: CALLG FIN_ARG, G^DTR$FINISH ; clean up interface $EXIT_S #1 ; go byebye .END RECALLABLE_DTR