#3d13 routines. Help!

ZXNet echo conference «code.zx»

From Aleksandr Majorov To Alexandr Knyzev 27 July 1998

27-07-98 17:15:00 Alexandr Knyzev ==> All AK> Gentlemen, could you remind me what subroutine numbers are for #3d13 AK> are transferred to reg. C and what is their purpose? AK> I lost my documents somewhere, but I never kept this in my memory ;( here you go, I don't mind... I throw _the entire_ help file for TR-DOS, which I use ! #ADR. ! ADDRESS! DL. ! COMMENT! !-------+-------+-----+----------------------------------------! ! 5CB6! 23734! 1x! Used if there is Interface 1! ! ! ! ! (if the value is #F4, then the area ! ! ! ! ! variables are not transferred if equal to ! ! ! ! ! #00, then 23832) is checked! ! 5CC2! 23746! 1x! Contains #C9. Used by the system! ! ! ! ! TR-DOS for calling subroutines in SOS! ! 5CC8! 23752! 1! The code that determines the operating mode of the disco ! ! ! ! ! water A: ! ! ! ! ! bit 7 - 0 40-track drive; ! ! ! ! ! - 1 80-track drive; ! ! ! ! ! bit 1 - 1 double-sided drive; ! ! ! ! ! bit 0 - 0 use 80-track ! ! ! ! ! like a 40-track!! 5CC9! 23753! 1! The same for drive B! ! 5CCA! 23754! 1! The same for drive C! ! 5CCB! 23755! 1! Same for drive D! ! 5CCC! 23756! 1x! Current sector when reading directory ! ! 5CCD! 23757! 1x! #80 - drive ready! ! 5CCE! 23758! 1x! #00 - reading sector; ! ! ! ! ! #FF - sector entry! ! 5CD6! 23766! 1x! When #FF - the command is accepted (not executed! ! ! ! ! Nena)! ! 5CD7! 23767! 2x! Intermediate start (type B and C); ! ! ! ! ! after checking the drive type contains ! ! ! ! ! number of tracks! ! 5CD9! 23769! 2x! Internal analog CH_ADD; ! ! ! ! ! Intermediate length (type B and C) ! ! 5CDB! 23771! 2x! Intermediate program length ! ! 5CDD! 23773! 8! File name in ASCII ! ! 5CE5! 23781! 1! File type ! ! 5CE6! 23782! 2! For type C - starting address; ! ! ! ! ! with type B - the length of the BASIC program! ! 5CE8! 23784! 2! File length ! ! 5CEA! 23786! 1! File size in sectors !! 5CEB! 23787! 1! Number of the first sector of the file (0-15) ! ! 5CEC! 23788! 1! Number of the first track of the file! ! 5CEF! 23791! 1x! 1 if there is Interface 1 ! ! 5CF4! 23796! 1x! Intermediate sector number ! ! 5CF5! 23797! 1x! Intermediate track number! ! 5CF6! 23798! 1! Disk drive for temporary operation (0-3) ! ! 5CF7! 23799! 2! When returning from 15616 it is reset to zero! ! 5CF8! 23800! 1! Disk drive during a two-file operation; ! ! ! ! ! #FF if the channel is open! ! 5CF9! 23801! 1! Disk drive during a two-file operation; ! ! ! ! ! READ/VERIFY operation flag; ! ! ! ! ! drive number with command #07 ! ! 5CFA! 23802! 1! Drive head movement time A! ! 5CFB! 23803! 1! Same for B! ! 5CFC! 23804! 1! Same for C! ! 5CFD! 23805! 1! Same for D! ! 5CFE! 23806! 1x! Command code for 1818VG93! ! 5CFF! 23807! 1x! Sector number for subroutine #3F04 ! ! 5D00! 23808! 2x! Intermediate buffer address (#05/#06) ! ! 5D02! 23810! 2x! Saves HL for internal needs! ! 5D04! 23812! 2x! Saves DE for internal needs!! 5D06! 23814! 1! Number of characters when searching for a file name ! ! ! ! ! (see com.#0A). Initial value #09 ! ! 5D07! 23815! 1x! Counter of deleted files (com.#12) ! ! 5D08! 23816! 1x! The first character of the file name (com.#12) ! ! 5D0C! 23820! 1x! Workspace status flag TR-DOS ! ! ! ! ! (257 bytes from address 23846: #FF - open! ! ! ! ! #00 - closed) ! ! 5D0E! 23822! 1x! Team ownership flag (#FE - ra- ! ! ! ! ! botatet basic, otherwise - ! ! ! ! ! TR-DOS)! ! 5D0F! 23823! 1x! Error code TR-DOS; ! ! ! ! ! inside TR-DOS, if inequality 0 enters ! ! ! ! ! RETURN command; otherwise - ! ! ! ! ! empty string (routine #20EF) ! ! 5DA0! 23824! 1x! High byte of error when calling 15616! ! ! ! ! is reset to zero, to call 15635 you need ! ! ! ! ! force reset (to avoid ! ! ! ! ! erroneous situations)! ! 5D11! 23825! 2x! Command line address for TR-DOS ! ! ! ! ! when calling 15616 reps. E_LINE (23641), ! ! ! ! ! when calling 15619 - CH_ADD (23645) !! 5D13! 23827! 2x! copy ERR_SP; ! ! ! ! ! if the high byte is equal #AA auto- ! ! ! ! ! The command is automatically executed! ! ! ! ! RUN "boot", ! ! ! ! ! and in 23822 the code #FE is entered! ! 5D15! 23829! 1x! If equal, #00 prints messages ! ! ! ! ! TR-DOS, otherwise - no printing! ! ! ! ! melting! ! 5D16! 23830! 1! Copy of the system register (555TM9)! ! 5D17! 23831! 1! If #AA ​​is not equal, when calling 15616 ! ! ! ! ! a splash screen is drawn, if #FF is equal! ! ! ! ! does not fall into error when reading non- ! ! ! ! ! correct address marker! ! 5D18! 23832! 1x! Used when Interfa- ! ! ! ! ! ce 1 (if the value is #FF then me- ! ! ! ! ! blocks in memory are swapped according to address! ! ! ! ! itself 23747 - 23859 with a volume of 45 bytes, with ! ! ! ! ! when calling TR-DOS, #FF) is entered! ! 5D19! 23833! 1! Default drive (0-3) ! ! 5D1A! 23834! 2x! Internal address of completion procedure ! ! ! ! ! (#0201) !! 5D1C! 23836! 2x! Saves SP! ! 5D1E! 23838! 1! File number, if found (com.#0A) ! ! 5D20! 23840! 3! The first three characters of the entered string are ! The symbol "x" marks the internal variables of the TR-DOS system, which are not recommended to be changed during operation. From machine code of a subroutine for working with primitives and files are called to address 15635 (#3D13). The function code is placed in register "C" (command descriptions are given below), parameters transmitted through other registers, it is possible, in some cases, transfer of parameters through the TR-DOS system variables area. But that's not all!!!! *MAS* with a sledgehammer

