; ****************************************************************************
; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.0) - INITIALIZED DATA : trdosk9.s
; ----------------------------------------------------------------------------
; Last Update: 10/06/2016
; ----------------------------------------------------------------------------
; Beginning: 04/01/2016
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Assembler: NASM version 2.11 (trdos386.s)
; ----------------------------------------------------------------------------
; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan
; TRDOS2.ASM (09/11/2011)
; ****************************************************************************
; DRV_INIT.ASM [26/09/2009] Last Update: 07/08/2011
; MAINPROG.ASM [17/01/2004] Last Update: 09/11/2011
; CMD_INTR.ASM [29/01/2005] Last Update: 09/11/2011
; FILE.ASM [29/10/2009] Last Update: 09/10/2011

; 12/02/2016
Last_DOS_DiskNo: 
		db 1 ; A: = 0 & B: = 1

Restore_CDIR:	
		db 0FFh ; Initial value -> any number except 0

msg_CRLF_temp:  
		db  07h, 0Dh, 0Ah, 0

Magic_Bytes:
		db 4
		db 1
mainprog_Version:
		db 7
		db "[TRDOS] Main Program v2.0.100616"
		db 0Dh, 0Ah
		db "(c) Erdogan Tan 2005-2016"
		db 0Dh, 0Ah, 0

MainProgCfgFile: ; 14/04/2016
		db "MAINPROG.CFG", 0

TRDOSPromptLabel:
		db "TRDOS"
		db 0
                times 5 db 0
		db 0

; INTERNAL COMMANDS
Command_List:
Cmd_Dir:	db "DIR", 0
Cmd_Cd:		db "CD", 0
Cmd_Drive:	db "C:", 0
Cmd_Ver:	db "VER", 0
Cmd_Exit:	db "EXIT", 0
Cmd_Prompt:	db "PROMPT", 0
Cmd_Volume:	db "VOLUME", 0
Cmd_LongName:	db "LONGNAME", 0
Cmd_Date:	db "DATE", 0
Cmd_Time:	db "TIME", 0
Cmd_Run:	db "RUN", 0
Cmd_Set:	db "SET", 0 
Cmd_Cls:	db "CLS", 0
Cmd_Show:	db "SHOW", 0
Cmd_Del:	db "DEL", 0
Cmd_Attrib:	db "ATTRIB", 0
Cmd_Rename:	db "RENAME", 0
Cmd_Rmdir:	db "RMDIR", 0
Cmd_Mkdir:	db "MKDIR", 0
Cmd_Copy:	db "COPY", 0
Cmd_Move:	db "MOVE", 0
Cmd_Path:	db "PATH", 0
Cmd_Mem:	db "MEM", 0
		db 0
Cmd_Find:	db "FIND", 0
Cmd_ReadFile:	db "READFILE", 0
Cmd_Echo:	db "ECHO", 0
Cmd_Remark:	db "*", 0
Cmd_Help:	db "?", 0
Cmd_Device:	db "DEVICE", 0
Cmd_DevList:	db "DEVLIST", 0
Cmd_Chdir:	db "CHDIR", 0
Cmd_Beep:	db "BEEP", 0
		
		db 0

; 15/02/2016 (FILE.ASM, 09/10/2011)
invalid_fname_chars:
		db 22h, 27h, 28h, 29h, 2Ah, 2Bh, 2Ch, 2Fh
		db 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh, 40h
		db 5Bh, 5Ch, 5Dh, 5Eh, 60h
sizeInvFnChars  equ ($ - invalid_fname_chars)                
;

Msg_Enter_Date:
                db 'Enter new date (dd-mm-yy): '
                db 0
Msg_Show_Date:
                db   'Current date is '
Day:            db   '0'
		db   '0'
                db   '/'
Month:          db   '0'
		db   '0'
                db   '/'
Century:        db   '0'
                db   '0'
Year:           db   '0'
		db   '0'
                db   0Dh, 0Ah, 0

Msg_Enter_Time:
		db 'Enter new time: '
		db 0
Msg_Show_Time:
		db   'Current time is '
