ZX Review #1-2
31 декабря 1996
  TR-DOS  

Returning to the printed - the last file dizzasemblera TR-DOS.

<b>Returning to the printed</b> - the last file dizzasemblera TR-DOS.
                      BACK TO PRINTED


        In the recently released book us P. Fedin, "A full 
description and complete disassembler TR DOS 5.04 (5.03) "due 
to technological error was not published Last full file 
disassembler. Bring authors and readers your apologize and 
correct the admitted mistake. So: 

Address 15361. Same as 15665.
JR 15 361 15 366

Address 15364. Same as 15642
JR 15 364 15 369

Address 15366. Same as 15665.
15366 JP 15616

Address 15369. Same as 15642.
15369 JP 15619

Address 15610. Same as 8433.
15610 JP 8433

Address 15613. Same as 15635, but does not switch firmware.
15613 JP 10300

Address 15616. Log in TR-DOS. Switches ROM.
15616 NOP

      JR 15665

Address 15619. Executing commands TR-DOS from BASIC. Set
CH_ADD the prefix: REM: in front of the team. Returns in the BC 
Code errors. Switches ROM.

15619 NOP

      JR 15642

Address 15622. Sub-entry from a data file. Switches
Rom. When you call from the editor introduces a whole line and 
produces output from the editor, otherwise it returns to the A 
symbol in the file. 15622 NOP


      JP 9711

Address 15626. Same as 15629, but does not switch firmware.
15626 JP 9290

Address 15629. Sub-output data file. Put symbol
in the battery. It is also used to address 15630. Both entry 
points switch ROM.

15629 NOP
JR 15 630 15 626

Address 15632. Same as 8433. Switches ROM.
15632 NOP

      JR 15610

Address 15635. Go to the subroutine subroutine call TR-DOS
of machine code. The address is a switch.
15635 NOP

      JR 15613

Address 15638. Go to the error-handling routine. The address is
switch.
15638 NOP

      JP 12137

Address 15642. Same as 15619, but does not switch firmware.
15642 CALL 15649; creation of system variables TR-DOS

      PUSH HL; room on the stack address switch ROM BASIC

      JP 364; command execution

Address 15649. Creation of system variables TR-DOS, if
it is not. In HL placed 23,746.
15649 CALL 12787; to check if the field of system variables

      NOP

      NOP

      CALL C, 15,692, and if it does not exist, then create it

      LD HL, 23746; loading in HL address switch ROM BASIC

      RET; Returns

Address 15663. Switching ROM TR-DOS and the transition to any 
address. The address put on the stack.

15663 NOP

      RET

Address 15665. Log in TR-DOS.
15665 CALL 15649; creation of system variables

      PUSH HL; room on the stack address switch ROM BASIC

      JP 569, the entrance to the TR-DOS

Address 15672. Checking for Interface 1. In the case of 
detection is the creation of its system variables and put in 
23,793 1. For routine work should be moved to any place in RAM.

15672 XOR A; interface-1 is?

      OUT (247), A

      IN A, (247)

      CP 1930

      JR Z, 15,684, and if so, the establishment of its system 
variables 

      CP 1931

      RET NZ; if not, return
15684 RST 8; creation of system variables interface-1

      DEFB # 31

      LD A, 1; team-SAVE to record a copy of

      LD (23791), A

      RET; Returns

Address 15692. Creating a system variable TR-DOS. In the 
presence of UI-1 before creating the variables TR-DOS are its 
variables and placed 23,791 1. In the variables TR-DOS are 
placed: at 23802 - 23804, 23752 - 23754, 23610, 23830 and 23820 
- 255; at 23831, 23833, 23832, 23823 and 23839 - 0;

at 23746 - 201.
Also placed in the system registry 255, and the command issued 
VG93 interrupts. Sub-corrupts memory calculator.

15692 XOR A; choose drive A: and Reset VG93

      OUT (255), A

      IN A, (246), it does nothing

      LD HL, 15672; e routines check for the interface-1

      LD DE, 23698, of any free address, RAM

      LD BC, 20; length routines

      LDIR; transfer routines in RAM

      LD HL, 15719; return address from subroutine

      PUSH HL; putting it on the stack

      LD HL, 15663; address switch ROM TR-DOS

      PUSH HL; putting it on the stack

      JP 23698; launch routines

Address 15719. Creating a system variable TR-DOS. In the 
variables fit:

