; COMMAND Copyright 2004-2005 Christopher Evans
; Website: http://nxdos.sourceforge.net/
;
; COMMAND.ASM - COMMAND interpreter for NXDOS
;                                                                           ;
;       This program is copyrighted, but may be freely distributed          ;
;       under the terms of the Free Software Foundation's GNU General       ;
;       Public License v2 (or later.)  See the file COPYING for the         ;
;       legalities.  If you did not receive a copy of COPYING, you          ;
;       may request one from the Free Software Foundation, Inc.,            ;
;       59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           ;
;       ABSOLUTELY NO WARRANTY -- use it at your own risk!                  ;
;                                                                           ;
;
; Like Lou Hatton Said, You come back 6 months later, and you dont know what 
; the fuck you did to it.
;
; AUG-31-2009 - Command.com should be command programmable from external 
; command.cfg file, that way user can customize the shell.

code            segment byte public
                assume  cs:code, ds:code
		org	100h
command         proc    far

start:          jmp     initialize
include         \nxdos\src\kernel\nxdos.equ
include         \nxdos\src\toolbox.asm
include         \nxdos\src\crclib.asm
initialize:
     mov  ax, offset start
     mov  bx, ProgramEnd 
     call cs:self_check
     call cs:put_hex         ; locking up here 3-23-2006
     _newline
     mov  bx, ProgramEnd
     call resize
     jc   short exitptr
     call cs:main
exitptr:
     call dosexit
command         endp

perminate     db 0
ExecBlock     EQU $
programext    db 127 dup(0)
wEnvSeg       dw 0 ; 0=current environment
pfCmdTail     dd ? ; address of command line text to place at PSP:0080
pfrFCB_1      dd ? ; Address of an FCB to be placed at PSP:005c
pfrFCB_2      dd ? ; Address of an FCB to be placed at PSP:006c
ExecBlockSize EQU $ - ExecBlock

; ===========================================================================
main proc far
; ===========================================================================
;
; PseudoCode
; if /? showhelp, exit else 
; if /P set perminate flag else 
; if /O set override_startup_doscheckver_check else
; check for doscheckver if not 8.0 and not rev 6 goto cmdbad
; cmdbad: if override goto cmdwarn and run process else disp wrong checkver, exit
; process: getinput, process input, run appropiate command
; exit: if perminate, goto process else exit
;
              mov  bh, '/'
              mov  bl, '?'
              call scancmdline
              mov  _argc, cx
              cmp  al, 1
              jne  _chkperminate
              _print help, 1
              jmp  exitptr
_chkperminate:
              mov  bh, '/'
              mov  bl, 'P'
              call scancmdline
              cmp  al, 1
              jne  _chkoverride
              mov  perminate, al
_chkoverride:
              mov  bh, '/'
              mov  bl, 'O'
              call scancmdline
              or   al, al
              jnz  commandline
              call cs:checkver
              cmp  al, 3
              jae  _chknx
              _print badcheckver, 1
              jmp  mainx
_chknx:       cmp  dx, _version
              je   commandline
              _print warning, 1
commandline:
       call cs:cmd
mainx: ret
main endp

; ===========================================================================
checkver  proc far
; ===========================================================================
_machinecheck:
        kbhit   ; force 
        ; call detect_os
        _newline
        osname
	_newline
        _print cmdver, 1
	;
        mov  ah, 30h
        int  21h
        push ax
        _swap
        call wrdec
        _newline
        mov  ax, 3307h
        int  21h
        pop  ax
        ret
checkver  endp

; ===========================================================================
dateproc   proc far
; ===========================================================================

           _print curdate, 1
           mov  ah, 2ah
           int  21h      ; nx-dos takes from RTC
           xor  ah, ah
           push dx
           mov  bx, 4
           mul  bx
           pop  dx
          ; inc  ax
           mov  si, ax  
           _output  days[si], 4, 1

           _echo ' '
           mov  ax, cx
           call putnum
           _echo '-'
           xor  ax, ax
           mov  al, dh
           call putnum
           _echo '-'
           xor  ax, ax
           mov  al, dl
           call putnum
           _newline
           _print dateprompt, 1
           lea  di, dateinput
           mov  cx, 11
           call getdata

