Educational program - complete description and complete disassembler of the TR-DOS ROM (continued).

City #45
 @@@ @@@@
            @@@
           @@@
           @ @ @ @ @ @@ @@@@ @@@ @@@
           @ @ @ @ @@@ @ @ @ @ @ @ @
           @ @ @ @ @ @ @ @@ @@@@ @ @
        @ @ @ @ @ @@ @ @ @ @ @ @ @@
         @@ @@ @@@ @@ @ @@ @@@@ @@@@ @
                                                  @@@@
                                                 @ @
(c) P. Fedin  @@@@

  FULL DESCRIPTION + FULL ROM DISASSEMBLER TR-DOS 5.04 (5.03)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 FOR PROFESSIONALS, AND ALSO FOR THOSE WHO WANT TO BECOME THEM
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 continued

Address 7332. Determination of the address of the file descriptor in the buffer by its
number in the sector. In C there must be a descriptor number in the sector. On
the exit to HL will be his address.
7332 LD L,C ;translation of file descriptor number todouble-byte
 LD H,0 ;shape
      ADD HL,HL ;multiplying it by 16
      ADD HL,HL
      ADD HL,HL
      ADD HL,HL
      LD BC,23845;address from the beginning of the buffer
      ADD HL,BC
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 7344. Setting and checking the file name. The file name should
to be placed on the calculator stack. Output: if a file with this
name, the Z flag will be set, and in reg. C and at 23838
will be its number, and if there is no such file, then the Z flag will be reset.
Also used from address 7347 (file search, install 23773
and 23781, exit as from 7344).
7344 CALL 7255 ;setting the file name
7347 CALL 1000 ;let's start from sector 0
      LD B,128 ;total 128 files
      LD C,0 ;start with the zero descriptor in the sector
7354 PUSH BC ;save file number and counter
      CALL 7332 ;detect the beginning of the descriptor in the buffer
      CALL 1292 ;checking and processing reaching the end of the buffer
      POP BC ;restoring the descriptor number in the sector and
      PUSH BC ;file counter without changing the stack
      LD A,C ;all sector viewed?
      CP 16
      JR NZ,7373;if yes, then
      POP BC ;removing descriptor number andcounter from stack
      LD C,0 ;zero descriptor in sector
      JR 7354 ;retest
7373 LD DE,23773 ;take the address of part of the descriptor for verification
      LD A,(23814);take the length of this part
      LD B,A
      XOR A ;end of directory ?
      CP(HL)
      JR NZ,7387 ;if not, then proceed to checking the descriptor
      POP BC ;Pop handle and counter number from stack
      JR 7396 ;output with NZ flag
7387 CALL 10003 ;comparing parts of descriptors
      POP BC ;restore descriptor and counter number
      JR Z,7399 ;if parts of the descriptors match, then exit
      INC C ;next descriptor
      DJNZ 7354 ;repeat to end
7396 OR 255 ;turn off flag Z
      RET ;return
7399 LD A,128 ; file number determination
      SUB B
      LD C,A
      LD (23838),A; placing it in 23838
      XOR A ;reset flag Z
      RET Z ;return
───────────────────────── ─────────────────── ────────────────────
Address 7408. File search. The portion of the descriptor to be verified is
install to address 23773 and install to 23814. If the file is not
is found, then the Z flag will be reset and 23823 will be 255, and if found
den, then the Z flag will turn on, and the file number will be in reg. C and hello
resam 23823 and 23838.
7408 CALL7347 ;file search
 LD HL,23823
      LD (HL),C ;load register C into 23823
      RET Z ;if file found, return
      LD (HL), 255; place in 23823 255
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 7419. Executing the RETURN command. Install 23611, 23836 and
23827.
7419 CALL 7541 ;if there is a syntax check, then return
 CALL 8421 ;memory change
      RES 3,(IY+1) ;set input mode "K"
      CALL 562 ;restore old ERR_SP
      LD SP,(23836);stack recovery
      LD HL,(23613);take the address before the address from ERR_SP
      DEC HL
      LD A,18;is there 18?
      CP(HL)
      JR NZ,7449 ;if not, then return
      DEC HL ;set ERR_SP to the address below
      LD (23613),HL
7449 RET ;return

 to be continued...

Share your thoughts about the article

No comments yet.