at 23802 - 23805, 23752 - 23755, 23610, 23830 and 23820 - 255;
at 23831, 23833, 23832, 23823 and 23839 - 0;
at 23746 - 201.
Also placed in the system registry 255, and the command issued 
VG93 interrupts.

15719 LD HL, 12176; return address from the ROM BASIC

      PUSH HL; putting it on the stack

      LD HL, 15663; address switch ROM TR-DOS

      PUSH HL; putting it on the stack

      LD HL, 5717; address MAKE_ROOM routines from the ROM BASIC

      PUSH HL; putting it on the stack

      LD HL, 23551; address switch ROM BASIC

      PUSH HL; putting it on the stack

      LD (HL), 201; room in RAM, command RET

      LD HL, 23773; starting address of the system variables

      LD BC, 112; the length of its

      RET; launch sub MAKE_ROOM

Address 15744. Newline. It is also used to address 15746
(Print characters from the battery). Also, this routine 
incorrectly used to address 15,755 subroutine 1270.

15744 LD A, 13; symbol ENTER
15746 PUSH HL; preservation registers

      PUSH BC

      PUSH DE

      PUSH AF; preserve the character

      CALL 8433; change memory

      POP AF; recovery of the symbol
15754 CALL 15764; print symbol

      CALL 8433; recovery of memory

      POP DE; restore registers

      POP BC

      POP HL

      RET; Returns

Address 15764. Print a character without changing the memory. 
Put symbol in the battery.

15764 RST 32

      DEFW # 0010

      RET

Address 15768. Recovery with the expectation INTRQ. Used as
15,770 addresses (output of the command reg. A, with the 
expectation INTRQ). 15768 LD A, 8; recovery

15770 OUT (1931), A
15772 PUSH HL; conservation HL

      RST 32; test pressing BREAK

      DEFW # 1F54

      JR C, 15,781, and if pressed, the message is * BREAK *

      RST 1932

      DEFW # 1B7B
15781 POP HL; recovery HL

      IN A, (255); INTRQ enrolled?

      AND 128

      JR Z, 15,772, and if not, then repeat

      RET; Returns

Address 15789. Check availability of the disk in the drive. No 
plants is not required.

15789 LD A, 8; restore command

      CALL 15770; issuing commands and expecting INTRQ

      LD DE, 0; for 65,536 passes of the index signal must 
change 

      IN A, (31), we take the index signal for the sample

      AND 2

      LD B, A; memorize it
15802 IN A, (31), and take it again

      AND 2

      CP B; it changed?

      RET NZ; if so, return

      INC DE; next attempt

      LD A, E; attempts to come to an end

      OR D

      JR NZ, 15,802, and if not, then repeat

      JP 16103, the processing error NO DISC

Address 15816. The choice of drive specific defaults. Login:
You can set the time for moving the head and the drive mode
according to the description of team # 01. Yield: these 
variables can be changed according to this description. It is 
also used to address: 15,819 - to select the drive. Number set 
in the reg. A, the rest as for the previous routine.

15,869 - delay in 725,779 cycles.
15,871 - delay of any desired length. In Reg. A set
number that determines the duration of the delay.

15816 LD A, (23833) take the number of drive by default
15819 LD (23798), A; setting numbers selected drive

      LD HL, 23830; drive select

      LD C, A

      LD A, 60

      OR C

      OUT (255), A

      LD (HL), A

      CALL 15880; take the move drive heads

      AND 128, bit 7 is off?

      JR Z, 15,866, and if so, do not perform the initialization

      CALL 15789; to check if a disk in drive

      CALL 15894; the timing of movement of drive heads

      CALL 15889; take a drive type

      CP 255; in this variable, 255?

      JR Z, 15,866, and if so, do not define it

      PUSH HL; store address of a variable with the type of 
drive 

      CALL 8138, the definition of the number of tracks the 
drive 

      POP HL; restore address of a variable of type

      CP 80; setting this variable

      LD A, 0

      JR NZ, 15865

      LD A, 128
15865 LD (HL), A

Warning, Error! Not checked the drive and the number of parties
assumes that it is unidirectional.

15866 CALL 7734; check the index of the disk
15869 LD A, 0; delay in 725779 ticks
15871 LD C, 255
15873 DEC C

      JR NZ, 15873

      DEC A

      JR NZ, 15871

      RET; Returns

Address 15880. Sampling time moving the head of the current 
drive. Set 23798. At the output of A will have time to move