processnewdate:
           lea  si, dateinput
           lea  di, datestr
           mov  dl, 0
           mov  bx, 4
           call strcopy
           lea  si, datestr
           mov  cx, 4
           call atoi
           mov  year, ax

           lea  di, datestr
           mov  cx, 5
           call fillarray
           lea  si, dateinput+5
           lea  di, datestr
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, datestr
           mov  cx, 2
           call atoi
           mov  month, al

           lea  di, datestr
           mov  cx, 5
           call fillarray
           lea  si, dateinput+8
           lea  di, datestr
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, datestr
           mov  cx, 2
           call atoi
           mov  day, al

           mov  cx, year
           mov  dh, month
           mov  dl, day
           mov  ah, 2bh         ; set date in dos
           int  21h             
           cmp  al, 0ffh
           jne  datechanged
           _newline
           _print invaliddate_msg, 1
datechanged:
           ; if DATE prompt for new date
           ; if DATE yyyy-mm-dd set from cmdbuffer
           ; if DATE /? _print _DATEHELP, 1

           ret
days       db 'Sun',0,'Mon',0,'Tue',0,'Wed',0,'Thr',0,'Fri',0,'Sat',0
invaliddate_msg db 'Invalid date, system date unchanged.',0ffh,0
curdate    db 'The current date is: ',0
dateprompt db 'Enter the new date: (yyyy-mm-dd) ',0
dateinput  db 11 dup(0)
datestr    db 5 dup(0)
year       dw ?
month      db ?
day        db ?
dateproc   endp

; ===========================================================================
timeproc   proc far
; ===========================================================================
           _print curtime, 1
           mov  ah, 2ch
           int  21h      ; nx-dos takes from RTC

           xor  ax, ax
           mov  al, ch
           call putnum
           _echo ':'
           xor  ax, ax
           mov  al, cl
           call putnum
           _echo ':'
           xor  ax, ax
           mov  al, dh
           call putnum
           _echo '.'
           xor  ax, ax
           mov  al, dl
           call putnum
           _newline

           _print timeprompt, 1
           lea  di, timestr  
           mov  cx, 11
           call getdata

processtime:
           lea  si, timestr
           lea  di, timetemp
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, timetemp
           mov  cx, 2
           call atoi
           mov  hour, al

           lea  di, timetemp
           mov  cx, 5
           call fillarray
           lea  si, timestr+3
           lea  di, timetemp
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, timetemp
           mov  cx, 2
           call atoi
           mov  minute, al

           lea  di, timetemp
           mov  cx, 5
           call fillarray
           lea  si, timestr+6
           lea  di, timetemp
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, timetemp
           mov  cx, 2
           call atoi
           mov  seconds, al

           lea  si, timestr+8
           mov  al, byte ptr [si]
           cmp  al, '.'
           jne  nosec100
           lea  di, timetemp
           mov  cx, 5
           call fillarray
           lea  si, timestr+9
           lea  di, timetemp
           mov  dl, 0
           mov  bx, 2
           call strcopy
           lea  si, timetemp
           mov  cx, 2
           call atoi
           mov  sec100, al
nosec100:
           mov  ch, hour
           mov  cl, minute
           mov  dh, seconds
           mov  dl, sec100
           mov  ah, 2dh         ; set date in dos
           int  21h             
           cmp  al, 0ffh
           jne  timechanged
           _newline
           _print invalidtime_msg, 1
timechanged:
           ret
invalidtime_msg db 'Invalid time, system time unchanged.',0ffh,0
curtime    db 'The current time is: ',0
timeprompt db 'Enter the new time: (hh:mm:ss.hs) ',0
timestr    db 11 dup(0)
timetemp   db 5 dup(0)
hour       db 0
minute     db 0
seconds    db 0
sec100     db 0
timeproc   endp

directory proc near
         ;  copy parameter 2 or 3 ... to ff_name spec
         ; change into drive/directory

          mov  ah, 1ah
          lea  dx, FileInfoRec
          int  21h

          mov  ah, 4eh    ; findfirst
          xor  al, al
          mov  cx, 11111101b
          lea  dx, ff_filespec
          int  21h

findnext:
          ; display file name 
          _print ff_name, 1
          _newline
          cmp  ff_attr, 00001000b
          jne  notadir
          inc  dirs
          jmp  short itsafile
notadir:  inc  files
itsafile:
          ; findnext
          mov  ah, 4fh
          lea  dx, FileInfoRec
          int  21h
          jnc  findnext

          _spaces 15
          mov  ax, files
          call putnum
          _echo ' '
          _print _filesmsg, 1
          _spaces 15
          mov  ax, dirs
          call putnum
          _echo ' '
          _print _dirsmsg, 1

          ret