Hour:           db   '0'
		db   '0'
		db   ':'
Minute:         db   '0'
		db   '0'
		db   ':'
Second:         db   '0'
		db   '0'
		db   0Dh, 0Ah, 0

;VolSize_Unit1:   dd 0
;VolSize_Unit2:   dd 0

VolSize_KiloBytes:
		db " kilobytes", 0Dh, 0Ah, 0
VolSize_Bytes:
		db " bytes", 0Dh, 0Ah, 0
Volume_in_drive:
		db 0Dh, 0Ah
Vol_FS_Name:
		db "TR FS1 "
		db "Volume in drive "
Vol_Drv_Name:   db 30h
		db ":"
		db " is "
		db 0Dh, 0Ah, 0
Dir_Drive_Str:
                db "TR-DOS Drive "
Dir_Drive_Name:
                db "0:"
                db  0Dh, 0Ah
Vol_Str_Header:
                db "Volume Name: "
Vol_Name:
		times 64 db 0
		db 0
Vol_Serial_Header:
		db 0Dh, 0Ah
		db "Volume Serial No: "
Vol_Serial1:
		db "0000"
		db "-"
Vol_Serial2:
		db "0000"
		db 0Dh, 0Ah, 0

;Vol_Tot_Sec_Str_Start:
;		dd 0
Vol_Total_Sector_Header:
		db 0Dh, 0Ah
		db "Volume Size : ", 0
;Vol_Tot_Sec_Str: 
;		db "0000000000"
;Vol_Tot_Sec_Str_End:
;		db 0
;Vol_Free_Sectors_Str_Start:
;		dd 0
Vol_Free_Sectors_Header:
		db "Free Space  : ", 0
;Vol_Free_Sectors_Str:
;		db "0000000000"
;Vol_Free_Sectors_Str_End:
;		db 0

Dir_Str_Header:
                db "Directory: "
Dir_Str_Root:   db "/"
Dir_Str:        times 64 db 0
                dd 0
                db 0

Msg_Bad_Command:
                db "Bad command or file name!"
                db 0Dh, 0Ah, 0

msgl_drv_not_ready: 
		db 07h, 0Dh, 0Ah

; CMD_INTR.ASM - 09/11/2011 - Messages

Msg_Not_Ready_Read_Err:
                db "Drive not ready or read error!"
                db 0Dh, 0Ah, 0

Msg_Not_Ready_Write_Err:
                db "Drive not ready or write error!"
                db 0Dh, 0Ah, 0

Msg_Dir_Not_Found:
                db "Directory not found!"
                db 0Dh, 0Ah, 0

Msg_File_Not_Found:
                db "File not found!"
                db 0Dh, 0Ah, 0

Msg_File_Directory_Not_Found:
                db "File or directory not found!"
                db 0Dh, 0Ah, 0

Msg_LongName_Not_Found:
                db "Long name not found!"
                db 0Dh, 0Ah, 0

Msg_Insufficient_Memory:
                db "Insufficient memory!"
                db 0Dh, 0Ah, 0

Msg_Error_Code:
                db 'Command failed! Error code : '
error_code_hex: db '00h'
                db 0Ah, 0Ah, 0

align 2

; 10/02/2016
; DIR.ASM - 09/10/2011

Type_Dir:       db '<DIR>     ' ; 10 bytes

File_Name:
                times 12 db 20h
		db 20h
Dir_Or_FileSize:
                times 10 db 20h
		db 20h
File_Attribute:
		dd 20202020h
		db 20h
File_Day:
                db '0','0'
		db '/'
File_Month:
                db '0','0'
		db '/'
File_Year:
                db '0','0','0','0'
		db 20h
File_Hour:
                db '0','0'
		db ':'
File_Minute:
                db '0','0'
		db 0

Decimal_File_Count_Header:
		db 0Dh, 0Ah
Decimal_File_Count:
		times 6 db 0

str_files:	db " file(s) & "
Decimal_Dir_Count: 
		times 6 db 0
str_dirs:       
		db " directory(s) "
		db 0Dh, 0Ah, 0