drive heads, and HL - address to which it is located.
It is also used to address 15,883 (sampling parameter, the 
drive; DE address in place table settings, and set 23798; On

output of A is a parameter in the HL - address of the cell).
15880 LD DE, 23802, take the address of the table travel speed 
heads 15883 LD HL, (23798), the offset is the drive number


      ADD HL, DE; address calculation of the cell with the 
parameter 

      LD A, (HL); take out option

      RET; Returns

Address 15889. Sample type drive. Input: Set 23798. Output:
A type of drive in HL - address of his cell.
15889 LD DE, 23752, take the address of the table types of disk 
drives 

      JR 15883; selection option and returns

Address 15894. Determination of the time moving drive heads.
15894 CALL 15880; take the address of the cell with the time of 
moving the head 

      LD B, 8, start with the smallest

      LD C, 4, 4 attempts
15901 LD (HL), B; installation time moving the head

      LD A, 8; recovery

      CALL 15770

      LD A, 32, positioned on track 32

      LD B, 11

      CALL 15940

      LD B, (HL); take time moving the head

      LD A, 1; positioning on the track 1 with a given time

      CALL 15940

      IN A, (31), and head to the track 0?

      AND 4

      JR NZ, 15935 and, if so, the error

      XOR A; positioning on track 0

      IN A, (31), and head to the track 0?

      AND 4

      RET NZ; if so, return
15935 INC B; increased time moving the head at 1

      DEC C; next attempt

      RET Z; if you attempt to run out, then return

      JR 15901; repeat

Address 15940. Positioning. A place in the physical number of
paths in B - while moving the head and then away.
15940 OUT (127), A; room track number in the data register

      LD A, B; receive positioning commands

      OR 24

      JP 2048 positioning, with fast speed

Attention! Here it is necessary JP 15,070, as Quench rate of 
2048 bits moving head disk drive, thus positioning

only works with fast speed.

Address 15948. Positioning. At the entrance to A must be a 
physical track number, and B - the move drive heads.

15948 OUT (127), A; download track number in the data register

      PUSH BC; saving time, moving the head drive

      LD B, A; head is already positioned?

      IN A, (63)

      CP B

      POP BC; recovery time moving the head

      PUSH AF; preservation of the check result

      LD A, B; receive positioning commands

      OR 24

      CALL 2048 conversion and issuance of command and waiting 
INTRQ 

Attention! Positioning is carried out only with quick
velocity of the head, because in 2048 used AND 252.
To remedy the situation here you need to put JP 15770.


      POP AF; restoration of the check result of head

      RET Z; if the head was positioned, then return

      PUSH BC; saving time, moving the head?

      CALL 15869; delay in 725779 ticks

      POP BC; recovery time moving the head

      RET; Returns

Address 15971. Positioning drive heads. Entry: in reg. A
set the logical number of the desired track, and set
23757. The output of 23 757 is reset. It is also used to address
16032 (delay in 2,168,937 cycles).
15971 LD C, A; download track number in the register C

      CALL 8171; choice of the upper side of the disc

      CALL 15889; take a drive type

      AND 2, the drive-way?

      CALL NZ, 16042 and, if so, then the choice of

      PUSH BC; keep track number

      BIT 7, (HL); drive 40-track?

      JR Z, 16,003, and if so, the track numbers do not change

      BIT 0, (HL); use only 40 tracks?

      JR NZ, 16,003, and if not, the track numbers do not change

      IN A, (63), we take the current track number

      CP C; head is already positioned?

      JR Z, 16,002, and if so, the track numbers do not change

      RLCA; divide the current track number 2

      OUT (1963), A

      LD A, C; divide the number of the desired track by 2

      RLCA
16002 LD C, A
16003 CALL 15880; take the move drive heads

      LD B, A

      IN A, (63); head is positioned?

      CP C

      PUSH BC; keep the number of the desired track

      CALL NZ, 15 869, if the head is not positioned, then the 
delay in 725779 

                    tick

      POP BC; recovery rates to the desired track

      LD A, C

      CALL 15948; positioning

      POP BC; recovery rates to the desired track

      LD A, C; setting register tracks

      OUT (1963), A

      LD A, (23757) need a delay after the operation?

      OR A

      RET Z; if not, return

      XOR A; the next time the delay is not required

      LD (23757), A
16032 LD B, 3; delay in 2,168,937 cycles
16034 LD A, 255

      CALL 15871

      DJNZ 16034

      RET; Returns