FileInfoRec:
ff_fill   db 21 dup(0)
ff_attr   db ?
ff_time   dd ?
ff_size   dd ?
ff_name   db 13 dup(0),0
ff_filespec db '*.*',0
files     dw 0
dirs      dw 0
_filesmsg db 'Files',0ffh,0
_Dirsmsg  db 'Dir(s)',0ffh,0
directory  endp

; ===========================================================================
intl proc far
; ===========================================================================
           pushregs

           _print _intlp, 1
           call readnum
           cmp  ax, 0
           je   _intl
           call getvector
           mov  ax, es
           call put_hex
           _echo ':'
           mov ax, bx
           call put_hex
           jmp  _intlx
_intl:
           mov al, 1
           mov i, al
           mov cx, 0ffh
           mov dx, 0
intloop:
           mov ax, cx
           push cx
           push dx
           call getvector
           mov  ax, es
           call put_hex
           _echo ':'
           mov ax, bx
           call put_hex

           _spaces 1
           pop dx
           push dx
           cmp dx, 5
           jne i_nnl
           _newline
           mov al, i
           inc al
           mov i, al
           cmp al, 22
           jne i_nw
           call pauseprompt
           _newline
           mov al, 1
           mov i, al
i_nw:
i_nnl:     pop dx
           inc dx
           pop cx
           dec cx
           jnz intloop
_intlx:    popregs
           ret
_intlp db 'Interrupt: ',0
intl endp

echoproc proc far
           lea  di, arg_buffer
           mov  cx, _extralen$
           call fillarray
           mov  cx, 1
           lea  si, cmd_buffer
           lea  di, arg_buffer
           mov  bx, cx
           call parameter

           lea  si, arg_buffer
           lea  di, _echooff
           mov  cx, 4
           mov  dl, 0dh
           mov  dh, ' '
           call compare
           or   bx, bx
           jnz  echochkforon
           mov  al, 0
           mov  echostate, al
           jmp  echop
echochkforon:
           lea  si, arg_buffer
           lea  di, _echoon
           mov  cx, 3
           mov  dl, 0dh
           mov  dh, ' '
           call compare
           or   bx, bx
           jnz  echoit
           mov  al, 1
           mov  echostate, al
           jmp  echop
echoit:   _print cmd_buffer+5, 1
          _newline
echop:    ret
           _echooff db 'OFF',0
           _echoon  db 'ON',0
           echostate db 1
echoproc endp

chdirproc proc far
           mov  cx, _parameters
           cmp  cx, 1
           ja   _chdirparam
           mov  ah, 47h
           mov  dl, 0
           lea  si, arg_buffer
           int  21h
           jc   chdirerror
           mov  ah, 19h
           int  21h
           mov  bl, 65
           add  al, bl
           call teletype
           _echo ':'
           _echo '\'
           _print arg_buffer, 1
           jmp  nochdirerror
_chdirparam:
           lea  di, arg_buffer
           mov  cx, _extralen$
           call fillarray
           mov  cx, 1
           lea  si, cmd_buffer
           lea  di, arg_buffer
           mov  bx, cx
           call parameter

           lea  dx, arg_buffer
           mov  ah, 3bh
           int  21h
           jnc  nochdirerror
chdirerror:
           _print chdirerrmsg, 1
nochdirerror:
         ret
         chdirerrmsg db 'Cannot find the path specified.',0ffh,0
chdirproc endp

mkdirproc proc far
           mov  cx, _parameters
           cmp  cx, 1
           ja   _mkdirparam
           _print mkdirsyntaxerr, 1
           jmp  nomkdirerror
_mkdirparam:
           lea  di, arg_buffer
           mov  cx, _extralen$
           call fillarray
           mov  cx, 1
           lea  si, cmd_buffer
           lea  di, arg_buffer
           mov  bx, cx
           call parameter

           lea  dx, arg_buffer
           mov  ah, 39h
           int  21h
           jnc  nomkdirerror
mkdirerror:
           _print mkdirerrmsg, 1
nomkdirerror:
         ret
         mkdirerrmsg    db 'Cannot make specified path.',0ffh,0
         mkdirsyntaxerr db 'Syntax incorrect.',0ffh,0
mkdirproc endp

rmdirproc proc far
           mov  cx, _parameters
           cmp  cx, 1
           ja   _rmdirparam
           _print rmdirsyntaxerr, 1
           jmp  normdirerror
