📄 rxdosprm.asm
字号:
TITLE 'Prm - RxDOS Command Shell Prompt, Date, and Time'
PAGE 59, 132
.LALL
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; RxDOS Command Shell Prompt, Date, and Time ;
;...............................................................;
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Real Time Dos ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; This material was created as a published version of a DOS ;
; equivalent product. This program logically functions in ;
; the same way as MSDOS functions and it is internal data ;
; structure compliant with MSDOS 6.0 ;
; ;
; This product is distributed AS IS and contains no warranty ;
; whatsoever, including warranty of merchantability or ;
; fitness for a particular purpose. ;
; ;
; ;
; (c) Copyright 1990, 1997. Api Software and Mike Podanoffsky ;
; All Rights Reserved Worldwide. ;
; ;
; This product is protected under copyright laws and may not ;
; be reproduced in whole or in part, in any form or media, ;
; included but not limited to source listing, facsimile, data ;
; transmission, cd-rom, or floppy disk without the expressed ;
; written consent of the author. ;
; ;
; License for distribution for commercial use or resale ;
; required from: ;
; ;
; Api Software ;
; 12 South Walker Street ;
; Lowell, MA 01851 ;
; ;
; internet: mikep@world.std.com ;
; ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; Compile with MASM 5.1 ;
;...............................................................;
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; RxDOS Command Shell ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Programmer's Notes: ;
; ;
; Command Shell consists of two parts bound together into a ;
; single executable load. There exists a single resident ;
; command shell which is accessible by an Int 2Eh. ;
; ;
;...............................................................;
include rxdosmac.asm
include rxdosdef.asm
include rxdoscin.asm
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; RxDOS Command Shell ;
;...............................................................;
RxDOSCMD SEGMENT PUBLIC 'CODE'
assume cs:RxDOSCMD, ds:RxDOSCMD, es:RxDOSCMD, ss:RxDOSCMD
public DisplayPrompt
public formatCurrentDate
public formatCurrentTime
public _Prompt
public _Date
public _Time
extrn CheckOptOneArg : near
extrn _sprintf : near
extrn DisplayLine : near
extrn _GetNumber : near
extrn _getStdinLine : near
extrn RxDOS_DefaultPrompt : near
extrn RxDOS_Prompt : near
extrn _CopyString : near
extrn RxDOS_PromptSpec : near
extrn searchEnvVariable : near
extrn deleteEnvVariable : near
extrn insertEnvVariable : near
extrn _PleaseEnterDate : near
extrn _ShowCurrentDate : near
extrn _ShowCurrentTime : near
extrn _PleaseEnterTime : near
extrn CmndError_InvalidDate : near
extrn CmndError_InvalidTime : near
extrn CmndError_OutOfEnvironmentSpace : near
extrn DisplayErrorMessage : near
extrn DisplayOutEnvSpace : near
extrn _lowerCase : near
extrn CRLF : near
extrn RxDOS_Version : near
extrn RxDOSIntl_DateTemplate : near
extrn RxDOSIntl_DayOfWeek : near
extrn RxDOSIntl_TimeTemplate : near
extrn RxDOSIntl_DateTimeTable : near
extrn _EnvSegment : word
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Display Prompt ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Usage: ;
; $q = ;
; $$ $ ;
; $t time ;
; $d date ;
; $p drive:path ;
; $v current rxdos version ;
; $n drive ;
; $g > ;
; $l < ;
; $b | (pipe) ;
; $_ cr lf ;
; $e esc ;
; $h backspace ;
;...............................................................;
DisplayPrompt:
Entry
defbytes _buffer, 128
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; locate init (env) prompt string
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
push di
mov si, offset RxDOS_PromptSpec
call searchEnvVariable ; locate prompt= spec
jnz DisplayPrompt_06 ; if none -->
push ds
add di, dx ; point to env string
mov si, offset RxDOS_Prompt
mov ds, word ptr [ _EnvSegment ] ; seg of env strings
xchg di, si
call _CopyString
pop ds
DisplayPrompt_06:
mov si, offset RxDOS_Prompt
lea di, offset [ _buffer ][ bp ]
mov byte ptr [ di ], 00
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; scan prompt
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_08:
lodsb
DisplayPrompt_10:
stosb
or al, al
ifz DisplayPrompt_48
cmp al, '$'
jnz DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; special case
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dec di
lodsb
or al, al
ifz DisplayPrompt_48
call _lowerCase
Translate 'q', '=', DisplayPrompt_18
Translate '$', '$', DisplayPrompt_18
Translate 'g', '>', DisplayPrompt_18
Translate 'l', '<', DisplayPrompt_18
Translate 'b', '|', DisplayPrompt_18
Translate 'e', '['-40h, DisplayPrompt_18
cmp al, 't'
ifz DisplayPrompt_Time ; $t time -->
cmp al, 'd'
ifz DisplayPrompt_Date ; $d date -->
cmp al, 'p'
ifz DisplayPrompt_Path ; $p path -->
cmp al, 'v'
ifz DisplayPrompt_Version ; $v version -->
cmp al, 'n'
ifz DisplayPrompt_Drive ; $d drive -->
cmp al, '_'
jz DisplayPrompt_CRLF ; $_ crlf -->
cmp al, 'h'
jz DisplayPrompt_Backspace ; $b backspace -->
jmp DisplayPrompt_10
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; translate
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_18:
mov al, ah
stosb ; translated value
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; backspace
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Backspace:
dec di
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; cr lf
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_CRLF:
mov ax, 0a0dh
stosw
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; time of day
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Time:
call formatCurrentTime
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; date
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Date:
call formatCurrentDate
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; path
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Path:
push si
Int21 CurrentDisk
mov dl, al ; save drive letter
add al, 'A' ; get drive
stosb
mov ax, '\:'
stosw ; d:\ ...
inc dl
mov si, di
mov byte ptr [ si ], 0
Int21 GetCurrentDirectory ; get current directory
DisplayPrompt_Path_08:
lodsb
or al, al
jnz DisplayPrompt_Path_08
dec si
mov di, si
pop si
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; version
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Version:
push si
mov si, offset RxDOS_Version
call _CopyString
dec di
pop si
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; drive letter
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_Drive:
Int21 CurrentDisk
add al, 'A' ; get drive
stosb
jmp DisplayPrompt_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; display prompt
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DisplayPrompt_48:
lea dx, offset [ _buffer ][ bp ]
call Displayline
pop di
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Convert AL To 2 Char Decimal ;
;...............................................................;
ConvTo2CharDecimal:
push cx
xor ah, ah
mov cl, 10
div cl
or ax, '00'
stosw
pop cx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -