; *****************************************************************************
; DRVINFO4.ASM  [ SINGLIX DRV INIT Sample & DRIVE INFO Utility ]
; Copyright (c) 2009  Erdogan TAN  [ 15/03/2009 ]
; DRVINFO3.ASM  [ SINGLIX DRV INIT Sample & DRIVE INFO Utility ]
; Copyright (c) 2004  Erdogan TAN  [ 08/03/2009 ]  
; DRVINFO2.ASM  [ TR-DOS DRV INIT Sample & DRIVE INFO Utility ]
; Copyright (c) 2004  Erdogan TAN  [ 29/01/2005 ] 
;
; *****************************************************************************

; Masterboot / Partition Table at Beginning+1BEh
ptBootable       equ 0
ptBeginHead      equ 1
ptBeginSector    equ 2
ptBeginCylinder  equ 3
ptFileSystemName equ 4
ptEndHead        equ 5
ptEndSector      equ 6
ptEndCylinder    equ 7
ptStartSector    equ 8
ptSectors        equ 12


; BIOS Disk Parameters
DPDiskNumber  equ 0h
DPDType       equ 1h
DPReturn      equ 2h
DPHeads       equ 3h
DPCylinders   equ 4h
DPSecPerTrack equ 6h
DPDisks       equ 7h
DPTableOff    equ 8h
DPTableSeg    equ 0Ah
DPNumOfSecs   equ 0Ch

; BIOS INT 13h Extensions (LBA extensions)
; Just After DP Data (DPDiskNumber+)
DAP_PacketSize equ 10h  ; If extensions present, this byte will be >=10h
DAP_Reserved1 equ 11h   ; Reserved Byte 
DAP_NumOfBlocks equ 12h ; Value of this byte must be 0 to 127
DAP_Reserved2 equ 13h   ; Reserved Byte
DAP_Destination equ 14h ; Address of Transfer Buffer as SEGMENT:OFFSET
DAP_LBA_Address equ 18h ; LBA=(C1*H0+H1)*S0+S1-1
                        ; C1= Selected Cylinder Number
                        ; H0= Number Of Heads (Maximum Head Number + 1)
                        ; H1= Selected Head Number
                        ; S0= Maximum Sector Number
                        ; S1= Selected Sector Number
                        ; QUAD WORD
; DAP_Flat_Destination equ 20h ; 64 bit address, if value in 4h is FFFF:FFFFh
                             ; QUAD WORD (Also, value in 0h must be 18h) 
                             ; TR-DOS will not use 64 bit Flat Address

; INT 13h Function 48h "Get Enhanced Disk Drive Parameters"
; Just After DP Data (DPDiskNumber+)
GetDParams_48h equ 20h ; Word. Data Lenght, must be 26 (1Ah) for short data.
GDP_48h_InfoFlag equ 22h ; Word
; Bit 1 = 1 -> The geometry returned in bytes 4-15 is valid.
GDP_48h_NumOfPCyls equ 24h ; Double Word. Number physical cylinders.
GDP_48h_NumOfPHeads equ 28h ; Double Word. Number of physical heads.
GDP_48h_NumOfPSpT equ 2Ch ; Double word. Num of physical sectors per track.
GDP_48h_LBA_Sectors equ 30h ; 8 bytes. Number of physical/LBA sectors.
GDP_48h_BytesPerSec equ 38h ; Word. Number of bytes in a sector.

; SINGLIX Logical Disks
LD_DrvNumber equ 0
LD_DiskType equ 1
LD_PhyDrvNo equ 2
LD_LBAYes equ 3
LD_PartitionEntry equ 4
LD_MediaChanged equ 5
LD_BPB equ 6
LD_bsBytesPerSec   equ 6
LD_bsMediaAttrib   equ 8 
LD_bsFileSystemID  equ 9
LD_bsFSVersionMaj  equ 10
LD_bsFSVersionMin  equ 11
LD_bsStartSector   equ 12 
LD_bsVolumeSize    equ 16   
LD_bsStartupFD     equ 20
LD_bsMATLocation   equ 24
LD_bsRootDirD      equ 28
LD_bsSystemConfFD  equ 32
LD_bsSwapFD        equ 36
LD_bsUndeleteDirD  equ 40
LD_DATAddress      equ 44
LD_DATSectors      equ 48
LD_FreeSectors     equ 52
LD_rdtVolumeSerial equ 60
LD_rdtVolumeName   equ 64
LD_CDDT equ 128
LD_CDDT_DirNumber  equ 136
LD_CDDT_ParentDir  equ 148
LD_CDDT_ParentDirSerial equ 152
LD_CDDT_DirSerial equ 156
LD_CDDT_SubDirlevel equ 161