_rmdirparam:
           lea  di, arg_buffer
           mov  cx, _extralen$
           call fillarray
           mov  cx, 1
           lea  si, cmd_buffer
           lea  di, arg_buffer
           mov  bx, cx
           call parameter

           lea  dx, arg_buffer
           mov  ah, 3ah
           int  21h
           jnc  normdirerror
rmdirerror:
           _print rmdirerrmsg, 1
normdirerror:
         ret
         rmdirerrmsg    db 'Cannot remove specified path.',0ffh,0
         rmdirsyntaxerr db 'Syntax incorrect.',0ffh,0
rmdirproc endp

; ===========================================================================
process proc far
; ===========================================================================
           lea  si, cmd_buffer
           mov  bl, 20h
           mov  cx, 0ffh
           call upstr
           clc
_chkchdir:
           lea  si, _CD    
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           xor  bx, bx
           call compare
           or   bx, bx
           jz   _chdircmd  
           lea  si, _CHDIR
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           xor  bx, bx
           call compare
           or   bx, bx
           jnz  _chkcls     
_chdircmd:
           call chdirproc
           jmp  _processed
_chkcls:   lea  si, _CLS
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkcpureg

           mov  ax, 07h
           call textcolor
           call clrscr
           jmp  _processed
_chkcpureg:
           lea  si, _CPUREG 
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkdate
           call debugregisters
           _newline
_chkdate:
           lea  si, _DATE 
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkdir 
           call dateproc
           jmp _processed
_chkdir:
           lea  si, _DIR  
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chktime
           call directory
           jmp _processed
_chktime:
           lea  si, _TIME 
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkecho
           call timeproc
           jmp _processed
_chkecho:
           lea  si, _ECHO_
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkexit
           call echoproc
           jmp  _processed
_chkexit:
           lea  si, _EXIT
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkintr               
           mov  al, 1
           mov  exitapp, al
           jmp  _processed
_chkintr:
           lea  si, _INTR    
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkmkdir
           call intl
           jmp  _processed
_chkmkdir:
           lea  si, _MD    
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jz   _mkdircmd  
           lea  si, _MKDIR
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkrestart 
_mkdircmd:
           call mkdirproc
           jmp  _processed
_chkrestart:
           lea  si, _RESTART    
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkromb
           call bootstrap
           jmp  _processed
_chkromb:
           lea  si, _ROMBASIC
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkrmdir    
           call rombasic
           jmp  _processed
_chkrmdir:
           lea  si, _RD    
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jz   _rmdircmd  
           lea  si, _RMDIR
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkver     
_rmdircmd:
           call rmdirproc
           jmp  _processed
_chkver:
           lea  si, _VER
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _chkhelp
           call checkver
           jmp  _processed
_chkHELP:
           lea  si, _HELP
           lea  di, cmd_buffer
           mov  cx, 255
           mov  dh, ' '
           mov  dl, 0ah
           call compare
           or   bx, bx
           jnz  _nextcommand      
           _output _BREAK, _HELPSIZE, 1
           jmp  _processed
_nextcommand:

_run:
           lea  si, cmd_buffer
           lea  di, programext
           mov  dl, 20h
           mov  bx, 127
           call strcopy
           mov  ax, ds
           mov  word ptr pfCmdtail+2, ax
           mov  word ptr pfCmdtail, si
           push es
           push cs
           pop  ax
           mov  es, ax
           mov  ax, 4b00h
           lea  dx, Programext
           lea  bx, wEnvSeg
           int  21h
           pop  es
           jnc  _processed
           pushf
           pop  dx
           cmp  ax, 2
           je   _bcf
           push dx
           popf
           jmp  _processed
_bcf:
           _newline
           _echo '"'
           _print cmd_buffer, 1
           _echo '"'
           _echo ' '
           _print badcommand, 1
_processed:
           call getdos_errorlevel
           mov  errorlevel, al
           mov  errortype, ah
           or   ah, ah
           jz   no_doserror
           call doserror
no_doserror:
        ret
process endp


myprompt proc far
           mov  ax, 1900h
           int  21h
           add  al, 65
           mov  curdrive, al

           call getxy
           cmp  dl, 1
           jbe  _no_newline
           _newline
_no_newline:
           xor  ax, ax
           mov  al, curdrive
           call teletype
           _echo ':'

           mov  ax, 4700h
           mov  dl, 0
           lea  si, pathname
           int  21h
           jnc  _show_p_noerror
           _echo 'W'
           _echo '#'
           call put_hex
