diff options
Diffstat (limited to 'v4.0/src/CMD/COMMAND/TPIPE.ASM')
| -rw-r--r-- | v4.0/src/CMD/COMMAND/TPIPE.ASM | 660 |
1 files changed, 660 insertions, 0 deletions
diff --git a/v4.0/src/CMD/COMMAND/TPIPE.ASM b/v4.0/src/CMD/COMMAND/TPIPE.ASM new file mode 100644 index 0000000..23f8417 --- /dev/null +++ b/v4.0/src/CMD/COMMAND/TPIPE.ASM | |||
| @@ -0,0 +1,660 @@ | |||
| 1 | page 80,132 | ||
| 2 | ; SCCSID = @(#)tpipe.asm 1.1 85/05/14 | ||
| 3 | ; SCCSID = @(#)tpipe.asm 1.1 85/05/14 | ||
| 4 | TITLE PART8 COMMAND Transient routines. | ||
| 5 | |||
| 6 | |||
| 7 | INCLUDE comsw.asm | ||
| 8 | .xlist | ||
| 9 | .xcref | ||
| 10 | INCLUDE DOSSYM.INC | ||
| 11 | INCLUDE comseg.asm | ||
| 12 | INCLUDE comequ.asm | ||
| 13 | .list | ||
| 14 | .cref | ||
| 15 | |||
| 16 | |||
| 17 | DATARES SEGMENT PUBLIC BYTE ;AC000; | ||
| 18 | EXTRN ECHOFLAG:BYTE | ||
| 19 | EXTRN InitFlag:byte | ||
| 20 | EXTRN INPIPEPTR:WORD | ||
| 21 | EXTRN OUTPIPEPTR:WORD | ||
| 22 | EXTRN PIPE1:BYTE | ||
| 23 | EXTRN PIPE1T:BYTE | ||
| 24 | EXTRN PIPE2:BYTE | ||
| 25 | EXTRN PIPE2T:BYTE | ||
| 26 | EXTRN PIPEFILES:BYTE | ||
| 27 | EXTRN PIPEFLAG:BYTE | ||
| 28 | EXTRN PIPEPTR:WORD | ||
| 29 | EXTRN RESTDIR:BYTE | ||
| 30 | EXTRN SINGLECOM:WORD | ||
| 31 | DATARES ENDS | ||
| 32 | |||
| 33 | TRANDATA SEGMENT PUBLIC BYTE ;AC000; | ||
| 34 | EXTRN BADDAT_PTR:WORD | ||
| 35 | EXTRN BADTIM_PTR:WORD | ||
| 36 | EXTRN curdat_mo_day:word ;AN000; | ||
| 37 | EXTRN CURDAT_PTR:WORD | ||
| 38 | EXTRN curdat_yr:word ;AN000; | ||
| 39 | EXTRN curtim_hr_min:word ;AN000; | ||
| 40 | EXTRN CURTIM_PTR:WORD | ||
| 41 | EXTRN curtim_sec_hn:word ;AN000; | ||
| 42 | EXTRN eurdat_ptr:word | ||
| 43 | EXTRN japdat_ptr:word | ||
| 44 | EXTRN newdat_format:word ;AN000; | ||
| 45 | EXTRN NEWDAT_PTR:WORD | ||
| 46 | EXTRN NEWTIM_PTR:WORD | ||
| 47 | EXTRN parse_date:byte ;AN000; | ||
| 48 | EXTRN parse_time:byte ;AN000; | ||
| 49 | EXTRN PIPEEMES_PTR:WORD | ||
| 50 | EXTRN promtim_hr_min:word ;AN000; | ||
| 51 | EXTRN promtim_ptr:word ;AN000; | ||
| 52 | EXTRN promtim_sec_hn:word ;AN000; | ||
| 53 | EXTRN STRING_BUF_PTR:WORD ;AC000; | ||
| 54 | EXTRN SYNTMES_PTR:WORD | ||
| 55 | EXTRN usadat_ptr:word | ||
| 56 | |||
| 57 | TRANDATA ENDS | ||
| 58 | |||
| 59 | TRANSPACE SEGMENT PUBLIC BYTE ;AC000; | ||
| 60 | EXTRN COMBUF:BYTE | ||
| 61 | EXTRN date_day:byte ;AN000; | ||
| 62 | EXTRN date_month:byte ;AN000; | ||
| 63 | EXTRN date_year:word ;AN000; | ||
| 64 | EXTRN INTERNATVARS:BYTE | ||
| 65 | EXTRN RESSEG:WORD | ||
| 66 | EXTRN time_fraction:byte ;AN000; | ||
| 67 | EXTRN time_hour:byte ;AN000; | ||
| 68 | EXTRN time_minutes:byte ;AN000; | ||
| 69 | EXTRN time_seconds:byte ;AN000; | ||
| 70 | TRANSPACE ENDS | ||
| 71 | |||
| 72 | TRANCODE SEGMENT PUBLIC BYTE | ||
| 73 | ASSUME CS:TRANGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING | ||
| 74 | |||
| 75 | EXTRN CERROR:NEAR | ||
| 76 | EXTRN NOPIPEPROC:NEAR | ||
| 77 | EXTRN STD_PRINTF:NEAR | ||
| 78 | EXTRN TCOMMAND:NEAR | ||
| 79 | EXTRN TESTDOREIN:NEAR | ||
| 80 | EXTRN TESTDOREOUT:NEAR | ||
| 81 | EXTRN TESTKANJ:NEAR ;AN000;3/3/KK | ||
| 82 | EXTRN TSYSGETMSG:NEAR ;AN000; | ||
| 83 | |||
| 84 | PUBLIC CTIME | ||
| 85 | PUBLIC DATE | ||
| 86 | PUBLIC DATINIT | ||
| 87 | PUBLIC PIPEDEL | ||
| 88 | PUBLIC PIPEERRSYN | ||
| 89 | PUBLIC PIPEPROC | ||
| 90 | PUBLIC PIPEPROCSTRT | ||
| 91 | PUBLIC PRINT_TIME | ||
| 92 | PUBLIC SETREST | ||
| 93 | PUBLIC SETREST1 | ||
| 94 | PUBLIC SINGLETEST | ||
| 95 | |||
| 96 | SINGLETEST: | ||
| 97 | ASSUME DS:NOTHING | ||
| 98 | push ds | ||
| 99 | MOV DS,ResSeg | ||
| 100 | ASSUME DS:ResGroup | ||
| 101 | CMP [SINGLECOM],0 | ||
| 102 | JZ TestDone | ||
| 103 | CMP [SINGLECOM],0EFFFH | ||
| 104 | TestDone: | ||
| 105 | pop ds | ||
| 106 | return | ||
| 107 | |||
| 108 | |||
| 109 | ASSUME DS:TRANGROUP | ||
| 110 | SETREST1: | ||
| 111 | MOV AL,1 | ||
| 112 | SETREST: | ||
| 113 | PUSH DS | ||
| 114 | MOV DS,[RESSEG] | ||
| 115 | ASSUME DS:RESGROUP | ||
| 116 | MOV [RESTDIR],AL | ||
| 117 | POP DS | ||
| 118 | ASSUME DS:TRANGROUP | ||
| 119 | return | ||
| 120 | |||
| 121 | ASSUME DS:RESGROUP | ||
| 122 | |||
| 123 | ; | ||
| 124 | ; Note that we need to handle the same thing that RestDir handles: the | ||
| 125 | ; requirement that we try only once to restore the user's environment after | ||
| 126 | ; and INT 24 or the like. If the condition that causes the INT 24 does not | ||
| 127 | ; disappear, we just give up. | ||
| 128 | ; | ||
| 129 | |||
| 130 | PIPEDEL: | ||
| 131 | assume ds:nothing | ||
| 132 | push ds | ||
| 133 | PUSH DX | ||
| 134 | mov ds,ResSeg | ||
| 135 | assume ds:ResGroup | ||
| 136 | mov DX,OFFSET RESGROUP:PIPE1 ; Clean up in case ^C | ||
| 137 | MOV AH,UNLINK | ||
| 138 | INT int_command | ||
| 139 | MOV DX,OFFSET RESGROUP:PIPE2 | ||
| 140 | MOV AH,UNLINK | ||
| 141 | INT int_command | ||
| 142 | POP DX | ||
| 143 | call PipeOff | ||
| 144 | mov PipeFiles,0 | ||
| 145 | pop ds | ||
| 146 | return | ||
| 147 | |||
| 148 | PIPEERRSYN: | ||
| 149 | MOV DX,OFFSET TRANGROUP:SYNTMES_ptr | ||
| 150 | CALL PIPEDEL | ||
| 151 | PUSH CS | ||
| 152 | POP DS | ||
| 153 | JMP CERROR | ||
| 154 | PIPEERR: | ||
| 155 | pushf | ||
| 156 | invoke triageError | ||
| 157 | SaveReg <AX,DX> ; Save results from TriageError | ||
| 158 | MOV DX,OFFSET TRANGROUP:PIPEEMES_ptr | ||
| 159 | CALL PIPEDEL | ||
| 160 | PUSH CS | ||
| 161 | POP DS | ||
| 162 | invoke std_eprintf | ||
| 163 | RestoreReg <DX,AX> ; Restore results from TriageError | ||
| 164 | popf | ||
| 165 | cmp ax, 65 | ||
| 166 | jnz tcommandj | ||
| 167 | JMP CERROR | ||
| 168 | tcommandj: | ||
| 169 | jmp tcommand | ||
| 170 | |||
| 171 | PIPEPROCSTRT: | ||
| 172 | ASSUME DS:TRANGROUP,ES:TRANGROUP | ||
| 173 | MOV DS,[RESSEG] | ||
| 174 | ASSUME DS:RESGROUP | ||
| 175 | INC [PIPEFILES] ; Flag that the pipe files exist | ||
| 176 | MOV AH,Get_Default_Drive ; Get current drive | ||
| 177 | INT int_command | ||
| 178 | ADD AL,capital_A | ||
| 179 | MOV [PIPE2],AL ; Make pipe files in root of def drv | ||
| 180 | MOV BX,OFFSET RESGROUP:PIPE1 | ||
| 181 | MOV [BX],AL | ||
| 182 | xor ah,ah ; nul terminate path names | ||
| 183 | mov [Pipe1T],ah | ||
| 184 | mov [Pipe2T],ah | ||
| 185 | MOV DX,BX | ||
| 186 | XOR CX,CX | ||
| 187 | mov ah,CreateTempFile ; the CreateTemp call | ||
| 188 | INT int_command | ||
| 189 | JC PIPEERR ; Couldn't create | ||
| 190 | MOV BX,AX | ||
| 191 | MOV AH,CLOSE ; Don't proliferate handles | ||
| 192 | INT int_command | ||
| 193 | |||
| 194 | MOV DX,OFFSET RESGROUP:PIPE2 | ||
| 195 | mov ah,createTempFile ; the CreateTemp call | ||
| 196 | INT int_command | ||
| 197 | JC PIPEERR | ||
| 198 | MOV BX,AX | ||
| 199 | MOV AH,CLOSE | ||
| 200 | INT int_command | ||
| 201 | |||
| 202 | CALL TESTDOREIN ; Set up a redirection if specified | ||
| 203 | MOV SI,[PIPEPTR] | ||
| 204 | CMP [SINGLECOM],-1 | ||
| 205 | JNZ NOSINGP | ||
| 206 | MOV [SINGLECOM],0F000H ; Flag single command pipe | ||
| 207 | NOSINGP: | ||
| 208 | JMP SHORT FIRSTPIPE | ||
| 209 | |||
| 210 | PIPEPROC: | ||
| 211 | ASSUME DS:RESGROUP | ||
| 212 | AND [ECHOFLAG],0FEh ; force current echo to be off | ||
| 213 | MOV SI,[PIPEPTR] | ||
| 214 | LODSB | ||
| 215 | CMP AL,AltPipeChr ; Alternate pipe char? | ||
| 216 | JZ IsPipe1 ; Yes | ||
| 217 | CMP AL,vbar | ||
| 218 | jz IsPipe1 | ||
| 219 | jmp PIPEEND ; Pipe done | ||
| 220 | IsPipe1: | ||
| 221 | MOV DX,[INPIPEPTR] ; Get the input file name | ||
| 222 | MOV AX,(OPEN SHL 8) | ||
| 223 | INT int_command | ||
| 224 | PIPEERRJ: | ||
| 225 | jnc no_pipeerr | ||
| 226 | JMP PIPEERR ; Lost the pipe file | ||
| 227 | no_pipeerr: | ||
| 228 | MOV BX,AX | ||
| 229 | MOV AL,0FFH | ||
| 230 | XCHG AL,[BX.PDB_JFN_Table] | ||
| 231 | MOV DS:[PDB_JFN_Table],AL ; Redirect | ||
| 232 | |||
| 233 | FIRSTPIPE: | ||
| 234 | MOV DI,OFFSET TRANGROUP:COMBUF + 2 | ||
| 235 | XOR CX,CX | ||
| 236 | CMP BYTE PTR [SI],0DH ; '|<CR>' | ||
| 237 | JNZ PIPEOK1 | ||
| 238 | PIPEERRSYNJ: | ||
| 239 | JMP PIPEERRSYN | ||
| 240 | PIPEOK1: | ||
| 241 | mov al,vbar | ||
| 242 | CMP BYTE PTR [SI],al ; '||' | ||
| 243 | JZ PIPEERRSYNJ | ||
| 244 | CMP BYTE PTR [SI],AltPipeChr ; '##' or '|#'? | ||
| 245 | JZ PipeErrSynJ ; Yes, Error | ||
| 246 | PIPECOMLP: | ||
| 247 | LODSB | ||
| 248 | STOSB | ||
| 249 | |||
| 250 | ;;;; IF KANJI 3/3/KK | ||
| 251 | CALL TESTKANJ | ||
| 252 | JZ NOTKANJ5 | ||
| 253 | MOVSB | ||
| 254 | ; | ||
| 255 | ; Added following 2 commands to the fix pipe bug. | ||
| 256 | ; | ||
| 257 | inc cx ;AN000; 3/3/KK | ||
| 258 | inc cx ;AN000; 3/3/KK | ||
| 259 | ; | ||
| 260 | JMP PIPECOMLP | ||
| 261 | |||
| 262 | NOTKANJ5: | ||
| 263 | ;;;; ENDIF ; 3/3/KK | ||
| 264 | |||
| 265 | CMP AL,0DH | ||
| 266 | JZ LASTPIPE | ||
| 267 | INC CX | ||
| 268 | CMP AL,AltPipeChr | ||
| 269 | JZ IsPipe2 | ||
| 270 | CMP AL,vbar | ||
| 271 | JNZ PIPECOMLP | ||
| 272 | IsPipe2: | ||
| 273 | MOV BYTE PTR ES:[DI-1],0DH | ||
| 274 | DEC CX | ||
| 275 | MOV [COMBUF+1],CL | ||
| 276 | DEC SI | ||
| 277 | MOV [PIPEPTR],SI ; On to next pipe element | ||
| 278 | MOV DX,[OUTPIPEPTR] | ||
| 279 | PUSH CX | ||
| 280 | XOR CX,CX | ||
| 281 | MOV AX,(CREAT SHL 8) | ||
| 282 | INT int_command | ||
| 283 | POP CX | ||
| 284 | JC PIPEERRJ ; Lost the file | ||
| 285 | MOV BX,AX | ||
| 286 | MOV AL,0FFH | ||
| 287 | XCHG AL,[BX.PDB_JFN_Table] | ||
| 288 | MOV DS:[PDB_JFN_Table+1],AL | ||
| 289 | XCHG DX,[INPIPEPTR] ; Swap for next element of pipe | ||
| 290 | MOV [OUTPIPEPTR],DX | ||
| 291 | JMP SHORT PIPECOM | ||
| 292 | |||
| 293 | LASTPIPE: | ||
| 294 | MOV [COMBUF+1],CL | ||
| 295 | DEC SI | ||
| 296 | MOV [PIPEPTR],SI ; Point at the CR (anything not '|' will do) | ||
| 297 | CALL TESTDOREOUT ; Set up the redirection if specified | ||
| 298 | PIPECOM: | ||
| 299 | PUSH CS | ||
| 300 | POP DS | ||
| 301 | JMP NOPIPEPROC ; Process the pipe element | ||
| 302 | |||
| 303 | PIPEEND: | ||
| 304 | CALL PIPEDEL | ||
| 305 | CMP [SINGLECOM],0F000H | ||
| 306 | JNZ NOSINGP2 | ||
| 307 | MOV [SINGLECOM],-1 ; Make it return | ||
| 308 | NOSINGP2: | ||
| 309 | JMP TCOMMAND | ||
| 310 | |||
| 311 | ASSUME DS:TRANGROUP,ES:TRANGROUP | ||
| 312 | |||
| 313 | ; Date and time are set during initialization and use | ||
| 314 | ; this routines since they need to do a long return | ||
| 315 | |||
| 316 | DATINIT PROC FAR | ||
| 317 | mov cs:[resseg],ds ; SetInitFlag needs resseg initialized | ||
| 318 | PUSH ES | ||
| 319 | PUSH DS ; Going to use the previous stack | ||
| 320 | MOV AX,CS ; Set up the appropriate segment registers | ||
| 321 | MOV ES,AX | ||
| 322 | MOV DS,AX | ||
| 323 | invoke TSYSLOADMSG ;AN000; preload messages | ||
| 324 | invoke SETSTDINON ;AN026; turn on critical error on STDIN | ||
| 325 | invoke SETSTDOUTOFF ;AN026; turn off critical error on STDOUT | ||
| 326 | MOV DX,OFFSET TRANGROUP:INTERNATVARS;Set up internat vars | ||
| 327 | MOV AX,INTERNATIONAL SHL 8 | ||
| 328 | INT 21H | ||
| 329 | MOV WORD PTR DS:[81H],13 ; Want to prompt for date during initialization | ||
| 330 | MOV [COMBUF],COMBUFLEN ; Init COMBUF | ||
| 331 | MOV WORD PTR [COMBUF+1],0D01H | ||
| 332 | CALL DATE | ||
| 333 | CALL CTIME | ||
| 334 | POP DS | ||
| 335 | POP ES | ||
| 336 | RET | ||
| 337 | DATINIT ENDP | ||
| 338 | |||
| 339 | ; DATE - Gets and sets the time | ||
| 340 | |||
| 341 | |||
| 342 | break Date | ||
| 343 | |||
| 344 | |||
| 345 | ; **************************************************************** | ||
| 346 | ; * | ||
| 347 | ; * ROUTINE: DATE - Set system date | ||
| 348 | ; * | ||
| 349 | ; * FUNCTION: If a date is specified, set the system date, | ||
| 350 | ; * otherwise display the current system date and | ||
| 351 | ; * prompt the user for a new date. If an invalid | ||
| 352 | ; * date is specified, issue an error message and | ||
| 353 | ; * prompt for a new date. If the user enters | ||
| 354 | ; * nothing when prompted for a date, terminate. | ||
| 355 | ; * | ||
| 356 | ; * INPUT: command line at offset 81H | ||
| 357 | ; * | ||
| 358 | ; * OUTPUT: none | ||
| 359 | ; * | ||
| 360 | ; **************************************************************** | ||
| 361 | |||
| 362 | assume ds:trangroup,es:trangroup | ||
| 363 | |||
| 364 | DATE: | ||
| 365 | MOV SI,81H ; Accepting argument for date inline | ||
| 366 | mov di,offset trangroup:parse_date ;AN000; Get adderss of PARSE_DATE | ||
| 367 | xor cx,cx ;AN000; clear counter for positionals | ||
| 368 | xor dx,dx ;AN000; | ||
| 369 | invoke cmd_parse ;AC000; call parser | ||
| 370 | cmp ax,end_of_line ;AC000; are we at end of line? | ||
| 371 | JZ PRMTDAT ;AC000; yes - go ask for date | ||
| 372 | cmp ax,result_no_error ;AN000; did we have an error? | ||
| 373 | jne daterr ;AN000; yes - go issue message | ||
| 374 | JMP COMDAT ;AC000; we have a date | ||
| 375 | |||
| 376 | PRMTDAT: | ||
| 377 | ; Print "Current date is | ||
| 378 | |||
| 379 | invoke GetDate ;AN000; get date for output | ||
| 380 | xchg dh,dl ;AN000; switch month & day | ||
| 381 | mov CurDat_yr,cx ;AC000; put year into message control block | ||
| 382 | mov CurDat_mo_day,dx ;AC000; put month and day into message control block | ||
| 383 | mov dx,offset trangroup:CurDat_ptr ;AC000; set up message for output | ||
| 384 | invoke std_printf | ||
| 385 | ;AD061; mov CurDat_yr,0 ;AC000; reset year, month and day | ||
| 386 | ;AD061; mov CurDat_mo_day,0 ;AC000; pointers in control block | ||
| 387 | |||
| 388 | GET_NEW_DATE: ;AN000; | ||
| 389 | call getdat ;AC000; prompt user for date | ||
| 390 | cmp ax,end_of_line ;AC000; are we at end of line? | ||
| 391 | jz date_end ;AC000; yes - exit | ||
| 392 | cmp ax,result_no_error ;AN000; did we have an error? | ||
| 393 | jne daterr ;AN000; yes - go issue message | ||
| 394 | COMDAT: | ||
| 395 | mov cx,date_year ;AC000; get parts of date in | ||
| 396 | mov dh,date_month ;AC000; cx and dx for set | ||
| 397 | mov dl,date_day ;AC000; date function call. | ||
| 398 | push cx ;AC000; save date | ||
| 399 | push dx ;AC000; | ||
| 400 | mov cx,1 ;AC000; set 1 positional entered | ||
| 401 | xor dx,dx ;AN029; | ||
| 402 | invoke cmd_parse ;AN029; call parser | ||
| 403 | cmp al,end_of_line ;AN029; Are we at end of line? | ||
| 404 | pop dx ;AC000; retrieve date | ||
| 405 | pop cx ;AC000; | ||
| 406 | jnz daterr ;AC000; extra stuff on line - try again | ||
| 407 | MOV AH,SET_DATE ;yes - set date | ||
| 408 | INT int_command | ||
| 409 | OR AL,AL | ||
| 410 | JNZ DATERR | ||
| 411 | date_end: | ||
| 412 | ret | ||
| 413 | |||
| 414 | DATERR: | ||
| 415 | invoke crlf2 ;AN028; print out a blank line | ||
| 416 | MOV DX,OFFSET TRANGROUP:BADDAT_ptr | ||
| 417 | invoke std_printf | ||
| 418 | JMP GET_NEW_DATE ;AC000; get date again | ||
| 419 | |||
| 420 | |||
| 421 | ; TIME gets and sets the time | ||
| 422 | |||
| 423 | break Time | ||
| 424 | |||
| 425 | ; **************************************************************** | ||
| 426 | ; * | ||
| 427 | ; * ROUTINE: TIME - Set system time | ||
| 428 | ; * | ||
| 429 | ; * FUNCTION: If a time is specified, set the system time, | ||
| 430 | ; * otherwise display the current system time and | ||
| 431 | ; * prompt the user for a new time. If an invalid | ||
| 432 | ; * time is specified, issue an error message and | ||
| 433 | ; * prompt for a new time. If the user enters | ||
| 434 | ; * nothing when prompted for a time, terminate. | ||
| 435 | ; * | ||
| 436 | ; * INPUT: command line at offset 81H | ||
| 437 | ; * | ||
| 438 | ; * OUTPUT: none | ||
| 439 | ; * | ||
| 440 | ; **************************************************************** | ||
| 441 | |||
| 442 | assume ds:trangroup,es:trangroup | ||
| 443 | |||
| 444 | CTIME: | ||
| 445 | MOV SI,81H ; Accepting argument for time inline | ||
| 446 | mov di,offset trangroup:parse_time ;AN000; Get adderss of PARSE_time | ||
| 447 | xor cx,cx ;AN000; clear counter for positionals | ||
| 448 | xor dx,dx ;AN000; | ||
| 449 | invoke cmd_parse ;AC000; call parser | ||
| 450 | cmp ax,end_of_line ;AC000; are we at end of line? | ||
| 451 | JZ PRMTTIM ;AC000; yes - prompt for time | ||
| 452 | cmp ax,result_no_error ;AN000; did we have an error? | ||
| 453 | jne timerr ;AN000; yes - go issue message | ||
| 454 | JMP COMTIM ;AC000; we have a time | ||
| 455 | |||
| 456 | PRMTTIM: | ||
| 457 | ;Printf "Current time is ... " | ||
| 458 | |||
| 459 | MOV AH,GET_TIME ;AC000; get the current time | ||
| 460 | INT int_command ;AC000; Get time in CX:DX | ||
| 461 | xchg ch,cl ;AN000; switch hours & minutes | ||
| 462 | xchg dh,dl ;AN000; switch seconds & hundredths | ||
| 463 | mov CurTim_hr_min,cx ;AC000; put hours and minutes into message subst block | ||
| 464 | mov CurTim_sec_hn,dx ;AC000; put seconds and hundredths into message subst block | ||
| 465 | mov dx,offset trangroup:CurTim_ptr ;AC000; set up message for output | ||
| 466 | invoke std_printf | ||
| 467 | ;AD061; mov CurTim_hr_min,0 ;AC000; reset hour, minutes, seconds, and hundredths | ||
| 468 | ;AD061; mov CurTim_sec_hn,0 ;AC000; pointers in control block | ||
| 469 | |||
| 470 | GET_NEW_TIME: | ||
| 471 | call gettim ;AC000; | ||
| 472 | cmp ax,end_of_line ;AC000; are we at end of line? | ||
| 473 | jz time_end ;AC000; | ||
| 474 | cmp ax,result_no_error ;AN000; did we have an error? | ||
| 475 | jne timerr ;AN000; yes - go issue message | ||
| 476 | |||
| 477 | COMTIM: | ||
| 478 | mov ch,time_hour ;AC000; get parts of time in | ||
| 479 | mov cl,time_minutes ;AC000; cx and dx for set | ||
| 480 | mov dh,time_seconds ;AC000; time function call | ||
| 481 | mov dl,time_fraction ;AC000; | ||
| 482 | push cx ;AC000; save time | ||
| 483 | push dx ;AC000; | ||
| 484 | mov cx,1 ;AC000; set 1 positional parm entered | ||
| 485 | xor dx,dx ;AN029; | ||
| 486 | invoke cmd_parse ;AN029; call parser | ||
| 487 | cmp al,end_of_line ;AN029; Are we at end of line? | ||
| 488 | pop dx ;AC000; retieve time | ||
| 489 | pop cx ;AC000; | ||
| 490 | jnz timerr ;AC000; extra stuff on line - try again | ||
| 491 | |||
| 492 | SAVTIM: | ||
| 493 | MOV AH,SET_TIME | ||
| 494 | INT int_command | ||
| 495 | OR AL,AL | ||
| 496 | JNZ TIMERR ;AC000; if an error occured, try again | ||
| 497 | |||
| 498 | TIME_END: | ||
| 499 | |||
| 500 | ret | ||
| 501 | |||
| 502 | TIMERR: | ||
| 503 | invoke crlf2 ;AN028; print out a blank line | ||
| 504 | MOV DX,OFFSET TRANGROUP:BADTIM_ptr | ||
| 505 | invoke std_printf ; Print error message | ||
| 506 | JMP GET_NEW_TIME ;AC000; Try again | ||
| 507 | |||
| 508 | |||
| 509 | ; | ||
| 510 | ; Set the special flag in the INIT flag to the value in CX. | ||
| 511 | ; | ||
| 512 | SetInitFlag: | ||
| 513 | mov ds,[RESSEG] | ||
| 514 | assume ds:resgroup | ||
| 515 | and InitFlag,NOT initSpecial | ||
| 516 | or InitFlag,cL | ||
| 517 | push cs | ||
| 518 | pop ds | ||
| 519 | return | ||
| 520 | |||
| 521 | Public PipeOff | ||
| 522 | PipeOff: | ||
| 523 | ASSUME DS:NOTHING,ES:NOTHING | ||
| 524 | SaveReg <DS,AX> | ||
| 525 | MOV DS,ResSeg | ||
| 526 | ASSUME DS:RESGroup | ||
| 527 | XOR AL,AL | ||
| 528 | XCHG PipeFlag,AL | ||
| 529 | OR AL,AL | ||
| 530 | JZ PipeOffDone | ||
| 531 | SHR EchoFlag,1 | ||
| 532 | PipeOffDone: | ||
| 533 | RestoreReg <AX,DS> | ||
| 534 | return | ||
| 535 | |||
| 536 | |||
| 537 | PRINT_TIME: | ||
| 538 | |||
| 539 | MOV AH,GET_TIME | ||
| 540 | INT int_command ; Get time in CX:DX | ||
| 541 | |||
| 542 | PUSH ES | ||
| 543 | PUSH CS | ||
| 544 | POP ES | ||
| 545 | xchg ch,cl ;AN000; switch hours & minutes | ||
| 546 | xchg dh,dl ;AN000; switch seconds & hundredths | ||
| 547 | mov promTim_hr_min,cx ;AC000; put hours and minutes into message subst block | ||
| 548 | mov promTim_sec_hn,dx ;AC000; put seconds and hundredths into message subst block | ||
| 549 | mov dx,offset trangroup:promTim_ptr ;AC000; set up message for output | ||
| 550 | invoke std_printf | ||
| 551 | ;AD061; mov promTim_hr_min,0 ;AC000; reset hour, minutes, seconds, and hundredths | ||
| 552 | ;AD061; mov promTim_sec_hn,0 ;AC000; pointers in control block | ||
| 553 | |||
| 554 | POP ES | ||
| 555 | return | ||
| 556 | |||
| 557 | |||
| 558 | ; **************************************************************** | ||
| 559 | ; * | ||
| 560 | ; * ROUTINE: GETDAT - Prompt user for date | ||
| 561 | ; * | ||
| 562 | ; * FUNCTION: Gets the date format from the COUNTRY DEPENDENT | ||
| 563 | ; * INFORMATION and issues the "Enter new date" | ||
| 564 | ; * message with the proper date format. COMBUF | ||
| 565 | ; * is reset to get a date from the command line. | ||
| 566 | ; * The PARSE_DATE blocks are then reset and the | ||
| 567 | ; * PARSE function call is issued. | ||
| 568 | ; * | ||
| 569 | ; * INPUT: NONE | ||
| 570 | ; * | ||
| 571 | ; * OUTPUT: COMBUF | ||
| 572 | ; * PARSER RETURN CODES | ||
| 573 | ; * | ||
| 574 | ; **************************************************************** | ||
| 575 | |||
| 576 | |||
| 577 | GETDAT proc near ;AC000; | ||
| 578 | |||
| 579 | mov ax,(International SHL 8) ; Determine what format the date | ||
| 580 | mov dx,5ch ; should be entered in and | ||
| 581 | int int_command ; print a message describing it | ||
| 582 | mov si,dx | ||
| 583 | lodsw | ||
| 584 | mov dx,usadat_ptr ;AC000; get mm-dd-yy | ||
| 585 | dec ax | ||
| 586 | js printformat | ||
| 587 | mov dx,eurdat_ptr ;AC000; get dd-mm-yy | ||
| 588 | jz printformat | ||
| 589 | mov dx,japdat_ptr ;AC000; get yy-mm-dd | ||
| 590 | printformat: | ||
| 591 | mov ax,dx ;AN000; get message number of format | ||
| 592 | mov dh,util_msg_class ;AN000; this is a utility message | ||
| 593 | call Tsysgetmsg ;AN000; get the address of the message | ||
| 594 | mov newdat_format,si ;AN000; put the address in subst block | ||
| 595 | MOV DX,OFFSET TRANGROUP:NEWDAT_ptr ;AC000; get address of message to print | ||
| 596 | invoke std_printf | ||
| 597 | mov newdat_format,no_subst ;AN000; reset subst block | ||
| 598 | |||
| 599 | MOV AH,STD_CON_STRING_INPUT | ||
| 600 | MOV DX,OFFSET TRANGROUP:COMBUF | ||
| 601 | mov cx,initSpecial ; Set bit in InitFlag that indicates | ||
| 602 | call SetInitFlag ; prompting for date. | ||
| 603 | INT int_command ; Get input line | ||
| 604 | xor cx,cx ; Reset bit in InitFlag that indicates | ||
| 605 | call SetInitFlag ; prompting for date. | ||
| 606 | invoke CRLF2 | ||
| 607 | MOV SI,OFFSET TRANGROUP:COMBUF+2 | ||
| 608 | mov di,offset trangroup:parse_date ;AN000; Get adderss of PARSE_DATE | ||
| 609 | xor cx,cx ;AN000; clear counter for positionals | ||
| 610 | xor dx,dx ;AN000; | ||
| 611 | invoke cmd_parse ;AC000; call parser | ||
| 612 | |||
| 613 | ret | ||
| 614 | |||
| 615 | GETDAT endp ;AC000; | ||
| 616 | |||
| 617 | |||
| 618 | ; **************************************************************** | ||
| 619 | ; * | ||
| 620 | ; * ROUTINE: GETTIME - Prompt user for time | ||
| 621 | ; * | ||
| 622 | ; * FUNCTION: Gets the time format from the COUNTRY DEPENDENT | ||
| 623 | ; * INFORMATION and issues the "Enter new time" | ||
| 624 | ; * message. COMBUF is reset to get a time from the | ||
| 625 | ; * command line. The PARSE_TIME blocks are then | ||
| 626 | ; * reset and the PARSE function call is issued. | ||
| 627 | ; * | ||
| 628 | ; * INPUT: NONE | ||
| 629 | ; * | ||
| 630 | ; * OUTPUT: COMBUF | ||
| 631 | ; * PARSER RETURN CODES | ||
| 632 | ; * | ||
| 633 | ; **************************************************************** | ||
| 634 | |||
| 635 | |||
| 636 | GETTIM proc near ;AC000; | ||
| 637 | |||
| 638 | XOR CX,CX ; Initialize hours and minutes to zero | ||
| 639 | MOV DX,OFFSET TRANGROUP:NEWTIM_ptr | ||
| 640 | invoke std_printf | ||
| 641 | MOV AH,STD_CON_STRING_INPUT | ||
| 642 | MOV DX,OFFSET TRANGROUP:COMBUF | ||
| 643 | mov cx,initSpecial ; Set bit in InitFlag that indicates | ||
| 644 | call SetInitFlag ; prompting for time. | ||
| 645 | INT int_command ; Get input line | ||
| 646 | xor cx,cx ; Reset bit in InitFlag that indicates | ||
| 647 | call SetInitFlag ; prompting for time. | ||
| 648 | invoke CRLF2 | ||
| 649 | MOV SI,OFFSET TRANGROUP:COMBUF+2 | ||
| 650 | mov di,offset trangroup:parse_time ;AN000; Get adderss of PARSE_TIME | ||
| 651 | xor cx,cx ;AN000; clear counter for positionals | ||
| 652 | xor dx,dx ;AN000; | ||
| 653 | invoke cmd_parse ;AC000; call parser | ||
| 654 | |||
| 655 | ret | ||
| 656 | |||
| 657 | GETTIM endp ;AC000; | ||
| 658 | |||
| 659 | TRANCODE ENDS | ||
| 660 | END | ||