; 128 bytes
LD_CurrentDirectory equ 256
;256 bytes
; Logical disk parameters table total 512 bytes 


; Valid FS Types
FS_Version1 equ 1

; Cursor Location
CCCpointer equ  0450h   ; BIOS data, current cursor column


Present segment Para 'code'

                assume CS:Present, DS:Present, ES:Present, SS:Present


;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
;±
;±              PROCEDURE proc_start
;±
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±

proc_start      proc    far

                org 100h
start:
                call proc_drv_init  ; DRV_INIT2.ASM

                xor dl, dl
                call floppy_drv_init
                mov al, byte ptr [Current_Singlix_Drv]
                adc al, 0
                push ax
                mov dl, 1
                call floppy_drv_init
                pop ax
                adc al, 0
                mov byte ptr [Current_Singlix_Drv], al

loc_print_partition_table:
                mov si, offset P_Table_Header
                call proc_printmsg
                
                mov si, offset PTable_hd0
                mov word ptr [PTable_Drv],"dh"
                mov byte ptr [PTable_Drv]+2,"0"
                mov byte ptr [P_Number],"1"
                mov cx, 4
check_entry_next_0:
                push cx
                mov cx, 4
check_p_entry_next_1:
                cmp byte ptr [SI][ptFileSystemName],0
                jna short pass_call_print_p_entry
                call proc_print_p_entry
pass_call_print_p_entry:
                add si, 10h
                inc byte ptr [P_Number]
                loop check_p_entry_next_1
                pop cx
                inc byte ptr [PTable_Drv]+2
                mov byte ptr [P_Number], "1"
                loop check_entry_next_0
 
end_of_print_partition_table:
                mov si, offset DiskParams
                mov byte ptr [DPT_No], "0"
                jmp short loc_check_disktype

repeat_for_next_dparam:
                cmp si, offset end_of_dparams_buff
                jnb short cls_int16h_print_singlix_drive_infos
loc_check_disktype:
                cmp byte ptr [si][DPDType],0
                je short pass_current_dparam

                push si

                mov si, offset Press_Any_Key
                call proc_printmsg

                pop si

                xor ah, ah              ; "Press any key to continue"
                int 16h

                cmp al, 1Bh
                je short end_of_prog_drvinfo

                call proc_clear_screen

                cmp byte ptr [si][DPReturn], 0
                ja short pass_current_dparam

                call proc_fill_diskinfo_fields

                push si
                mov si, offset [Disk_Info]
                call proc_printmsg
                pop si

pass_current_dparam:
                add si, 40h
                jmp short repeat_for_next_dparam

cls_int16h_print_singlix_drive_infos:
                mov si, offset Press_Any_Key
                call proc_printmsg

                xor ah, ah              ; "Press any key to continue"
                int 16h

                cmp al, 1Bh
                je short end_of_prog_drvinfo

                call proc_clear_screen

loc_print_singlix_drive_infos:
                mov si, offset Logical_FS_Disks
loc_check_singlix_drv_exists:
                cmp byte ptr [SI][LD_bsFileSystemID], 0A1h
                jne short pass_current_singlix_drv

                push si

                call proc_print_drv_info

                mov si, offset Press_Any_Key
                call proc_printmsg

                pop si
                
                xor ah, ah              ; "Press any key to continue"
                int 16h                

                cmp al, 1Bh
                je short end_of_prog_drvinfo

                call proc_clear_screen

                inc byte ptr [Current_Singlix_Drv]