_show_p_noerror:
           _echo '\'
           _print pathname, 1
           _echo '>'
exitshowp:
       ret
myprompt endp

prompt proc far
       call myprompt
       ret
prompt endp

; ===========================================================================
showprompt proc far
; ===========================================================================

           mov  al, echostate
           or   al, al
           jnz  showprompt1
           ret
showprompt1:
           ; process Prompt= string
           call prompt
           ret
curdrive   db ?
pathname   db 64 dup(0),0
showprompt endp

; ===========================================================================
getcommand proc far
; ===========================================================================
           lea  di, cmd_buffer
           mov  cx, cmd_size
           mov  bl, 0
           call fillarray
           ;
           lea  di, cmd_buffer
           mov  cx, cmd_size
           call getdata
           mov  _cmd_len, cx

           lea  si, cmd_buffer
           call parameters
           mov  _parameters, cx
           mov  ax, ax
           mov  cx, _cmd_len
           ret
_parameters dw 0
_cmd_len    dw 0
getcommand endp

cmd proc far
cmdline:
    call showprompt
    call showcursor
    call getcommand    ; get command line from user <enter>
    _newline
    or   cx, cx
    jz   cmdline
    ; lea  si, cmd_buffer
    ; dec  si
    ; int  2eh
    call process         ; process commandline and dispatch calls
    mov  al, exitapp
    or   al, al
    jz   cmdline
    mov  al, perminate
    or   al, al
    jnz  cmdline
    ret
cmd endp

; ---------------------------------------------------------------------------
errortype  db 0
errorlevel db 0
exitapp    db 0
_argc      dw 0
; ---------------------------------------------------------------------------
cmd_size    EQU 127
arg_size    EQU 127
cmdlen      db 0
cmd_buffer  db cmd_size DUP(0),1
arg_buffer  db arg_size DUP(0),2

; ===========================================================================
; Data Strings
; ===========================================================================

cmdver      db 'COMMAND (c) 2007-2009 '
            db 'Version ',0
badcheckver db 'Incorrect version.',0ffh,0
badcommand  db 'The user made an error.',0 
            ; Unrecognized command or file not found
help        db 'Starts the ',_OS_NAME,' command interpreter.',0ffh,0ffh
warning     db 'Warning: This program is not running under ',_OS_NAME,0ffh,0

_HELP       db 'HELP ',0
_BREAK      db 'BREAK ',0
            db '[ON | OFF]',CR,LF,'Sets of clears extended CTRL+C checking',CR,LF
            db 'Type BREAK without a parameter to display the current BREAK setting.',CR,LF
_CHCP       db 'CHCP ',0
            db '[nnn]',CR,LF,'Displays or sets the active code page.',CR,LF
            db 'nnn Specifies a code page.',CR,LF
            db 'Type CHCP without parameter to display the active code page.',CR,LF
_CD         db 'CD ',0
_CHDIR      db 'CHDIR ',0
            db 'Displays the name of or changes the current directory.',CR,LF,CR,LF
            db 'CHDIR [Drive:][path]',CR,LF
            db 'CHDIR [..]           Specifies that you want to change to the ',CR,LF,CR,LF
            db 'Also can be shortened to "CD". ',CR,LF
_CLS        db 'CLS ',0
            db 'Clears the screen.',CR,LF
_COPY       db 'COPY ',0
            db 'Copies one of more files to another location.',CR,LF,CR,LF
            db 'COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] [/V]',CR,LF,CR,LF
            db 'source      Specifies the file(s) to be copied.',CR,LF
            db 'destination Specifies the directory and/or file for the new file(s).',CR,LF
            db '/V          Verify the new files were written correctly.',CR,LF
            db '/A | /B     Specify ASCII or binary file',CR,LF
_CTTY       db 'CTTY ',0
            db 'Changes the terminal device used to control your system.',CR,LF,CR,LF
            db 'CTTY device',CR,LF,CR,LF
            db 'device      The terminal device you want to use, such as COM1.',CR,LF
_DATE       db 'DATE ',0
            db '[mm/dd/yyyy] or without parameters to display system date w/ prompt for new date.',CR,LF
_DEL        db 'DEL ',0
            db '[Drive:][Path][Filename] [/P]',CR,LF
            db '/P  prompts for confirmation.',CR,LF,CR,LF
            db 'Alternative command is "ERASE".',CR,LF
