; ===========================================================================
; Data Segment - Dos variables and device driver chain
; ===========================================================================

; This is the undocumented format of the structure whose address is returned
; in ES:BX by the undocumented DOS fn 52H. This data can be used to learn
; low-level information such as how many drive IDs are recognized and the
; address of the base memBlockrec

; MS-DOS List of lists 

wbaseMemSeg  dw (NXDOSSEG+10h) ; ES:[BX-2] is seg of First memory Control Block
SYSVARS:
prBaseDPB    dd ?      ; Address of first Drive Parameter Block DPB
pHandleTbl   dd ?      ; Address of first System File Table SFT
prClockDev   dd ?      ; Address of CLOCK$ device driver header
prConDev     dd ?      ; Address of CON device driver header
wMaxSect     dw 512    ; Maximum sector size for block devices
pbCache      dd ?      ; Address of cache head buffer
parDirs      dd ?      ; Address of the CurDirRec structure array
prFcbTbl     dd ?      ; Address of first FCB file table
bDriveCnt    db 26     ; Number of drives in system
bLastDrive   db 'Z'    ; Corresponds to config.sys LASTDRIVE
DOSVars_Size EQU $ - SYSVARS ; 34
; Extra fields are for CD-ROM
CDROM_REC:
wRes         dw ?
wDrvLtr      db 'S'      ; Often 53H - CR-DOM drive letter
wUnits       db 1        ; Number of CD-ROM units
abCdrSig     db 'MSCD01' ; Signature
CDROMDEVSIZE EQU $ - CDROM_REC    ; 28

EXECPB: ; Exec Parameter Block
        wEnvSeg         dw 0h ; child processes environment 0=current
        pfCmdTail       dd ?  ; Address of shell text to place at PSP:0080
        pfrFCB_1        dd 0  ; Address for 1st FCB (stdin)
        pfrFCB_2        dd 0  ; Address for 2nd FCB (stdout)
EXECPB_SIZE EQU $ - EXECPB

InDOS        db 0
EXTERR_LOCUS db 0
NXDOSSEG     dw NXDOSBIO
memsize      dw 640 ; K
freemem      dw 610 ; K
ext_mem_size dw 64  ; K
paragraphs   dw 0   ; TOTAL PARAGRAPHS (16bytes ea.) 

FORMAT_REC:
; The following is a template, that gets overwritten with the real parameters
; and is used while formatting
Step_rate    db 11011111b       ; step rate
DMA_MODE     db 2               ; DMA mode
MOTOR_TIMER  db 37              ; 2*18.2 = 2 second motor off
BPS_         db 2               ; 512 bytes per sector
parms_spt    db 18              ; sectors per track
RW_GAP_LEN   db 2Ah             ; gap length for read/write
DATALEN_BS   db 0FFh            ; data length (128 byte/sector only)
parms_gpl    db 50h             ; data length for format
FILL_BYTE    db 0F6h            ; fill byte for format
HEAD_SETTLE  db 15              ; head settle time in ms
MOTOR_DELAY  db 8               ; motor on delay in 1/8s
FORMAT_REC_SIZE EQU $ - FORMAT_REC
;
dpmirec:
pfpDpmiSwth  dd -1
pfpdpmiFns   dd ?
rmseg        dw ?
pmsel        dw ?
dpmilargest  dw 0
dpmirec_size EQU $ - dpmirec

;
; NXDOS VARS
;
bootdrive    db 0
;
; Debugging
;
bDumpRegs    EQU 00000001b
Syscalltrace EQU 00000010b
DosRWTrace   EQU 00000100b
AbortStartup EQU 00001000b
TraceStartup EQU 00010000b
Debugflags   db 00000000b

_Files       dw 65535
breakflag    db 1                                    ; Defaults to on at boot
verifyflag   db 1      ; DOS will check the CRC of each sector that it writes
setver       dw  _setver
_serialno    dw  DSMAGIC
sleep        dw 0
runlevel     db SINGLE_USER
errorcode    dw 0
errormode    dw 0
errorlevel   db 0
event        dw 0
currentpsp   dw 0
exitmethod   db 0
CritErrCode  dw 0
CritErrClass db 0
CritErrAction db 1
CritErrLocus db 0
CritErrDev   db 0
Criticalflag db 0  ; FLAG:ID
CriticalId   db 0
;
cputype      db 0
ndptype      db 0
pcmodel      db 0
pcsubmodel   db 0
;
oscode_seg   dw 0
current_dos  dw 0
ccode        dw USA
init_drv     db 0
init_buf     dw 0
comspec_drv  db 0
init_flags   db 0
boot_options dw 0
init_runit   db 0
rpl          db 'RPLOADER'
rpl_seg      dw ?
rpl_off      dw ?
delayloop    db 0
delaywloop   dw 0
reqpktptr    dd ?
;
switchchar   db '/'
codepage     dw USA
ks_ss dw 0
ks_sp dw 0
;
LOCKOUT     EQU 0
SYSADMIN    EQU 0ffffh
accesslevel dw SYSADMIN     ; defualt to sysadmin (all)
password    db 10 dup(0)    ; CPE1704TKS