pass_current_singlix_drv:
                mov al, byte ptr [Last_Logical_DiskNo]
                cmp al, byte ptr [Current_Singlix_Drv]
                jb short end_of_prog_drvinfo
                add si, 100h
                jmp short loc_check_singlix_drv_exists

end_of_prog_drvinfo:
                mov si, offset Program_Name
                call proc_printmsg

                mov ax, word ptr [File_Size]
                mov si, offset FileSize_StrPlus5
                mov cx, 10                  
loc_wfsize_rdivide:
                dec si
                xor dx, dx
                div cx
                add dl, '0'
                mov byte ptr [si], dl
                cmp ax,0
                ja short loc_wfsize_rdivide

                call proc_printmsg

                int 20h

                xor ah, ah              ; "Press any key to continue"
                int 16h                

                int 19h 
     
proc_start      endp

proc_printmsg   proc near

                mov BX, 07
loc_print:
                lodsb                           ; Load byte at DS:SI to AL
                and     AL,AL            
                je      short loc_return        ; If AL = 00h then return
                mov     AH,0Eh                  
                int     10h                     ; BIOS Service func ( ah ) = 0Eh
                                                ; Write char as TTY
                                                ;AL-char BH-page BL-color
                jmp     short loc_print           
loc_return:
                retn

proc_printmsg   endp


proc_clear_screen proc near

                mov ah, 0Fh 
                int 10h
                mov ah, 0
                int 10h

                retn

proc_clear_screen endp

;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Rx_DOS  32 bit Divide                                      ;
; (Special version by Erdogan Tan)                           ;
;- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - -;
;                                                            ;
; input -> DX_AX = 32 bit dividend                           ;
; input -> CX = 16 bit divisor                               ;
; output -> DX_AX = 32 bit quotient                          ;
; output -> BX = 16 bit remainder                            ;
;                                                            ;
;  This procedure divides the requested 32 bit number        ;
;  and gives the result in DX, AX and BX (remainder)         ;
;                                                            ;
; Original Procedure by Michael Podanoffsky / Real Time DOS  ;
; (c) Erdogan TAN  1999                     [ RXDOSBIO.ASM ] ;
;............................................................;

Rx_Dos_Div32    proc near
                mov  bx, dx
                xchg ax, bx
                xor  dx, dx
                div  cx         ; at first, divide DX
                xchg ax, bx     ; remainder is in DX
                                ; now, BX has quotient
                                ; save remainder
                div  cx         ; so, DX_AX divided and
                                ; AX has quotient
                                ; DX has remainder
                xchg dx, bx     ; finally, BX has remainder

div32_retn:
                retn

Rx_Dos_Div32    endp

;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; From binary (byte) to hexadecimal (character) converter    ;
;                                                            ;
; input -> AL = byte (binary number) to be converted         ;
; output -> AH = First character of hexadecimal number       ;
; output -> AL = Second character of hexadecimal number      ;
;                                                            ;
; (c) Erdogan TAN  1998 - 1999                               ;
;............................................................;

; 1998

proc_hex        proc    near

                db 0D4h,10h                     ; Undocumented inst. AAM
                                                ; AH = AL / 10h
                                                ; AL = AL MOD 10h
                or AX,'00'                      ; Make it ZERO (ASCII) based

                xchg AH,AL 

; 1999
                cmp AL,'9'
                jna pass_cc_al
                add AL,7
pass_cc_al:
                cmp AH,'9'
                jna pass_cc_ah
                add AH,7
pass_cc_ah:

; 1998
                retn

proc_hex        endp

;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; 32 bit Multiply                                            ;
;- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - -;
;                                                            ;
; input -> DX_AX = 32 bit multiplier                         ;
; input -> BX = 16 bit number to be multiplied by DX_AX      ;
; output -> BX_DX_AX = 48 bit (16+32 bit) result number      ;
;                                                            ;
; (c) Erdogan TAN  1999                                      ;
;............................................................;

proc_mul32    proc near

              push cx

              mov cx, bx
              mov bx, dx

              mul cx

              xchg ax, bx

              push dx

              mul cx 

              pop cx 

              add ax, cx 
              adc dx, 0

              xchg bx, ax
              xchg dx, bx

              pop cx

              retn