str_bytes:	db " byte(s) in file(s)"
		db 0Dh, 0Ah, 0

; CMD_INTR.ASM - 09/11/2011
; 07/10/2010
Msg_invalid_name_chars:
                db "Invalid file or directory name characters!"
        	db 0Dh, 0Ah, 0
; 21/02/2016
Msg_Name_Exists: db "File or directory name exists!"
                db 0Dh, 0Ah, 0
Msg_DoYouWantMkdir:
                db "Do you want to make directory ", 0
Msg_YesNo:      db " (Y/N) ? ", 0  
Y_N_nextline:	db 0, 0Dh, 0Ah, 0 
Msg_OK:		db "OK.", 0Dh, 0Ah, 0

; 27/02/2016
Msg_DoYouWantRmDir:
                db "Do you want to delete directory ", 0
Msg_Dir_Not_Empty:
                db "Directory not empty!"
                db 0Dh, 0Ah, 0

Msg_DoYouWantDelete:
                db "Do you want to delete file ",0

Msg_Deleted:    db "Deleted...", 0Dh, 0Ah, 0

Msg_Permission_Denied:
                db 7
                db "Permission denied!", 0Dh, 0Ah, 0

; 04/03/2016
Msg_New:        db "New "
                db 0
Str_Attributes:
                db "Attributes : "
Attr_Chars:     db "NORMAL"
                db 0

; 06/03/2016
; CMD_INTR.ASM - 16/11/2010 
Msg_DoYouWantRename:
                db "Do you want to rename ", 0
Rename_File:    db "file ", 0
Rename_Directory: db "directory ", 0
Rename_OldName: times 13 db 0
Msg_File_rename_as: db " as "
Rename_NewName: times 13 db 0

; 08/03/2016
; CMD_INTR.ASM - 01/08/2010 - 23/04/2011
msg_not_same_drv:
                db "Not same drive!" 
                db 0Dh, 0Ah, 0 

Msg_DoYouWantMoveFile:
                db "Do you want to move file", 0

msg_insufficient_disk_space:
                db "Insufficient disk space!" 
                db 0Dh, 0Ah, 0

; 01/08/2010
msg_source_file: 
		db 0Dh, 0Ah, "Source file name      :   "
msg_source_file_drv: 
		db " :", 0
msg_destination_file: 
		db 0Dh, 0Ah, "Destination file name :   "
msg_destination_file_drv: 
		db " :", 0
msg_copy_nextline: 
		db 0Dh, 0Ah, 0

; 15/03/2016
; CMD_INTR.ASM

Msg_DoYouWantOverWriteFile:
                db "Do you want to overwrite file ",0
  
Msg_DoYouWantCopyFile:
                db "Do you want to copy file",0

Msg_read_file_error_before_EOF:
		db "File reading error! (before EOF)"
		db 0Ah, 0Ah, 0

; 18/03/2016
; TRDOS 386 (v2.0) mainprog copy procedure
msg_reading:
		db "Reading... ", 0
msg_writing:
		db "Writing... ", 0
percentagestr:
		db "   %", 0  ; "  0%" .. "100%"
; 11/04/2016
Msg_No_Set_Space:
                db "Insufficient environment space!"
                db 0Dh, 0Ah, 0
; 18/04/2016
isc_msg:	
		db 0Dh, 0Ah
		db "INVALID SYSTEM CALL", 0
usi_msg:
		db 0Dh, 0Ah
		db "UNDEFINED SOFTWARE INTERRUPT", 0
ifc_msg:
		db 0Dh, 0Ah
		db "INVALID FUNCTION CALL"
inv_msg_for_trdos_v2:
		db 20h
		db "for TRDOS v2!"
		db 07h
		db 0Dh, 0Ah
		db 0Dh, 0Ah
		db "INT "
int_num_str:	db "00h"
		db 0Dh, 0Ah
		db "EAX : "
eax_str:	db "00000000h", 0Dh, 0Ah
		db "EIP : "
eip_str:	db "00000000h", 0Dh, 0Ah, 0
		