From Aleksandr Majorov To Alexandr Knyzev 27 July 1998

INTERNAL BETA DISK REGISTERS ! ADDRESS ! COMMENTS! !----------+--------------------------------------------------! ! #1F ! Command/status register 1818VG93 ! ! #3F ! Track register! ! #5F! Sector Register! ! #7F ! Data register! ! #FF! Entry: TR-DOS system register: ! ! ! bit 6 - recording method (0 - FM; 1 - MFM) ! ! ! bit 4 - side number! ! ! bit 3 - reset 1818VG93! ! ! bit 2 - ready! ! ! bit 0,1 - drive number! ! ! Read: status of DRQ and INTRQ signals! TR-DOS SYSTEM SUBROUTINES #00 Recovery (controller reset). Waiting to appear INTRQ signal, wakes up when a key is pressed BREAK. #01 Selecting a drive. The number of the selected drive is indicated in register "A". With the value #FF at address 23802+"number selected drive" (see system variables) The drive is initializing (detected number of drive tracks, positioning constantsand are entered into the corresponding system variables). B cell 23798 (see) the number of the selected drive is entered. To avoid erroneous situations, it is recommended to duplicate in cells 23800 and 23801. #02 Positioning. The head is installed on the track, indicated by register "A". In case of double-sided drive numbers 0 and 1 correspond to the first physical track (0 and 1 side respectively), numbers 2 and 3 - second, etc. #03 Places the contents of register "A" at address 23807 (number sector). #04 Places the contents of register pair "HL" at address 23808 (buffer address). #05 Reading a group of sectors. Before calling the subroutine in register B contains the number of sectors read in a row (with a value of 0, only the area is read from the disk header, no reading into memory occurs). To register D is the track number, and register E is the sector number. The HL register must contain the address of the buffer in memory, in which will be read. #06 Record a group of sectors. The parameters are the same as command #05. #07 Output disk directory. Register A must contain channel number (to display on the screen, the battery must contain the value 2, to the printer - 3, etc.). Executionsubroutines are similar to executing the TR-DOS "CAT" command. Before outputting the directory, command #18 is executed (see). #08 Reading file information. The battery must have number of the file of interest from (0-127). From disk directory 16 bytes of file information will be placed from address 23773 (there is no check for the presence of this file). B file numbers are included and deleted. #09 Write file information to the directory. From the address 23773 16 bytes are rewritten to the disk directory in place of information about file, the number of which is specified by register "A". #0A Search for a file. The search for a file in a directory is carried out by name and type (from address 23773). Number of bytes by which search is in progress, set to address 23814, initial value - 9. If the file is found, then upon returning from subroutines, register C will indicate its ordinal number (same at addresses 23828, 23823). Otherwise case, the most significant bit of register C is set to one (23828 does not change, 23823 will contain #FF). #0B Write file. From address 23773 - file name and type, in register pair HL - start address in memory, in register pair DE - file length. #0C Recording a BASIC program. From address 23773 - file name and type(if the type is different from , the file is written under the name "boot"). #0D, #0F, #10, #11 - no commands. #0E Read/check file. The file name and type must be placed from address 23773. The file download address is taken from directory (with accumulator equal to #00) or from register pair HL, length from directory or from register pair DE (with accumulator equal to #03). Value at address 23801: #00 - LOAD, #FF - VERIFY. -- in short, #00/#03 is crap! More correct like this: if bit 0,A =1, then the file download address is taken from register pair HL if bit 1,A =1, length from register pair DE #12 Deleting files. File name and type - from address 23773. All files with such data are deleted. #13 16 bytes of information from memory addressed register pair HL, at 23773. #14 16 bytes of information from 23773 are rewritten into memory by address HL. #15 Checking the track. Register D must contain the number the physical track being checked. #16 Loading the system register. The code is in the battery. First, #3C is added to it. #17 Select the bottom side. #18 Setting to disk. Checks the disk type (8.S0th .Tsector directories). DISC DIRECTORY FORMATThe directory occupies track zero on the disk. Sectors 0 to 7 used to store information about the file (16 bytes per file): bytes 0..7 - file name in ASCII; byte 8 - file type; bytes 9,10 - parameter "START"; bytes 11,12 - file length; byte 13 - file size in sectors; byte 14 - number of the first sector; byte 15 - number of the first track. If the first byte of the header contains the value #01, then the file considered deleted. The value #00 determines the end catalogue. The eighth sector of track zero contains information about the disk in overall: ! ADDRESS FROM! ! ! IT'S STARTED! COMMENTS! ! SECTORS! ! !----------+--------------------------------------------------! ! #E1 ! First free sector! ! #E2 ! First free track! ! #E3! Disc type! ! ! #16 - 80 tracks, double-sided! ! ! #17 - 40 tracks, double-sided! ! ! #18 - 80 lanes, single-sided! ! ! #19 - 40 lanes, single-sided! ! #E4 ! Total number of files!! #E5,#E6 ! Number of free sectors on the disk! ! #E7 ! Code #10, which determines whether the disk belongs to ! ! ! TR DOS system! ! #F4 ! Number of deleted files! ! #F5-#FC ! Drive name in ASCII !   Error codes. All error messages appear only from TRDOS. If the command came from SOS or from a machine code program, then the message will not appear on the screen. However they are stored as code in register pair "BC": 0 - no errors 1 - no files 2 - file exists 3 - no memory space 4 - directory failure 5 - record number is full 6 - no disk 7 - disk errors 8 - syntax errors 10 - channel is already open 11 - no file on disk 12 - channel not open Well that's all *MAS* with a sledgehammer