proc_mul32    endp

INCLUDE DRVINIT2.ASM  ; SINGLIX Drive Initialization Procedures

proc_print_p_entry proc near
                   ; Input -> DS:SI = Partition Entry Buffer
                   push si
                   push cx
                   mov al, byte ptr [SI][ptBootable]
                   call proc_hex
                   mov word ptr [P_Status], ax
                   mov al, byte ptr [SI][ptBeginHead]
                   call proc_hex
                   mov word ptr [Begin_Head], ax
                   mov al, byte ptr [SI][ptBeginSector]
                   call proc_hex
                   mov word ptr [Begin_Sec], ax
                   mov al, byte ptr [SI][ptBeginCylinder]
                   call proc_hex
                   mov word ptr [Begin_Cyl], ax
                   mov al, byte ptr [SI][ptFileSystemName]
                   call proc_hex
                   mov word ptr [FS_ID], ax
                   mov al, byte ptr [SI][ptEndHead]
                   call proc_hex
                   mov word ptr [End_Head], ax
                   mov al, byte ptr [SI][ptEndSector]
                   call proc_hex
                   mov word ptr [End_Sec], ax
                   mov al, byte ptr [SI][ptEndCylinder]
                   call proc_hex
                   mov word ptr [End_Cyl], ax
                   
                   mov ax, word ptr [SI][ptStartSector]
                   mov dx, word ptr [SI][ptStartSector]+2

                   mov bp, 9
                   mov cx, 10
loc_rediv_startsec:
                   call Rx_Dos_Div32
                   add bl,'0'
                   mov byte ptr [P_Start_Sec][bp],bl
                   cmp bp,0
                   jna short loc_conv_psectors
                   dec bp
                   and ax, ax
                   jnz short loc_rediv_startsec
                   and dx, dx
                   jnz short loc_rediv_startsec
loc_conv_psectors:
                   mov ax, word ptr [SI][ptSectors]
                   mov dx, word ptr [SI][ptSectors]+2

                   mov bp, 9
                 ; mov cx, 10
loc_rediv_psectors:
                   call Rx_Dos_Div32
                   add bl,'0'
                   mov byte ptr [P_Sectors][bp],bl
                   cmp bp,0
                   jna short loc_filesys_str
                   dec bp
                   and ax, ax
                   jnz short loc_rediv_psectors
                   and dx, dx
                   jnz short loc_rediv_psectors
loc_filesys_str:
                   mov  bl, byte ptr [SI][ptFileSystemName]
                   cmp  bl, 7
                   ja   short loc_non_dos_fs
                   mov  al, 0Bh
                   mul  bl
                   mov  si, offset FileSys_Names
                   add  si, ax
loc_move_fsname:
                   mov  di, offset P_FileSystem
                   push cx
                   mov  cx,11
                   rep  movsb
                   pop  cx
print_p_entry_row:
                   mov si, offset PTable_Drv
                   call proc_printmsg
                   pop cx
                   pop si
                   retn
loc_non_dos_fs:
                   mov si, offset FS_WIN_32
                   cmp bl, 0Bh
                   je short loc_move_fsname
                   cmp bl, 0Ch
                   je short loc_move_fsname
                   mov si, offset FS_WIN_P
                   cmp bl, 0Eh
                   je short loc_move_fsname
                   mov si, offset FS_WIN_EXT
                   cmp bl, 0Fh
                   je short loc_move_fsname
                   mov si, offset FS_SCO
                   cmp bl, 63h
                   je short loc_move_fsname
                   mov si, offset FS_Linux
                   cmp bl, 83h
                   je short loc_move_fsname
                   mov si, offset FS_LinuxSwap
                   cmp bl, 82h
                   je short loc_move_fsname
                   mov si, offset FS_LinuxExt
                   cmp bl, 85h
                   je short loc_move_fsname
                   mov si, offset FS_TR_MULTIX
                   cmp bl, 0A1h
                   je short loc_move_fsname
                   mov si, offset FS_ATAPITR
                   cmp bl, 0A2h
                   je short loc_move_fsname
                   mov si, offset RS_TRDD
                   cmp bl, 0A0h
                   je short loc_move_fsname
                   mov si, offset FS_Others
                   jmp short loc_move_fsname