Address 16042. The choice of positioning. Entry: in the C place
logical track number and select the top side of the disc.
Exit: to be chosen by the parties in C would be a physical 
track number. 16042 LD A, C; fission track number 2


      OR A

      RRA

      LD C, A

      RET NC; if the track number was even, then return

      JP 8182, otherwise choose the lower side of the disc

Address 16050. Check the index of the track. Set
23761 and put it in B while moving drive heads. Chosen
upper side and the error in 23,831 is placed 255. In the case
H fits the current track number. It is also used to address
16103 (processing error NO DISC).

16050 CALL 8171; choice of the upper side of the disc

      IN A, (31) take the state controller

      AND 128; saving flag ready

      LD (23757), A

      IN A, (63), we take the current track number

      LD H, A; in case of return

      CALL 15940; transformation and the command of the Reg. B

Attention! CALL before 15,940 in the case B should be placed 
during moving head disk drive, or command to be executed

before testing depends on the contents of the register B at the 
entrance to subroutine and the consequences can be quite 
disastrous. 


      LD C, 127; address data register

      LD D, 1, specifying the number of attempts

      DI; ban interrupt

      LD A, 192; reading the index of

      OUT (1931), A

      PUSH BC; saving address data register

      LD B, 3; determine the number of attempts
16078 IN A, (255), take the condition of the signals DRQ and 
INTRQ 

      AND 192

      JR NZ, 16144; if any signal was sent, then start reading

      INC DE; next attempt

      LD A, E

      OR D

      JR NZ, 16078

      DJNZ 16078; repeat until the end of attempts

      POP BC; recovery register address data

      EI; permission to interrupt

      LD A, 208; stop controller

      OUT (1931), A

      LD A, (23761), ignore the error?

Error! Must LD A, (23831).


      CP 255

      RET Z; if so, return
16103 CALL 10027; installation TAPE LOADING ERROR

      LD A, 255, the next time a mistake to ignore

      LD (23831), A

      JP 10011, the processing error NO DISC
16114 POP BC; recovery register address data
      IN H, (C); reading first byte
16117 IN A, (255), the expectation of a signal

      AND 192

      JR Z, 16117

      EI; in case of return

Error! So it is possible to lose bytes when reading.


      RET M; if entered INTRQ, then return

      DI; ban interrupt

      IN A, (127) Read byte

      JR 16117; repeat

Address 16130. Needs no comment.
16130 LD (23807), A

      RET

Address 16134. Similar to the previous one.
16134 LD (23808), HL

      RET

Address 16138. Recording sector. Spozitsioniruyte head, and 
then 23,807 and 23,808. 16138 LD A, 160; team record sector


      JR 16144; go to subroutine read / write sector

Address 16142. Loading the sector. Set 23807 and 23808 and 
spozitsioniruyte head. It is also used to address 16144 (Load / 
write sector set for all 16,142 plus in the A place the command 
to read or write sector). 16142 LD A, 128; read command sector

16144 LD (23806), A; installation team
16147 LD D, 10, 10 attempts
16149 PUSH DE; conservation counter attempts

      DI; ban interrupt

      LD A, (23807); installation sector

      INC A

      OUT (127), A

      LD HL, (23808) take the address of the read / write

      LD C, 127; take the address of the data register

      LD A, (23806) instructs

      OUT (1931), A

      CP 160; was a team record industry?

      PUSH AF

      CALL Z, 16,314, and if so, then write data

      POP AF

      CALL NZ, 16341, otherwise read the data

      POP DE; recovery counter attempts

      EI; permission to interrupt

      IN A, (31) take the state controller

      LD B, A; save it

      AND 127; all right?

      RET Z; if so, return

      LD HL, 10712; mail messages READ ONLY

      AND 64; banned account?

      JR NZ, 16203 and, if so, then go on processing errors

      LD A, B; restoring the state controller

      AND 4, was the loss of data?

      JR Z, 16,288, and if not, the processing of disk errors

      DEC D; next attempt

      JR NZ, 16,149, and if efforts are not over, then repeat
