Last update: Oktober 11th 2025
|
Download the IDE DSR program |
Download the IDE DSR sources |
| |
Test programs written in TI-Basic used for the IDE (and HDX) DSR |
|
You might also need: |
|
This page contains information about the IDE-DSR I wrote for the IDE-CARD as designed by Th. Nouspikel.
A Device Service Routine for the IDE-CARD (Version 18)
This is my DSR for the IDE card as designed by Thiery Nouspikel. Also this
DSR demands an IDE-drive capable of LBA. You also need Dm2k version 2.2 or
newer (for file managing) and Du2k version 1.7 or newer(for initializing).
|
The IDE status in TI-basic. |
Features
The IDE DSR supports:
|
Operation
With this DSR the IDE-card can be used with a TI99/4A or a Geneve 9640.
Select a CRU address with the rotary encoder.
|
BQ4802 BQ4847 BQ4852
._____ _____. ._____ _____. ._____ _____.
| \__/ | | \__/ | | \__/ |
VOUT | 1 28 | VCC VOUT | 1 28 | VCC /RST | 1 36 | VCC
X1 | 2 27 | /WE NC | 2 27 | /WE NC | 2 35 | NC
X2 | 3 26 | /CEin NC | 3 26 | /CEin A18 | 3 34 | /INT <<--
/WDO | 4 25 | /CEout /WDO | 4 25 | /CEout A16 | 4 33 | A15
/-->> /INT | 5 24 | BC -->> /INT | 5 24 | NC A14 | 5 32 | A17
|nc /RST | 6 23 | WDI /RST | 6 23 | WDI A12 | 6 31 | /WE
A3 | 7 22 | /OE A3 | 7 22 | /OE A7 | 7 30 | A13
A2 | 8 21 | /CS A2 | 8 21 | /CS A6 | 8 29 | A8
A1 | 9 20 | VSS A1 | 9 20 | NC A5 | 9 28 | A9
A0 | 10 19 | DQ7 A0 | 10 19 | DQ7 A4 | 10 27 | A11
DQ0 | 11 18 | DQ6 DQ0 | 11 18 | DQ6 A3 | 11 26 | /OE
DQ1 | 12 17 | DQ5 DQ1 | 12 17 | DQ5 A2 | 12 25 | A10
DQ2 | 13 16 | DQ4 DQ2 | 13 16 | DQ4 A1 | 13 24 | /CE
VSS | 14 15 | DQ3 VSS | 14 15 | DQ3 A0 | 14 23 | DQ7
|______________| |______________| DQ0 | 15 22 | DQ6
DQ1 | 16 21 | DQ5
DQ2 | 17 20 | DQ4
VSS | 18 19 | DQ3
|______________|
|
BQ4802
For a new batch of IDE-cards Chris Schneider has created a daughter board for the BQ4802 clock chip with external CR2032 3 Volt battery. The interrupt pin is not connected on this board, so no problems here. |
The BQ4802 daughter board components. |
Power up routineAfter switching on your computer or after a reset, the power up routine is executed. The power up routine tries to read sector 0 of both devices. If sector 0 can be read and the default AU-number of the root directory (>0040) divided by the number of sectors per AU found in sector 0 equals the pointer to the file descriptor record, then the DSR assumes that the device is initialized and all level-2 and level-3 routines can be used. If a device is not initialized, only the level-2 routines read sector, write sector and identify drive can be used so that Du2k is able to initialize the device.Sectors and allocation unitsThe first 32 sectors of an IDE disk are used for the allocation units (AU) free/used table. The second 32 sectors is a mirror of the first 32 sectors. File descriptor records (FDR) and directory descriptor records (DDR) are placed before AU >800, until no more free AU can be found in this section. File data are placed beyond AU >800. When copying files to the IDE device, precisely enough AU's are allocated. When opening a file for writing, a number of 10 AU's are allocated every time new storage space is required. Searching for new AU's starts at the last AU used for that file. If the next block of 10 AU's is directly after the last used AU chain, this chain can then simply expand with the new AU's else a new chain is started. When a file is closed unused AU's are not freed! This is done to prevent to much fragmenting of files. |
Basic interface
The following basic statements are implemented in the IDE-DSR:
|
IDEDSR Vxx CRU:>xxxx
IDE1 STATUS:>xxxx
MAXUA :>xxxx SEC/AU:>xx
IDE2 STATUS:>xxxx
MAXUA :>xxxx SEC/AU:>xx
..
..
IDE8 STATUS:>xxxx
MAXUA :>xxxx SEC/AU:>xx
CLOCK CHIP : BQ48xx
BATTERY LEVEL : OK
DSK1 EMULATION: ON
|
The current version and CRU address The status of the first device The maximum number of allocation units and sectors per allocation units The status of the second device The maximum number of allocation units and sectors per allocation units .. .. The status of the eight device The maximum number of allocation units and sectors per allocation units The type of installed realtimeclock functions: BQ4802, BQ4847 or BQ4852 The battery status of the realtimeclock: OK or LOW DSK1 and DSK emulation status: ON or OFF |
A status of >0000 means that the device didn't respond to the power up
routine, a status of >XY01 means that the device did respond to the
power up routine. The nibble X with a value of 1 or 2 means that the device
is a partition on the master IDE device (1) or slave IDE device (2) respectively.
The nibble Y shows the partition number. A value of 0 means the device has
no partitions and a value of 1, 2, 3 through 8 gives the partition number. A
maximum allocation units of >0000 and/or the number of sectors per
allocation unit of >00 means that the IDE-device (or partition) is not
initialized. A device can only be initialized if the device responds to the
power up routine.
|
CALL IDEDSK(MODE) |
If mode is equal to 0 (null) DSK1 and DSK emulation is disabled, any other value will enable DSK1 and DSK emulation. |
If the CRU address of the IDE card is lower than the CRU address of the
disk controller card and if DSK1 and DSK emulation is on and an attempt is
made to load a program file from DSK1. or DSK.DISKNAME. then first the
subdirectories IDE1.DSK1. or IDE1.DSK.DISKNAME. is checked for the program
file to load. If, in some cases this behavior is undesired, CALL IDEDSK(0)
can be used to temporarily disable DSK1 and DSK emulation. Also when
reading and/or writing sectors from a real floppy with i.e. Du2k, it can be
necessary to disable DSK1 and DSK emulation.
|
CALL IDESC(HH,MM,SS,MM,DD,YEAR) |
Hours from 0 through 23, minutes and seconds from 0 through 59. The month 1 through 12, day of the month 1 through 31 and the year 2000 through doomsday (which apparently is around the year 9999!) |
Since IDE DSR V08 the day of the week is calculated with Zellers formula
for the Gregorian calendar and written to the real time clock (RTC)
automatically.
|
The time and date parameters are all checked against their range and the
date must exist. The real-time-clock will be set for a 24-hour clock and
initialized with the given time and date. The time and date will be used
for time stamping of files only when a correct time and date is set after
loading the DSR.
|
100 OPEN #1:"IDE.TIME",INTERNAL,FIXED 110 PRINT #1:SEC$,MIN$,HOUR$,DAY$,MONTH$,YEAR$ 120 CLOSE #1 |
Every string value is checked against their range and the date must exist.
Every string variable can have a maximum of 5 characters. If the given time
or date is incorrect an I/O error 6 (device error) is returned.
|
HH:MM:SS Day MM-DD-YEAR |
Hours from 00 through 23, minutes and seconds from 00 through 59. The day of the week: SU, MO, TU, WE, TH, FR or SA. The month 01 through 12, day of the month 01 through 31 and the year 2000 through doomsday (which apparently is around the year 9999!) |
Time and date can also be read by reading the file IDE.TIME: |
100 OPEN #1:"IDE.TIME",INTERNAL,FIXED 110 INPUT #1:SEC$,MIN$,HOUR$,DAY$,MONTH$,YEAR$,DAYOFWEEK$ 120 CLOSE #1 |
Hours from 00 to 23, minutes and seconds from 00 to 59. The day of the
week: 01 to 07, Sunday=01. The month 01 to 12, day of the month 01 to 31
and the year 2000 to 9999.
|
Directory off: IDEx.path. SIZE= <sect> USED= <sect> Name Size Type ---------------------------- FILENAME SIZE TYP RECL P DM2K 34 PGM 8192 SRC 123 D/V 80 |
Device name IDE1 through IDE8 and working directory The size in sectors and number of used sectors The contents of the directory with filenames and or subdirectory names. The number of sectors the file or directory occupies on the drive (max 6 digits), the file type D/F D/V I/F I/V PGM or DIR and the record length. In case of a program file the total file size is shown in bytes |
It is only possible to display the contents of directories of an IDE device!
|
CALL IDEDIR("IDE1.")
CALL IDEDIR("IDE1")
CALL IDEDIR("IDE1.DIR1.DIR2")
CALL IDEDIR(".DIR3")
CALL IDEDIR("..DIR4")
CALL IDEDIR("...DIR5")
CALL IDEDIR("DIR6")
CALL IDEDIR
|
Catalog of the root of IDE1. Same as above, trailing '.' is not mandatory Catalog of IDE1.DIR1.DIR2. Catalog of IDE1.DIR1.DIR2.DIR3. Catalog of IDE1.DIR1.DIR2.DIR4. Catalog of IDE1.DIR5. Catalog of IDE1.DIR5.DIR6., leading '.' is not mandatory Catalog of IDE1.DIR5.DIR6. using the path saved from the last call |
Load a program file directly from BASIC: CALL IDELOAD("path.filename")The following information will be print on the screen: |
CALL IDELOAD("IDE2.UTL.DM2K")
|
The program file DM2K is loaded from subdirectory IDE2.UTL. and executed immediately. |
It is only possible with this call to load program files from IDE devices!
When the program file has ended control is returned to the master title screen.
|
CALL IDELOAD("IDE1.PGM")
CALL IDELOAD("IDE1.DIR1.DIR2.PGM")
CALL IDELOAD(".DIR3.PGM")
CALL IDELOAD("..DIR4.PGM")
CALL IDELOAD("...DIR5.PGM")
CALL IDELOAD("DIR6.PGM")
CALL IDELOAD("PGM")
|
Start program PGM found in the root of IDE1. Start program PGM found in the directory IDE1.DIR1.DIR2. Start program PGM found in the directory IDE1.DIR1.DIR2.DIR3. Start program PGM found in the directory IDE1.DIR1.DIR2.DIR4. Start program PGM found in the directory IDE1.DIR5. Start program PGM found in the directory IDE1.DIR5.DIR6. Start program PGM found in the directory IDE1.DIR5.DIR6. |
Print the working directory: CALL IDEPWDThe following information will be print on the screen: |
CALL IDEPWD IDE2.BASIC.PROGRAMS.GAMES. |
Print the working directory. The working directory is the directory last accessed by a CALL IDEDIR or CALL IDELOAD. |
Set DSR options: CALL IDEOPT(n, v)
With this call it is possible to enable or disable some DSR options.
These options are:
|
CALL IDEOPT CALL IDEOPT(n) CALL IDEOPT(n, v) |
No arguments; Displays the current setting of all options. Option number only; Displays the current option value. Option number and value; Changes and displays the option value. |
The option number is from 1 through 6.
|
CALL IDEOPT(1) CALL IDEOPT(1,0) CALL IDEOPT(1,1) |
Displays the current option value. Disable DSK1 emulation Enable DSK1 emulation |
Option 2: DIR reclen 146 CALL IDEOPT(2, v)
With this option it is possible to change the default record length for reading
a directory. By default the record length for reading a directory is 38 bytes
(Name [11 bytes], Type [9 bytes], File record length [9 bytes], Size [9 bytes]).
If the record length for reading a directory is set to 146 then also the file
creation and file update time and date can be read. In this case the sequence
of the file data is: NAME, TYPE, SIZE, RECORD LENGTH, Creation sec, min, hour,
month, Day, year, Last updated sec, min, hour, month, day, year.
|
CALL IDEOPT(2) CALL IDEOPT(2,0) CALL IDEOPT(2,1) |
Displays the current option value. Disable DIR reclen 146, thus the record length is 38 bytes. Enable DIR reclen 146, file timestamp can be read. |
Option 3: Hardware reset CALL IDEOPT(3, v)
Whith this option it is possible to send a hardware reset signal to the IDE
device(s). If this option is enabled the reset signal on the IDE port is held
low for a certain time defined with option 4. For some IDE devices / CF-cards
it is necessary to send a reset signal after power up.
|
CALL IDEOPT(3) CALL IDEOPT(3,0) CALL IDEOPT(3,1) |
Displays the current option value. Disable the hardware reset option. Enable the hardware reset option. |
Option 4: HW reset timerCALL IDEOPT(4, v)
This option defines the time that the hardware reset signal to the IDE device
is held low. The minimum time the reset signal must be held low is 25 micro
seconds. The default value for this option is 9 which is about 88 uSec.
|
CALL IDEOPT(4) CALL IDEOPT(4,10) |
Displays the current option value. Set the hardware reset timer value. |
Option 5: Software reset CALL IDEOPT(5, v)
Whith this option it is possible to send a software reset command to the IDE
device(s). If this option is enabled the reset bit in the control register of
the IDE device(s) is set for a certain time defined with option 6. For some
IDE devices / CF-cards it is necessary to send a reset command after power up.
|
CALL IDEOPT(5) CALL IDEOPT(5,0) CALL IDEOPT(5,1) |
Displays the current option value. Disable the software reset option. Enable the software reset option. |
Option 6: SW reset timerCALL IDEOPT(6, v)
This option defines the time that the software reset to the IDE device
is set. The minimum time the software reset must be set is 5 micro
seconds. The default value for this option is 6 which is about 60 uSec.
|
CALL IDEOPT(6) CALL IDEOPT(6,4) |
Displays the current option value. Set the software reset timer value. |
Reading and writing to a NULL device:The is a special file build into the DSR which is called NULL. Writing to the NULL device throws everything away and reading the NULL device always returns 0. This is just a file for test purposes. |
100 OPEN #1:"IDE.NULL",DISPLAY,VARIABLE 110 INPUT #1:A$ 120 INPUT #1:B 130 PRINT #1:"Throw this away" 140 PRINT #1:1234.5678 150 CLOSE #1 |