proc_print_p_entry endp

proc_fill_diskinfo_fields proc near

                inc byte ptr [DPT_No]
                mov al, byte ptr [si]        ; Disk Drive Number
                call proc_hex
                mov word ptr [DI_DDN], ax

                mov al, byte ptr [si][DPDType]
                call proc_hex
                mov word ptr [DI_T], ax

                mov al, byte ptr [si][DPDisks]
                call proc_hex
                mov word ptr [DI_TD], ax

                mov al, byte ptr [si][DPSecPerTrack]
                call proc_hex
                mov word ptr [DI_SPT], ax

                mov al, byte ptr [si][DPHeads]
                call proc_hex
                mov word ptr [DI_H], ax

                mov al, byte ptr [si][DPCylinders]+1
                call proc_hex
                mov word ptr [DI_C], ax
                mov al, byte ptr [si][DPCylinders]
                call proc_hex
                mov word ptr [DI_C]+2, ax

                mov al, byte ptr [si][DPTableOff]+1
                call proc_hex
                mov word ptr [DI_DPTO], ax
                mov al, byte ptr [si][DPTableOff]
                call proc_hex
                mov word ptr [DI_DPTO]+2, ax

                mov al, byte ptr [si][DPTableSeg]+1
                call proc_hex
                mov word ptr [DI_DPTS], ax
                mov al, byte ptr [si][DPTableSeg]
                call proc_hex
                mov word ptr [DI_DPTS]+2, ax

                mov al, byte ptr [si][DPNumOfSecs]+3
                call proc_hex
                mov word ptr [DI_TS_2], ax
                mov al, byte ptr [si][DPNumOfSecs]+2
                call proc_hex
                mov word ptr [DI_TS_2]+2, ax

                mov al, byte ptr [si][DPNumOfSecs]+1
                call proc_hex
                mov word ptr [DI_TS_1], ax
                mov al, byte ptr [si][DPNumOfSecs]
                call proc_hex
                mov word ptr [DI_TS_1]+2, ax

                cmp byte ptr [SI][DAP_PacketSize], 10h
                je short loc_LBA_Ready_YES
                mov word ptr [DI_LBA_Ready], "ON"
                mov word ptr [DI_LBA_Ready]+2, 2020h

loc_return_without_LBA_totals:
                mov byte ptr [Msg_LBA_Totals], 0 ; Don't print
                retn

loc_LBA_Ready_YES:
                mov word ptr [DI_LBA_Ready], "EY"
                mov word ptr [DI_LBA_Ready]+2, " S"

                cmp word ptr [si][GetDParams_48h], 0
                ja short loc_return_without_LBA_totals

                mov byte ptr [Msg_LBA_Totals], 0Dh  ; Print

                mov al, byte ptr [si][GDP_48h_LBA_Sectors]+3
                call proc_hex
                mov word ptr [DI_LBA_TS_1], ax
                mov al, byte ptr [si][GDP_48h_LBA_Sectors]+2
                call proc_hex
                mov word ptr [DI_LBA_TS_1]+2, ax

                mov al, byte ptr [si][GDP_48h_LBA_Sectors]+1
                call proc_hex
                mov word ptr [DI_LBA_TS_2], ax
                mov al, byte ptr [si][GDP_48h_LBA_Sectors]
                call proc_hex
                mov word ptr [DI_LBA_TS_2]+2, ax

                mov al, byte ptr [si][GDP_48h_BytesPerSec]+1
                call proc_hex
                mov word ptr [DI_BytesPersec], ax
                mov al, byte ptr [si][GDP_48h_BytesPerSec]
                call proc_hex
                mov word ptr [DI_BytesPerSec]+2, ax

                retn

proc_fill_diskinfo_fields endp