;
; Filenames
;
tempfile    db '$temp$$$.$$$',0
TESTFILE    db 'TEST.COM',0
wina20_386  db 'c:\wina20.386',0
nxdos_com   db '\nxdos.com',0
commandcom  db '\command.com',0
commandcom2 db '\nxdos\src\utils\command\command.com',0

              ;Message should be no more than 42 characters!
              ;[-----|-----|-----|-----|-----|-----|-----|
Productname db 'NXDOS8.0',0
PCi         db 'PCI',0
ISA         db 'ISA',0
init_msg    db 'Init ',0
bootprompt  db 0ffh,'boot>',0h
startup_msg db 0ffh,'System starting. . . {initializing}',0h   ; Starting... 
exit_prompt db 0ffh,'[R]estart? ',0
MakeBufmsg  db 'Enable DOS Buffers? [N/y]',0
;
KERNELHELP  db CR,LF
_CLS        db 'CLS',0,CR,LF 
_VER        db 'VER',0,CR,LF
_RESTART    db 'RESTART',0,CR,LF
_MEMWALK    db 'MEMWALK',0,CR,LF
_HELP       db '?',0,CR,LF

;
; ===========================================================================
;
; Config.sys commands
;
; ===========================================================================
;
szboot   db 'CONFIG=',0,CR,LF
szmenu   db 'MENU',0,CR,LF
szcommon db 'COMMON',0,CR,LF
config_break   db 'BREAK',0,CR,LF
config_buffers db 'BUFFERS',0,CR,LF
config_comment db 'COMMENT',0,CR,LF
config_country db 'COUNTRY',0,CR,LF
config_device  db 'DEVICE',0,CR,LF
config_devicehigh  db 'DEVICEHIGH',0,CR,LF
config_dos     db 'DOS',0,CR,LF
config_driveparam db 'DRIVEPARAM',0,CR,LF
config_fcbs    db 'FCBS',0,CR,LF
config_files   db 'FILES',0,CR,LF
config_install db 'INSTALL',0,CR,LF
config_installhigh db 'INSTALLHIGH',0,CR,LF
config_lastdrive db 'LASTDRIVE',0,CR,LF
config_multitrack db 'MULTITRACK',0,CR,LF
config_rem     db 'REM',0,CR,LF
config_shell   db 'SHELL',0,CR,LF
config_stacks  db 'STACKS',0,CR,LF
config_switches db 'SWITCHES',0,CR,LF
IFDEF (MULTICFG)
        config_begin   db '[',0,CR,LF
        config_include db 'INCLUDE',0,CR,LF
        config_submenu db 'SUBMENU',0,CR,LF
        config_menucolor db 'MENUCOLOR',0,CR,LF
        config_menudefault db 'MENUDEFAULT',0,CR,LF
        config_menuitem db 'MENUITEM',0,CR,LF
        config_numlock  db 'NUMLOCK',0,CR,LF
        config_set      db 'SET',0,CR,LF
ENDIF
db 24h

; [CRITAL_ERROR]
ErrMsg0000  db '',0ffh,0
ErrMsg0001  db '[#E001] General Failure.',0ffh,0
ErrMsg0002  db '[#W002] Divide by zero.',0ffh,0
ErrMsg0003  db '[#E003] Disk Media Failure.',0ffh,0
ErrMsg0004  db '[#E004] Reserved for future mistakes.',0ffh,0
ErrMsg0005  db '[#E005] SYSTEM HALTED.',7,0ffh,0
ErrMsg0006  db '[#E006] A20 Hardware Error.',0ffh,0
ErrMsg0007  db '[#E007] MCB chain corrupted.',0ffh,0
ErrMsg0008  db '[#W008] Out of memory.',0ffh,0
ErrMsg0009  db '[#W009] Access denied.',0ffh,0
ErrMsg0010  db 'Non-System disk or disk error',0ffh
            db 'Replace and press any key when ready',0ffh,0
ErrMsg0011  db 'Bad or missing command.',0ffh,0
ErrMsg0012  db '[#E012] Stack overflow.',0ffh,0
; A Data Potato is a block of data that is unusable.
ErrMsg0013  db '[#W013] Data potato doo-wop doo-wop',0ffh,0
ErrMsg0014  db 'Harddrive access not allowed. [reboot]',0ffh,0
ErrMsg0015  db '[#W015] System.',0ffh,0
ErrMsg0016  db 'It is safe to now switch off your computer.',0ffh,0   ; shutdownmsg 
ErrMsg0017  db 'Type "?" for a clue :-)',0ffh,0   ; HELP        

Errmsgs dw ErrMsg0000, ErrMsg0001, ErrMsg0002, ErrMsg0003, ErrMsg0004
        dw ErrMsg0005, ErrMsg0006, ErrMsg0007, ErrMsg0008, ErrMsg0009
        dw ErrMsg0010, ErrMsg0011, ErrMsg0012, ErrMsg0013, ErrMsg0014
        dw ErrMsg0015, ErrMsg0016, ErrMsg0017

include \nxdos\src\copy.txt
