PROJECT: TR-DOS Operation System   Issue: 4    Revision: 0    Date: 13/02/2005

OWNER: ERDOĐAN TAN / Istanbul / Turkiye

 

PROGRAM SEGMENT PREFIX Structure of  TR-DOS Operation System Version 1.0

 

Offset

Item

DATA

Type

Size

Description of Item

0

pspINT20h

CDh,20h

dw

2 byte

Int 20h instruction

2

pspNextFreeBlock

XXXXh

dw

2 byte

Segment adress of next free mem block

4

TrDos Version

XYh (10h)

db

1 byte

TRDOS Version Major = X, Minor = Y

5

TrDos GDP *

jmp CS:IP

far jmp

5 byte

JMP to TRDOS Get Drive Parameters

10

pspTerminateVect

SEG:OFF

dd

4 byte

INT 22h Terminate Vector

14

pspControlCVect

SEG:OFF

dd

4 byte

INT 23h Control-C Handler Vector

18

pspCritErrorVect

SEG:OFF

dd

4 byte

INT 24h Critical Error Handler Vector

22

pspParentID

XXXXh

dw

2 byte

PSP segment of parent (Kernel = 0)

24

pspMATLocation

SEG:OFF

dd

4 byte

Memory Allocation Table Adress

28

pspSecBuffAddr

SEG:OFF

dd

4 byte

Sector Buffer (2048 bytes) Address

32

pspFATBuffAddr

SEG:OFF

dd

4 byte

FAT Buffer (1536 bytes) Address

36

pspDirBuffAddr

SEG:OFF

dd

4 byte

Directory Buffer (512 bytes) Address

40

pspClustBuffAddr

SEG:OFF

dd

4 byte

Cluster (Transfer) Buffer Address (32K)

44

pspEnvironment

XXXXh

dw

2 byte

Segment address of environment block

46

pspUserStack

SEG:OFF

dd

4 byte

User Stack

50

pspFHandleCount

XXXXh

dw

2 byte

Count of File Handles (allocated)

52

pspFileHandlePtr

SEG:OFF

dd

4 byte

Pointer to Handle Table

56

FileDescriptorTable

SEG:OFF

dd

4 byte

Pointer to Memory File Descriptor Table

60

TrdosKernelProcs

SEG:OFF

dd

4 byte

Address of TR-DOS Proc Pointers Table

64

pspVersionStr

ASCIZZ Str

char

12 byte

db “TR-DOS v1.0”,  0

76

pspDTASave

SEG:OFF

dd

4 byte

Disk Transfer Area Address (DTA)

80

pspDOScall

CDh,21h,CBh

code

3 byte

INT 21h, RETF instructions

83

TrDosLDisksDT

SEG:OFF

dd

4 byte

Beginning address of TRDOS LD Tables

87

TrDosCurrentDrive

00h, XXh

dw

2 byte

Current DOS Drive (XX00h, XX = CDD)

89

pspTrDosBootDisk

XXh

db

1 byte

Boot Disk Number (TRDOS started on)

90

pspLastDosDisk

XXh

db

1 byte

Last Logical Dos Disk Number

91

pspLogicalDosDisk

XXh

db

1 byte

Logical Dos Disk No. of this program

92

Directory Entry

32 bytes

byte

32 byte

32 bytes Dir Entry Copy of this program

124

Directory Cluster

XXXXh:XXXXh

dd

4 byte

Dir Cluster Number of this program

128

pspCommandTail

128 bytes

byte

128 byte

Command Tail (also Default DTA)

 

MS-DOS 5.0/6.2/7.1 (RX-DOS) PSP Structure:  msdos_psp.html       index.html

 

* TR-DOS GDP :  Get TR-DOS Disk/Drive Parameters Table Adresses

 

   INT 30h – Function AX = 0h   [ Get TRDOS Drive Parameters ]

 

   INT 30h handler: < INT 30h => TRDOS Run Time System Functions >

    

         cmp AX, 0

          ja short pass_trdos_gdp

         ; INPUT = none

Loc_TRDOS_GDP: ; PSP offset 5 will have “jmp far TRDOS_GDP” instruction to HERE.

          call proc_get_trdos_drive_params  ; Far call, Returns with RETF

         ; OUTPUT:

         ;   DS:SI = TRDOS Logical Drive Tables Beginning Address

         ;   BH= Current DOS Drive  (SI+BX= Current DOS Drive Table Offset)

         ;   BL = 0

         ;   AH= TRDOS version Major (= 1)

         ;   AL= TRDOS version Minor (= 0)

         ;   CL= Last Logical Dos Drive Number

         ;   CH= Boot Drive Number (TRDOS has started on)

         ;   DS:DX = Beginning Address of TRDOS Partition Tables

  pass_trdos_gdp:

         ...

        IRET

 

       ***

        Setting of pointer TRDOS_GDP in TRDOS Kernel (also INT 30h will be set) :

        ; DS = TRDOS INT 30h Handler Segment

        mov word ptr [TRDOS_GDP], offset Loc_TRDOS_GDP

        push DS

        pop word ptr [TRDOS_GDP]+2

        ...

        mov byte ptr ES:[TRDOS_PSP]+5, 0Eah  ; TRDOS_PSP = 0

        mov word ptr ES:[TRDOS_PSP]+6, offset Loc_TRDOS_GDP

        push DS ; TRDOS INT 30h Handler Segment

        pop word ptr ES:[TRDOS_PSP]+8