proc_print_drv_info proc near
                ; input -> DS:SI = Logical Disk Parameters table

                mov al, byte ptr [SI][LD_DrvNumber]
                add al, '0'
                mov byte ptr [str_info_drv_name],al

                mov al, byte ptr [SI][LD_PhyDrvNo]
                call proc_hex
                mov word ptr [str_Phy_Drv_Num], ax

                mov al, byte ptr [SI][LD_bsBytesPerSec]
                call proc_hex
                mov word ptr [val_bytespersec]+2, ax
                mov al, byte ptr [SI][LD_bsBytesPerSec]+1
                call proc_hex
                mov word ptr [val_bytespersec], ax

                mov al, byte ptr [SI][LD_bsMediaAttrib]
                call proc_hex
                mov word ptr [str_media_attrib], ax

                mov al, byte ptr [SI][LD_bsFileSystemID]
                call proc_hex
                mov word ptr [str_fsystem_id], ax

                mov al, byte ptr [SI][LD_bsFSVersionMaj]
                add al, '0'
                mov byte ptr [str_fs_ver_major], al
                mov al, byte ptr [SI][LD_bsFSVersionMin]
                add al, '0'
                mov byte ptr [str_fs_ver_minor], al

                mov al, byte ptr [SI][LD_bsStartSector]
                call proc_hex
                mov word ptr [val_startsector]+6, ax
                mov al, byte ptr [SI][LD_bsStartSector]+1
                call proc_hex
                mov word ptr [val_startsector]+4, ax
                mov al, byte ptr [SI][LD_bsStartSector]+2
                call proc_hex
                mov word ptr [val_startsector]+2, ax
                mov al, byte ptr [SI][LD_bsStartSector]+3
                call proc_hex
                mov word ptr [val_startsector], ax

                mov al, byte ptr [SI][LD_bsVolumeSize]
                call proc_hex
                mov word ptr [val_volumesize]+6, ax
                mov al, byte ptr [SI][LD_bsVolumeSize]+1
                call proc_hex
                mov word ptr [val_volumesize]+4, ax
                mov al, byte ptr [SI][LD_bsVolumeSize]+2
                call proc_hex
                mov word ptr [val_volumesize]+2, ax
                mov al, byte ptr [SI][LD_bsVolumeSize]+3
                call proc_hex
                mov word ptr [val_volumesize], ax

                mov al, byte ptr [SI][LD_bsStartupFD]
                call proc_hex
                mov word ptr [val_startupfiled]+6, ax
                mov al, byte ptr [SI][LD_bsStartupFD]+1
                call proc_hex
                mov word ptr [val_startupfiled]+4, ax
                mov al, byte ptr [SI][LD_bsStartupFD]+2
                call proc_hex
                mov word ptr [val_startupfiled]+2, ax
                mov al, byte ptr [SI][LD_bsStartupFD]+3
                call proc_hex
                mov word ptr [val_startupfiled], ax


                mov al, byte ptr [SI][LD_bsMATLocation]
                call proc_hex
                mov word ptr [val_matlocation]+6, ax
                mov al, byte ptr [SI][LD_bsMATLocation]+1
                call proc_hex
                mov word ptr [val_matlocation]+4, ax
                mov al, byte ptr [SI][LD_bsMATLocation]+2
                call proc_hex
                mov word ptr [val_matlocation]+2, ax
                mov al, byte ptr [SI][LD_bsMATLocation]+3
                call proc_hex
                mov word ptr [val_matlocation], ax

                mov al, byte ptr [SI][LD_bsRootDirD]
                call proc_hex
                mov word ptr [val_rootdird]+6, ax
                mov al, byte ptr [SI][LD_bsRootDirD]+1
                call proc_hex
                mov word ptr [val_rootdird]+4, ax
                mov al, byte ptr [SI][LD_bsRootDirD]+2
                call proc_hex
                mov word ptr [val_rootdird]+2, ax
                mov al, byte ptr [SI][LD_bsRootDirD]+3
                call proc_hex
                mov word ptr [val_rootdird], ax

                mov si, offset msg_drive_info
                call proc_printmsg
                retn

proc_print_drv_info endp

               db 4
               db 1

