System information - TR-DOS Reference Guide.

Book #01
 System variables TR-DOS 5.04T.

╔═════╤═══╤════════════════════ ══════════════════════════════╗
║Address│Length│ Content.                      ║
╟─────┼───┼──────────────────── ──────────────────────────────╢
║23734│ 1 │Used if there is INTERFACE-1. If equal to ║
║ │ │244, then the variable area is not transferred, otherwise ║
║ │ │checking 23832. ║
║23735│ 11│Not used.                                  ║
║23746│ 1 │Contains the RET command. Used to switch - ║
║ │ │version of ROM to BASIC.                                ║
║23747│ 5 │Not used.                                  ║
║23752│ 1 │Drive type A: ║
║ │ │ bit 7=0 - 40-track drive.                ║
║ │ │ 1 - 80-track drive.                ║
║ │ │ bit 1=0 - single-sided drive.                ║
║ │ │ 1 - double-sided disk drive.                ║
║ │ │ bit 0=0 - use 80-track drive as║
║ │ │ 40-track.                         ║
║23753│ 1 │Drive type B. ║
║23754│ 1 │Drive type C. ║
║23755│ 1 │Disk drive type D. ║
║23756│ 1 │Current sector when working with a directory.            ║
║23757│ 1 │Ifnot 0, then after positioning there will be a delay -║
║ │ │ka. VG-93 status register before road check -║
║ │ │ki. Bit 7 of the VG-93 status register before reading ║
║ │ │address marker.                                ║
║23758│ 1 │Flag for operations with sectors. At 0 - reading sectors,║
║ │ │at 255 - recording.                                 ║
║23759│ 2 │Address of the working memory area for MOVE, COPY, LIST.║
║ │ │and when processing the record number when outputting to a file ║
║ │ │direct access data.                           ║
║23761│ 1 │Length of the moved file for MOVE.               ║
║23762│ 1 │Array name when writing/loading an array in the form: ║
║ │ │bits 0 - 4 - array name (from "A"=1 to "Z"=26), ║
║ │ │bit 5 - if 0, then the array is numeric, ║
║ │ │bit 6 - if 1, then the array is string, ║
║ │ │bit 7 is always 1. ║
║23761│ 2 │Autostart line number when writing a program to ║
║ │ │basic.                                          ║
║23763│ 2 │Sector counter of the moved file for MOVE.    ║
║23764│ 1 │Number of the file to be erased for MOVE.                  ║
║23765│ 1 │Current sector of the moved file for MOVE.      ║
║23766│ 1 │The current track of the moved file for MOVE. Co- ║
║ │ │number of defective sectors during formatting and ║
║ │ │checking the disk.For the string compression routine: ║
║ │ │if 0, then the command is in the program line at║
║ │ │basic, otherwise elsewhere. For subroutine ║
║ │ │file download: if 0, then download address and length ║
║ │ │taken from the file descriptor, if 3, then from 23769 and ║
║ │ │23771 respectively, otherwise the download address is taken║
║ │ │from 23769, and the length is from the file descriptor.           ║
║23767│ 1 │The current sector of the file to be erased during MOVE. Quantity-║
║ │ │two tracks when determining the type of drive and format- ║
║ │ │matting.                                      ║
║23768│ 1 │The current track of the file to be erased during MOVE. If not
║ │ │0, then the formatted track is not checked.       ║
║23767│ 2 │Saves CH_ADD when processing record number in ║
║ │ │sequential access file. Variable address ║
║ │ │string length for the string compression routine. Address║
║ │ │of the old array when loading the array. Secto address -║
║ │ │pa for PEEK and POKE.                               ║
║23769│ 1 │Relative address of record when processing number ║
║ │ │records in a sequential access file.         ║
║23770│ 1 │Number of the block of the arbitrary file to be opened - ║
║ │ │stupid when processing the record number. If equal to 128, ║
║ │ │then two sides are formatted, otherwise only one.  ║
║23769│ 2 │Vacation countersectors for MOVE. Address ║
║ │ │file loading for LOAD, sector number for PEEK and ║
║ │ │POKE. The keyword address for the compression subroutine is ║
║ │ │this line. Length of the file to be written when SAVE.      ║
║23771│ 1 │The number of the loaded sector of the file block is arbitrary - ║
║ │ │free access when processing the record number. Number ║
║ │ │the first sector of the moved file for MOVE.     ║
║23772│ 1 │number of the first track of the moved file for MOVE.║
║23771│ 2 │File length for LOAD. File length to specify in ║
║ │ │directory with SAVE. Stream number for CAT and LIST.   ║
║23773│ 8 │The name of the file or disk when formatting.           ║
║23781│ 1 │File extension.                                 ║
║23782│ 2 │File download address. Sector table address for ║
║ │ │formatting.                                   ║
║23784│ 2 │File length. Sector table address to check ║
║ │ │paths.                                          ║
║23786│ 1 │File volume in sectors.                           ║
║23787│ 1 │Number of the first sector of the file.                      ║
║23788│ 1 │Number of the first track of the file.                       ║
║23789│ 2 │Download address of the old file for COPY.            ║
║23791│ 2 │Length of the old file in bytes for COPY.            ║
║23793│ 1 │Length of the old file in sectors for COPY.          ║
║23794│ 1 │Number of the first sector of the old filefor COPY.     ║
║23795│ 1 │Number of the first track of the old file for COPY.      ║
║23796│ 1 │Number of the current sector for the subroutine ║
║ │ │sector loading/writing.                       ║
║23797│ 1 │Number of the current track for the subroutine ║
║ │ │sector loading/writing.                       ║
║23798│ 2 │Disk drive number for the operation (0 - 3).             ║
║23800│ 1 │Source drive for COPY. If equal to 255, then at║
║ │ │When outputting to a data file, the buffer is not deleted.          ║
║23801│ 1 │Receiver drive for COPY. Drive number at ║
║ │ │output of the directory. Sign of file operation: 0 - ║
║ │ │ - loading, 255 - verification.                    ║
║23802│ 1 │Drive head movement time A: (8 - 11).  ║
║23803│ 1 │Same for drive B:.                           ║
║23804│ 1 │Same for drive C:.                           ║
║23805│ 1 │Same for drive D:.                           ║
║23806│ 1 │Controller command for read/for- ║
║ │ │pis sector.                                     ║
║23807│ 1 │Sector number for read/write routine ║
║ │ │sector.                                          ║
║23808│ 2 │Sector address for read/write routine ║
║ │ │sector.                                          ║
║23810│ 2 │Saves HL for subroutine call subroutine║
║ │ │from BASIC ROM and 15635. ║
║23812│ 2 │Keeps DE.                                     ║
║23814│ 1 │Number of file descriptor bytes checked when it is ║
║ │ │search.                                           ║
║23815│ 1 │Number of erased files for the erase subroutine - ║
║ │ │ files.                                       ║
║23816│ 1 │The first character of the file name for the erase routine is ║
║ │ │ files.                                       ║
║23817│ 1 │data file type for OPEN# ("R", "W" or "RND").  ║
║23819│ 2 │Not used.                                  ║
║23820│ 1 │Buffer presence flag: 0 - yes, otherwise - no.       ║
║23821│ 1 │Number of the current file when copying the entire disk from║
║ │ │two disk drives.                                ║
║23822│ 1 │State flag of the working memory area. If equal to ║
║ │ │255, then the work area was used. If equal║
║ │ │254, then subroutine 963 ignores errors.       ║
║23823│ 1 │TR-DOS error code. When searching for a file with the subroutine ║
║ │ │15635: 255 - file not found, otherwise - file number. ║
║23824│ 1 │Operation flag for the load/verify subroutine
║ │ │file cations: 0 - file operation, 255 - download- ║
║ │ │ka / file sector verification, otherwise - write ║
║ │ │sectors of the file.                                    ║
║23825│ 2│Command line address.                           ║
║23827│ 2 │Saves the contents of ERR_SP for subprograms
║ │ │gate to BASIC.                                   ║
║23829│ 1 │If 0, then error messages are displayed on the screen - ║
║ │ │kah, otherwise they will not be displayed.                          ║
║23830│ 1 │Copy of the system register.                        ║
║23831│ 1 │If equal to 170, then when calling 15612 the screen saver does not ║
║ │ │is displayed, otherwise the splash screen is displayed and checked ║
║ │ │byte at address 23296. If it is equal to 170, then the
║ │ │the “boot” file is launched.                        ║
║23832│ 1 │Used if there is INTERFACE-1. If not 0, then║
║ │ │memory blocks 45 bytes long are swapped ║
║ │ │addresses 23747 and 23859. ║
║23833│ 1 │Default drive number.                     ║
║23834│ 2 │Return address from the completion subroutine.        ║
║23836│ 2 │Saves SP for return to BASIC routines.   ║
║23838│ 1 │File number when searching for it.                       ║
║23839│ 1 │Flag for calling TR-DOS. If 0, then the call was ║
║ │ │from machine code, otherwise - from BASIC. First sec-║
║ │ │tor of the file on the destination disk for COPY S. ║
║23840│ 1 │First sector of the file on the destination disk for COPY S.║
║23840│ 3 │Saves the first 3 characters of the command line.      ║
║23841│ 1 │If not 0,then there is the first copying pass, otherwise
║ │ │che continuation.                                   ║
║23843│ 1 │Size of available memory in sectors for MOVE and ║
║ │ │COPY.                                             ║
╚═════╧═══╧════════════════════ ══════════════════════════════╝
   When initializing the system, the following cells are used:
╔═════╤═══╤════════════════════ ══════════════════════════════╗
║Address│Length│ Content.                      ║
╟─────┼───┼──────────────────── ──────────────────────────────╢
║23746│ 1 │RET command. Used to call subroutines ║
║ │ │from BASIC ROM.                                   ║
║24320│ 2 │Saves HL for command execution subroutine ║
║ │ │processor in RAM.                                 ║
║24322│ 14│Not used.                                  ║
║24336│ 3 │Subroutine for moving LDIR memory blocks or ║
║ │ │LDDR.                                             ║
║24339│237│Time stack.                                   ║
╚═════╧═══╧════════════════════ ══════════════════════════════╝
   Also, when initializing TR-DOS system variables, 20 bytes
com from address 23698 are used to place the subroutine
checking the presence of INTERFACE-1.

     Ways to access TR-DOS ROM.

   The TR-DOS ROM is a shadow ROM, so it cannot be accessed.
touch directlyhelp CALL. But in order for it
was available for use, there are addresses, when transferred
during which the TR-DOS ROM is turned on. In BASIC-48 ROM in these
addresses there is a character generator, therefore it is usually controlled
love is never transferred there. Attention!!! In ROM Basie-
ka-128 there is a program in these addresses, so when you turn on
The correct BASIC-128 ROM TR-DOS ROM is completely blocked. Below
you see a list of entry points that switch ROMs.

