Educational program - FULL DESCRIPTION + COMPLETE ROM DISASSEMBLER TR-DOS 5.04 (5.03).

City #50
 @@@ @@@@
 @ @ @
           @@@
           @ @ @ @ @ @@ @@@@ @@@ @@@
           @ @ @ @ @@@ @ @ @ @ @ @ @
           @ @ @ @ @ @ @ @@ @@@@ @ @
        @ @ @ @ @ @@ @ @ @ @ @ @ @@
         @@ @@ @@@ @@ @ @@ @@@@ @@@@ @
                                                  @@@@
                                                 @ @
(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 7852. Calculation of the number of complete sectors of a file from its
length in bytes. A should be the number of sectors of the file, andDE - length of the downloaded part of the file.
7852 PUSH HL ;save HL
 LD H,A ;take the full file length
      LD L,0
      PUSH HL ;save it
      SBC HL,DE ;is it less than the loading length?
      CALL C,7868;if yes, then download the entire file
      POP HL ;restore full file length
      LD A,H ;calculation of the number of full sectors from half-
                 no file length
      POP HL ;restore HL
      RET C ;if the total length of the file is greater than the download length,
      LD A,D ;then we take the number of full sectors from the length
                  downloads
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 7868. Resetting 23766 and setting flag C.
7868 XOR A
LD (23766),A
      SCF
      RET
───────────────────────── ─────────────────── ────────────────────
Address 7874. Executing the FORMAT command. Install 23825 and 23611.
Also used from address 7901 (repeat formatting; set-
vite 23773).
7874 LD HL,65535
LD(23767),HL;do not check tracks
      LD (23769),HL; format one side of the disk
      LD (23761),HL; error when reading address marker ignore-
                    to sleep
      CALL 1067 ;next character ENTER ?
      JP Z,7450 ;if yes, then error
      CALL 7647 ;receiving disk name onto calculator stack
      CALL 7541 ;if there is a syntax check, then return
      CALL 7255 ;set disk name
7901 CALL 12800 ;select fast or regular format
      AND 128; 40-track disk drive?
      LD A,40 ;format 40 tracks
      JR Z,7192 ;if the drive is 80-track,
      LD A,80 ;then format 80 tracks
7192 LD (23767),A ;setting the number of tracks
      CALL 15768 ;recovery
      CALL 8182 ;select the bottom side of the disk
      CALL 16032 ;delay 2168937 cycles
      LD E,1 ;formatting track number 1
      CALL 8189
      CALL 8171 ;select the upper side of the disk
      LD E,0 ;formatting track number 0
      CALL 8189
      LD A,(23773) ;format only one side of the disk
      CP "$"
      JR Z,7963; if yes, then format the disk
      CALL 8182 ;select the bottom side of the disk
      CALL 16032 ;delay 2168937 cycles
      CALL 16053 ;read address marker
      LD A,H;track number - 1?
      CP 1
      JR NZ,7963 ;if not, then formattingdisk
      LD A,128 ;format both sides of the disk
      LD (23770),A
7963 CALL 8381 ;formatting disk
      LD HL,23845 ;buffer start address
      LD (HL),0 ;clear first byte
      LD DE,23846 ;address of the second byte of the buffer
      LD BC,255 ;255 bytes left to clear
      LDIR ;buffer clear
      LD BC,23767 ;variable address with number of tracks
      LD DE,23770 ;variable address with number of sides
      LD A, (BC); formatted 80 tracks?
      CP 80
      JR Z,8009; if yes, then the disc is 80-track
      LD A,(DE) ;formatted 2 sides?
      CP 128
      JR Z,8002; if yes, then the disc is 40-track double-sided
      LD A,25; disc 40-track single-sided
      LD HL,624; 624 sectors free
      JR 8021 ;create disk descriptor
8002 LD A,23; 40-track double-sided disc
8004 LD HL,1264;1264 sectors free
      JR 8021 ;create disk descriptor
8009 LD A,(DE) ;formatted 2 sides?
      CP 128
      LD A,24; if not, then the disc is 80-track single-sided
                    ny
      JR NZ,8004
      LD A,22; otherwise 80-track double-sided disc
      LD HL,2544; 2544 sectors free
8021 LD (24072),A ;disk type setting
      LD (24074),HL; setting the number of free sectors
      LD A,1 ;first free track - 1
      LD (24071),ALD A,16; sign that the disk belongs to TR-DOS
      LD (24076),A
      LD HL,24079 ;9 bytes 32 from address 24079
      LD DE,24080
      LD BC,8
      LD (HL),32
      LDIR
      LD HL,23773 ;setting the disk name
      LD DE,24090
      LD BC,8
      LDIR
      CALL 8171 ;select the upper side of the disk
      LD B,1 ;write 1 sector
      LD DE,8 ;sector 8 track 0
      LD HL,23845 ;from buffer
      CALL 7778 ;write sector
      LD A,(23766) ;take the number of defective sectors
      PUSH AF ;save it
      XOR A ;extension - CHR$ 0
      CALL 12996 ;installing an extension and cleaning the bottom of the screen
      LD HL,(24074);take the number of free sectors
      LD (23767),HL; save it
      LD HL,23773 ;print disk name
      RST 24
      LD A,13 ;line feed
      RST 16
      LD HL,(23767);restoring the number of free sectors
      POP AF ;restoring the number of bad sectors
      PUSH HL ;save the number of free sectors
      LD D,0 ;translation of the number of defective sectors into
      LD E,A ;double-byte form
      SBC HL,DE ;calculate the number of good sectors
      LD B,H ;transfer it to BC
      LD C,L
      CALL 7593 ;print it
      LD A,"/" ;print "/"
      RST 16
      POP BC ;restoring the number of free sectors
      CALL 7593;print it
      JP 12907 ;request formatting
───────────────────────── ─────────────────── ────────────────────
Address 8121. Sector table for formatting a regular disk.
Also used from address 8122 to check the track.
8121 DEFB 1
8122 DEFB 9,2,10,3,11,4,12,5,13,6,14,7,15,8,16,1

 to be continued...

Share your thoughts about the article