P_Table_Header:
               db 7
               db 0Dh, 0Ah
               db "[SINGLIX] PRESENT FIXED DISK PARTITIONS  (c) Erdogan TAN 2005-2009"
               db  0Dh, 0Ah, 0Dh, 0Ah
               db "DRV PN  S  BH  BS  BC  FS  EH  ES  EC  START SEC  SECTORS  FILE SYSTEM"
               db 0Dh, 0Ah
               db "--- -- --- --- --- --- --- --- --- --- --------- --------- -----------"
               db 0Dh, 0Ah, 0h
PTable_Drv:
               db  "hd"
               db  0,20h
               db  "p"
P_Number:      db  0,20h
P_Status:      dw  0
               db  "h "
Begin_Head:    dw  0
               db  "h "
Begin_Sec:     dw  0
               db "h "
Begin_Cyl:     dw  0
               db "h "
FS_ID:         dw  0
               db "h "
End_Head:      dw  0
               db "h "
End_Sec:       dw  0
               db "h "
End_Cyl:       dw  0
               db "h"
P_Start_Sec:   db 10 dup(20h)
P_Sectors:     db 11 dup(20h)
P_FileSystem:  db 11 dup(20h)
               db 0Dh, 0Ah, 0h

FileSys_Names: ; 2003 (Valid FileSystems for TR-DOS Project in 2005)
               db "           "
               db "TrDos FS1  "  ; 01h (16 bit, 512 bytes per sec)
                                 ; Reserved for future TRDOS versions
               db "TrDos FS2  "  ; 02h (32 bit, 512 bytes per sec)
                                 ; Reserved for future TRDOS versions
               db "TrDos FS3  "  ; 03h (32 bit, 2048 bytes per sec)
                                 ; Reserved for future TRDOS versions
               db "DOS FAT16  "  ; 04h = FAT16 < 32MB
                                 ; TRDOS doesn't use this FS for hard disks
               db "DOS EXT    "  ; 05h = Extended DOS Partition
                                 ; TRDOS uses DOS extended partitions
               db "DOS FAT16  "  ; 06h = FAT16 > 32MB, CHS Mode
                                 ; TRDOS uses FAT16 Big CHS mode FS
FS_NTFS:       db "WINDOWS NT "  ; 07h , WINDOWS 2000/XP NTFS Partition
                                 ; TRDOS doesn't use NTFS
FS_WIN_32:     db "WIN4 FAT32 "  ; OBh = FAT32 CHS, 0Ch = FAT32 LBA
                                 ; TRDOS uses FAT32 CHS and LBA modes
FS_WIN_P:      db "WIN4 FAT16 "  ; 0Eh = FAT16, LBA Mode
                                 ; TRDOS uses FAT16 LBA mode FS
FS_WIN_EXT:    db "WIN4 EXT   "  ; 0Fh = Extented Partition, LBA Mode
                                 ; TRDOS uses WINDOWS extended partitions
FS_SCO:        db "SCO Unix   "  ; 63h , SCO UNIX, UNIXWARE, OPENSERVER
                                 ; TRDOS doesn't use any UNIX file systems 
FS_Linux:      db "Linux      "  ; 83h , LINUX NATIVE (ext2) Partition
FS_LinuxSwap:  db "Linux Swap "  ; 82h , LINUX SWAP Partition
FS_LinuxExt:   db "Linux Ext  "  ; 85h , LINUX EXTENDED Partition
                                 ; TRDOS doesn't use any LINUX file systems 
FS_TR_MULTIX:  db "Singlix FS1"  ; A1h , (32 bit, 512 bytes per sector)
                                 ; TR-MULTIX LBA disk FS (ATA device LBA FS)
FS_ATAPITR:    db "Singlix FS2"  ; A2h , (32 bit, 2048 bytes per sector)
                                 ; TR-MULTIX ATAPI device LBA FS
RS_TRDD:       db "RDD        "  ; A0h , (Random Data Disk) LBA
                                 ; Reserved (New Record System)
                                 ; 14/3/2009
FS_Others:     db "Unknown FS "  ; Non Singlix, Another or Unknown File Systems

                db 4
                db 1