_DIR        db 'DIR ',0
            db '[Drive:][Path][Filename] [/W] [/P] [/A:a] [/O:o] [/S] [/B] [/L]',CR,LF
_EXIT       db 'EXIT ',0
            db 'Exits COMMAND.COM.',CR,LF
_MD         db 'MD ',0
_MKDIR      db 'MKDIR ',0
            db '[Drive:]path  Creates a directory.',CR,LF
_PATH       db 'PATH ',0
            db '[[Drive:]path[;...]] Displays or sets search path for executable files.',CR,LF
_PROMPT     db 'PROMPT ',0
            db '[text] Specifies a new command prompt.',CR,LF
            db 'Prompt can be made up of regular characters and the following meta-codes:',CR,LF
            db '       $Q = (Equal sign)',CR,LF
            db '       $$ $ (Dollar sign)',CR,LF
            db '       $T Current time',CR,LF
            db '       $D Current date',CR,LF
            db '       $P Current drive and path',CR,LF
            db '       $V NX-DOS checkver number',CR,LF
            db '       $N Current drive',CR,LF
            db '       $G > (greater-than sign)',CR,LF
            db '       $L < (less-than sign)',CR,LF
            db '       $B | (pipe)',CR,LF
            db '       $H Backspace (erases previous character)',CR,LF
            db '       $_ Carriage return and linefeed',CR,LF
            db 'Type PROMPT without parameters to reset the prompt to default setting.',CR,LF
_RD         db 'RD ',0
_RMDIR      db 'RMDIR ',0
            db '[Drive:]path Removes (deletes) a directory.',CR,LF
            db '"RD" also used as shortcut.',CR,LF
_RENNAME    db 'RENAME ',0
_REN        db 'REN ',0
            db '[Drive:][path]filename1 filename2 Renames files.',CR,LF
_SET        db 'SET ',0
            db '[varible=[string]] Sets or deletes a environment variable.',CR,LF
            db 'Type SET without parameters to display environment.',CR,LF
_TIME       db 'TIME ',0
            db '[hh:mm:ss.s1] Sets system time, or displays w/ prompt.',CR,LF
_TYPE       db 'TYPE ',0
            db '[Drive1:][Path]filename Display contents of filename.',CR,LF
_VER        db 'VER ',0
            db '[/R]',CR,LF,'Displays version.',CR,LF
_VERIFY     db 'VERIFY ',0
            db '[ON | OFF]',CR,LF,'Toggle system verify on or off.',CR,LF
_VOL        db 'VOL ',0
            db '[Drive:]',CR,LF,'Displays volume label and serial number.',CR,LF
_CALL       db 'CALL ',0
            db '[batch file] [parameters]',CR,LF,'Calls one batch file from another.',CR,LF
_REM        db 'REM ',0
            db 'Used to mark a line as a remark, and not execute it.',CR,LF
_PAUSE      db 'PAUSE ',0
            db 'Pauses the system, until user presses a key.',CR,LF
_ECHO_      db 'ECHO ',0
            db '[ON | OFF] [message] Displays message.',CR,LF
_GOTO       db 'GOTO ',0
            db 'label ',CR,LF,'Specifies new location to run in a batch file.',CR,LF
            db 'label is defined on a line by itself beginning with a colon.',CR,LF
_SHIFT      db 'SHIFT ',0
_SHIFTHELP  db 'Changes position of replaceable parameters in batch file',CR,LF
_ROMBASIC   db 'ROMBASIC ',0
            db 'Calls ROMBASIC.',CR,LF
_RESTART    db 'RESTART ',0
            db 'Restarts the machine.',CR,LF
_INTR       db 'INTR ',0
            db '[int] Display system interrupts.',CR,LF
_CPUREG     db 'CPUREG ',0
            db 'Show the CPU registers.',CR,LF
_HOSTNAME   db 'HOSTNAME ',0
            db '[...] Sets the hostname.',CR,LF
_HELPSIZE   EQU $ - _BREAK

; IF [NOT] ERRORLEVEL number command
; IF [NOT] string==string command
; IF [NOT] EXIST filename command
; FOR %variable IN (set 1 2 3) DO command
; LOADHIGH [Drive:][path/filename.exe] [parameters]
; LH
; Loads a program into the upper memory area.

code            ends

ProgramEnd      EQU $-01h

		end	start