10200 LD HL, 10722; mail messages DISC ERROR
16203 LD A, 208; command interrupt

      OUT (1931), A

      LD A, B; restoring the state controller

      AND 1, the controller was busy?

      JP NZ, 16103 and, if so, the treatment situation, NO DISC

      IN A, (63), if an error occurs in sector 10 tracks

      OR A; 0 then return (ignoring)

      JR NZ, 16223

      IN A, (127)

      CP 10

      RET Z

      PUSH HL; conservation message address

      CALL 7575; clear screen

      POP HL; recovery message address

      RST 24; print a message

      LD HL, 10771; print TRK:

      RST 1924

      IN A, (63); print track number

      CALL 7587

      LD HL, 10776; Printing SEC:

      RST 1924

      IN A, (95); printing facilities sector

      CALL 7587

      LD HL, 10750; press RETRY, ABORT, IGNORE?

      RST 1924
16251 CALL 4178; input keys

      CP "I"; pressed I?

      RET Z; if so, return

      CP "R"; pressed R?

      JR Z, 16,276, and if so, repositioning and repeat

      CP "A"; pressed A?

      JR NZ, 16,251, and if not, then re-enter the keys

      CALL 10027; installation TAPE LOADING ERROR

      LD A, 7; disk error

      LD (23823), A

      JP 467; completion
16276 LD A, (23797); repositioning

      CALL 15971

      CALL 16032; delay in 2,168,937 cycles

      JP 16149; repeat

Error! It is necessary to JP 16147 to update the number of 
attempts. 

16288 DEC D; next attempt

      JP Z, 16,200, or if attempts have ended, then processing 
DISC ERROR 

      PUSH DE; conservation counter attempts

      CALL 15880; take the move drive heads

      AND 2, it equals 10?

      JR NZ, 16301

      INC (HL); if not, then increase it by 1
16301 CALL 15768; recovery

      LD A, (23797); repositioning

      CALL 15971

      POP DE; recovery counter attempts

      JP 16149; repeat

Address 16314. Writing data to disk. Set in the HL block address
data, DE - specifying the number of cycles during which
to begin recording in C - address of data register controller
and give the team record. It is also used to address 16330 (the
Same as 16314, but without treatment NO DISC).

16314 LD B, 4; set number of attempts
16316 IN A, (255); received any signal?

      AND 192

      JR NZ, 16337 and, if so, then start recording

      INC DE; next attempt

      LD A, E

      OR D

      JR NZ, 16316

      DJNZ 16316

      RET; if you attempt to run out, then return
16330 IN A, (255); received any signal?

      AND 192

      JR Z, 16,330, and if not, then wait for it

      RET M; if entered INTRQ, then return
16337 OUTI; output bytes from your area in the data register

      JR 16330; repeat

Address 16341. Reading data from disk. All plants are similar
subroutine 16314, but need to give read command. Used
also addresses 16357 (same as 16341, but without treatment
NO DISC).

16341 LD B, 4; set number of attempts
16343 IN A, (255); received anything?

      AND 192

      JR NZ, 16,364, and if so, begin to read

      INC DE; next attempt

      LD A, E

      OR D

      JR NZ, 16343

      DJNZ 16343

      RET; if you attempt to run out, then return
16357 IN A, (255); received any signal?

      AND 192

      JR Z, 16,357, and if not, then wait for it

      RET M; if INTRQ, then return

      INI; reading bytes

      JR 16357; repeat





Other articles:

Business Card - an overview of electronic journals for the ZX Spectrum.

Computer novella - In the game "The Saga"

Computers, we choose - Finalization of the computer "ATM-TURBO".

Spectrum in School - an article on numerical methods, "Seidel method for solving the linear.

Entry - greetings from the Editor.

New Programs - copier ABCDcopy and utility for formatting floppy disks Floppy Format.

Forum - questions and answers on games: Jungle Warrior, Buratino, Streaker, Paris Dakar, Bloodwych, Hero Quest, Apollo, Cliff Hanger, Cyber Hordes, Paradise Valley, Star Drive, Laser Platoon, Movie, Where Time Stood Still, The Sceptre, Carrier Command, etc.

Expert Tips - the strategic game Wellingsto at Waterloo.

Expert Tips - the strategic game of Napoleon.

Expert Tips - for the game Star Fox.

Crossing Dragon - Dungeons & Dragons (the first chapter of a book on adventyurnyh games).

TR-DOS for beginners - 5 th chapter of the book "General information on the disk system TP DOS.

Returning to the printed - the last file dizzasemblera TR-DOS.

reader-reader - On the hardware, software and Other Computer Profi ...

reader-reader - Recover lost data.

reader-reader - Spectrum and expert systems.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Advertising - the motor trade.

В этот день...   21 November