Disk_Info:
                db 7
                db "SINGLIX DISK PARAMETERS TABLE [ Disk "
DPT_No:         db "0"
                db " ]"
                db 0Dh, 0Ah, 0Dh, 0Ah
                db "Disk Drive Number: "
DI_DDN:         dw 3030h
                db 'h'
                db 0Dh, 0Ah
                db "Drive Type: "
DI_T:           dw 3030h
                db 'h'
                db 0Dh, 0Ah
                db "Total Drives: "
DI_TD:          dw 3030h
                db 'h'
                db 0Dh, 0Ah
                db "Sectors per Track: "
DI_SPT:         dw 3030h
                db 'h'
                db 0Dh, 0Ah
                db "Heads: "
DI_H:           dw 3030h
                db 'h'
                db 0Dh, 0Ah
                db "Cylinders: "
DI_C:           dd 30303030h
                db 'h'
                db 0Dh, 0Ah
                db "BIOS DPT Segment: "
DI_DPTS:        dd 30303030h
                db 'h'
                db 0Dh, 0Ah
                db "BIOS DPT Offset: "
DI_DPTO:        dd 30303030h
                db 'h'
                db 0Dh, 0Ah
                db "Total Sectors: "
DI_TS_1:        dd 30303030h
                db 'h:'
DI_TS_2:        dd 30303030h
                db 'h'
                db 0Dh, 0Ah
                db 0Dh, 0Ah
                db "LBA Ready: "
DI_LBA_Ready:   db "NO  "
                db 0Dh, 0Ah
Msg_LBA_Totals:
                db 0Dh, 0Ah
                db "LBA Total Sectors: "
DI_LBA_TS_1:    dd 30303030h
                db 'h:'
DI_LBA_TS_2:    dd 30303030h
                db 'h'
                db 0Dh, 0Ah
                db "Bytes in a Sector: "
DI_BytesPersec: dd 30303030h
                db "h"
                db 0Dh, 0Ah, 0


                   db 4
                   db 1

Msg_drive_info:
                   db 7
                   db "[ SINGLIX DRIVE ] "
str_info_drv_name: db "0:"
                   db  0Dh, 0Ah
                   db  0Dh, 0Ah
                   db "Physical Drive Number :  "
str_phy_drv_num:   dw  0
                   db "h"
                   db 0Dh, 0Ah
                   db "Bytes Per Sector :  "
val_bytespersec:   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db "Media Attributes :  "
str_media_attrib:  dw 0
                   db "h"
                   db 0Dh, 0Ah
                   db "File System ID :  "
str_fsystem_id:    dw 0
                   db "h"
                   db 0Dh, 0Ah
                   db "FS Version :  "
str_fs_ver_major:  db 0
                   db "."
str_fs_ver_minor:  db 0
                   db 0Dh, 0Ah
                   db "Beginning Sector :  "
val_startsector:   dd 0
                   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db "Volume Size :  "
val_volumesize:    dd 0
                   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db "Startup File DT :  "
val_startupfiled:  dd 0
                   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db "MAT Location :  "
val_matlocation:   dd 0
                   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db "Root Dir DT :  "
val_rootdird:      dd 0
                   dd 0
                   db "h"
                   db 0Dh, 0Ah
                   db 0Dh, 0Ah
                   db 0
Press_Any_Key:
                   db 0Dh, 0Ah 
                   db "Press any key to continue ..."
                   db 0Dh, 0Ah, 0
Magic_Bytes:
                   db 4
                   db 1
Program_Name:
                   db 7
                   db "[ SINGLIX ] DRIVE INFO "
Version_Str:       db "v2.0  (c) Erdogan Tan 2009"
                   db 0Dh, 0Ah
                   db "File Size = "
                   db 6 dup(0)
FileSize_StrPlus5: db " bytes"
                   db 0Dh, 0Ah
                   db 0Dh, 0Ah
                   db 0

Current_SINGLIX_Drv: db 0
Logical_FS_Disks:  dd 3328 dup(0)
File_Size:         dw $-254

Present            ends

                   end  start