15616 - input to the TR-DOS command processor.
15619 - execution of TR-DOS commands from BASIC.
15622 - subroutine for inputting from a data file.
15629 - subroutine for outputting to a data file.
15632 - memory modification subroutine.
15635 - calling TR-DOS routines from machine code.
15638 - subroutine for processing errors coming from the ROM.
        sika.
15663 - jump to any address in the TR-DOS ROM.

 How to use these entry points.

15616 - simple call. Can be installedvariables 23831 and
        23296.
15619 - from BASIC:
        RANDOMIZE USR 15619:REM:
        from machine code:
        1) place the command line in ASCII form in memory with
           prefix REM:.
        2) place the address of this line in CH_ADD.
        3) CALL 15619.
        For example:
       LD HL,LINE ;setting CH_ADD
       LD (23645),HL
       JP 15619 ;command execution
                     ;command line
LINE DEFB 234 ;REM
       DEFB ":" ;:
       DEFB 239 ;HOAD
       DEFB 34 ;"
       DEFM "EXAMPLE";EXAMPLE
       DEFB 34 ;"
       DEFB 13 ;ENTER

15622 - open the data file channel and call. The output symbol
        from the file will be in the battery.
15629 - open the data file channel, place the symbol in A and
        call. Attention!!! Contains an error.
15632 - just call. Checks 23734 and 23832 and changes blocks
        memory in places, if necessary.
15635 - Place the subroutine number in register C, the rest
        according to the table:

╔═════╤════════════════════════ ══════════════════════════════╗
║ Com. Functions  ║
╟─────┼──────────────────────── ──────────────────────────────╢
║  0  │Recovery waiting for INTRQ. Perceives BREAK. ║
║  1  │Selecting a drive. Place the drive number in register ║
║ │A. If in the variable with the time of head movement ║
║ │disk drive bit 7 is turned on, then the time nepeme-║ is determined
║ │the head is turned and the variable with the disk type is checked
║ │water. If it is not equal to 255 (error), then it will be determined
║ │the number of tracks on the drive is determined. In this case, it is assumed
║ │it is assumed that the drive is single-sided (error). When possible
║ │the gate determines the number of the track on which the go-║
║ │disk drive and is entered into the track register.        ║
║ 2 │Positioning. Place the logical zero of the track in║
║ │A. If the address 23757 is not 0, then after positioning
║ │ there will be a delay. There is an error in the program.          ║
║ 3 │Places the contents of the accumulator at address 23807. ║
║ 4 │Places the HL content at the address23808. ║
║ 5 │Reading a group of sectors. In HL, place the address in memory,║
║ │in D - the number of the first track, in E - the number of the first section-║
║ │ra, in B - the number of sectors. There is an error in the program - ║
║ │ka.                                                   ║
║ 6 │Record a group of sectors. Parameters and error are the same ║
║ │team 5. ║
║ 7 │Directory output. Place the thread number in the accumulator, ║
║ │ and in 23801 place the drive number from 23798. In the program - ║
║ │gram has an error.                                    ║
║ 8 │Reading the file descriptor at address 23773. File number ║
║ │place in the battery.                              ║
║ 9 │Write a file descriptor. Place the descriptor at the address- ║
║ │su 23773 and place the file number in the battery.       ║
║ 10 │File search. Place the part of the descriptor to be checked with ║
║ │address 23773, and place its length at 23814. If the file ║
║ │is found, then its number will be in BC, 23823 and 23838, otherwise ║
║ │23838 does not change, but in 23823 and BCwill be 255. ║
║ 11 │Recording a file. Place the name and extension from 23773 to - ║
║ │place the beginning in memory in HL, and the length in DE.         ║
║ 12 │Recording a program in BASIC. Place name and extension -║
║ │those from address 23773. If the extension is not “B”, then the file is for-║
║ │written as code.                               ║
║ 13 │Not used.                                      ║
║ 14 │Performs 5 functions: ║
║ │ File upload: in 23801 and 23824 place 0, name and ║
║ │ place the extension with 23773, and also: ║
║ │ For BASIC programs - nothing more.              ║
║ │ For CODE files: ║
║ │ When A=0 - the loading address and length are taken from the catalogue-║
║ │ ha.                                      ║
║ │ When A=3 - the loading address is taken from HL, the length - from ║
║ │ DE.                                      ║
║ │ Otherwise - the loading address is taken from HL, the length - from ║
║ │ catalogue.                                ║
║ │ For arrays - A<>0, in HL - the length of the body of the old mass- ║
║ │ siwa or0 if there is none; in 23767 - body address ║
║ │ of the old array in memory, in 23762 - the name of the array.    ║
║ │ File verification - everything is the same as for uploading, only in ║
║ │ 23801 place 255. ║
║ │ Loading a file sector - place 0 in 23801, in ║
║ │ 23824 - 255, in 23767 - loading address, in HL - number ║
║ │ sectors, in A - 3, in DE - 0 (the last two actions - ║
║ │ to bypass the error. Attention!!! Doesn't work with files ║
║ │ BASIC and DATA due to an error.                           ║
║ │ Verification of the file sector - everything is the same as during downloading, ║
║ │ only in 23801 place 255. ║
║ │ Recording a file sector - place 255 in 23801 (for ob-║
║ │ error progress), in 23824 - not 0 and not 255, in A - not 0, in ║
║ │ HL - sector number, 23767 - address in memory.        ║
║15-17│ Not used.                                     ║
║  18 │ Erasing files. Place the name and extension with 23773, ║
║ │ you can reset 23815, then at the end there will be ║
║ │ number of erased files.                                ║
║  19 │ Transfer of 16 bytes from the address to HL to address 23873. ║
║ 20 │ Reverse 19. ║
║ 21 │Checking the track. Place the physical track number in║
║ │battery and select the disk side. If found ║
║ │bad sectors, then in 23823 and BC there will be 7, and in 23766 bu-║
║ │details their number.                                    ║
║ 22 │Selects the top side of the disk.                       ║
║ 23 │Selects the bottom side of the disk.                        ║
║ 24 │Checks disk ownership and configures the system ║
║ │on its type. Contains an error.                          ║
╚═════╧════════════════════════ ══════════════════════════════╝

15638 - internal entry point. How to use, see
        disassembler.
15663 - place the desired address on the stack, then JP 15663.
        As an example, I give subroutines for executing two
        TR-DOS commands missing in 15635.

Fdisk formatting. Place the disk name in 23773.

        CAHL 15632 ;memory change
        LD A,255 ;this partprograms repeats 15635
        LD (23829),A ;do not print messages
        LD (23839),A ;running machine code
        LD (23768),A ;do not check tracks
        LD (23761),A ;NO DISC when reading address marker
                     ;ignore
        LD HL,513 ;after completion the return will be in BASIC
        LD (23834),HL
        LD (23836),SP;save SP
        PUSH AF ;allocate space for subroutine address
                     ;error handling
        LD HL,7901 ;address of the formatting routine
        PUSH HL ;pushing it onto the stack
        LD HL,541 ;address of the subroutine for setting the address of the
                     ;error handling
        PUSH HL ;pushing it onto the stack
        JP 15663 ; entry into TR-DOS ROM

Upacking disk space.

        CALL 15632 ;repeat 15635 again
        LD A,255
        LD (23829),A
        LD (23839),A
        LD HL,513
        LD (23834),HL
        LD (23836),SP
        PUSH AF
        LD HL,5806 ;address of space packing subroutine
                     ;disk
        PUSH HL ;pushing it onto the stack
        LD HL,541 ;continue as in the previous example
        PUSH HL
        JP 15663

Share your thoughts about the article