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

City #51
    ░░░     ░░░░  ░░░░  ░░░░ ░░░░░ ░░░░▒▒▒▒░ ░░░░▒▒▒▒░  ░▒▒▒░
   ▒▓█▒    ░▓█▓░ ░▓█▓▓  ▒█▓▓ ▓▓█▓░ ▓▓█▓█▓█▓░ ▒▓█▓█▓█▓  ▒▓█▓█▓░
  ░▓█▓▓    ▒█▓▓░ ▒▓▓█▓ ░█▓▓▓▒▓▓▓░ ░██▓▓▓█▓█  ▓▓▓█▓▓▓▓  ▓█▓▓▓█▓░
  ▓█▓█▓░   ▓▓█▓░░█▓█▓▓ ▒▓█▓▓▓█▓▓  ▒█▓█▓█▓█▓  ▓▓█▓█▓█▒  ▒▓▓▒█▓█░
  ░▓█▓▓▒    █▓▓░▓▓▓▓█▓  ▒▓▓▓█▓▓░   ▒█▓▓       ▓▓█░      ░░░▓█▓░
  ▒█▓█▓▓    ▓█▓▓▓█▓█▓▓  ▒█▓█▓█▒    ▒▓█▓░▒▒░   ▓█▓▒▒▒▒    ░▓█▓▓
  ▓▓█▓▓▓░   █▓▓▓█▓▓▓█▓  ▒▓▓▓█▓▒    ▒█▓▓▓█▓▓░  ▓▓█▓▓▓▓    ▒▓▓▓░
 ░▓█▓▒▓█▒   ▓█▓█▓█▓█▓▓  ▒█▓█▓█▓░   ▒▓█▓▓▓█▓▓  ▓█▓▓▒▒▒    ░▓█▓▓░
 ▒▓▓▒░▓▓▓   █▓▓▓█▒▒▓█▓  ▒▓▓▓█▓▓▒   ▒█▓▓ ▓▓▓▓░ ▓▓█░     ░░ ░██▓▓
░▓▓█░ ▓█▓░  ▓█▓█▓░▒█▓█▒ ▒█▓▓▒█▓█░  ▒▓█▓ ▒█▓█░ ▓█▓█▓█▓░░▓▓▓▓█▓█▓
▒▓▓▓  ▒▓█▓  █▓▓▓░ ▒▓█▓░ ▒▓▓▓░▓▓▓▓  ▒█▓▓▓█▓▓▓  ▓▓█▓▓▓█ ▓▓█▓▓▓█▓▒
▒█▓▒  ░█▓▓░ ▓█▓▓  ▒█▓▓  ▒█▓▓ ▒▓█▓░ ▒▓█▓█▓█▓░  ▓█▓█▓█▓ ░▓▓█▓█▓▓░
░░░░   ░░░░ ░░░░  ░░░░  ░░░░  ░░░░ ░░░░░░░    ░░░░░░░   ░░░░░

  (c) П.Федин

  ПОЛНОЕ ОПИСАНИЕ + ПОЛНЫЙ ДИЗАССЕМБЛЕР ПЗУ TR-DOS 5.04 (5.03)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ДЛЯ ПРОФЕССИОНАЛОВ, А ТАКЖЕ ДЛЯ ТЕХ, КТО ХОЧЕТ ИМИ СТАТЬ
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
continuation

Address 8138. Determination of the number of drive tracks. Login: us-
Set the drive head movement time.  Exit: at 23767 and
Register A will be the number of tracks on the drive.
8138 CALL 15880 ;take the time of head movement
 OR 17 ;positioning to track 50
      LD B,A
      LD A,50
      CALL 15940
      LD A,2 ;then to track 2
      CALL 15940
      CALL 15869 ;delay 725779 cycles
      IN A,(31) ;head in initial position?
      AND 4
      LD A,80; if not, then the drive has 80 tracks
      JR Z,8167
      LD A,40;otherwise 40
8167 LD (23767),A;setting the number of tracks
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 8171. Select the top side of the disk.  Set 23830. Use
also used from address 8176 (loading the system register,
code is in the battery).  You can also use from address
8179 for direct output to port 255.
8171 LD A,(23830);take a copy of the system register
 OR 60 ;MFM format, top side, reset offsa and readiness
8176 LD (23830),A; remember a copy of the system register
8179 OUT (255),A ;set system register
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 8182. Select the bottom side of the disk. Set to 23830.
8182 LD A,(23830);take a copy of the system register
 AND 111 ;MFM format, bottom side, reset off
                   sa and readiness
      JR 8176 ;setting the system register
───────────────────────── ─────────────────── ────────────────────
Address 8189. Track formatting. Place it in register E
measures and position the drive head. From the variables set-
those 23768, 23782, 23784 and reset to zero 23766. Also used with
addresses 8137 (track check; set 23768, 23784 and reset -
those 23766 and position the head).
8189 DI ;interrupt disable
 LD A,244 ;track recording
      OUT(31),A
      LD HL,(23782); take the address of the sector table for formatting
                    vania
      LD C,127 ;data register address
8199 LD B,10;10 times 78 (first space)
      LD D,78
      CALL 8369 ;write byte a specified number of times
      LD B,12 ;sync gap
      LD D,0
      CALL 8369
      LD B,3 ;sync pulse
      LD D,245
      CALL 8369
      LD D,254 ;1 times 254 (identifier address label)
      CALL 8367 ;write byte 1 time
      LD D,E ;track number
      CALL 8367
      LD D,0 ;side number (always 0 in TR-DOS)
      CALL 8367
      LD D,(HL) ;sector number from the table
      CALL 8367
      LD D,1 ;sector length - 256 bytes
      CALL 8367
      LD D,247 ;write checksum
      CALL 8367
      LD B,22 ;second space
      LD D,78
      CALL 8369
      LD B,12 ;sync gap
      LD D,0
      CALL 8369
      LD B,3 ;sync pulse
      LD D,245
      CALL 8369
      LD D,251 ;data address label
      CALL 8367
      LD B,0 ;data (256 zeros)
      LD D,0
      CALL 8369
      LD D,247 ;write checksum
      CALL 8367
      LD B,60 ;third space
      LD D,78
      CALL 8369
      LD A,(HL); take the address of the next sector number
      INC HL
      CP 16 ;end of table ?
      JR NZ,8199;if not, then format the next sec-
                    torus
      LD B,0 ;space to end of track
      CALL 8369
      JP M,8310
      CALL 8369
8310 IN A,(31) ;takecontroller state
      AND 64 ;recording prohibited?
      JP NZ,16185 ;if yes, then message READ ONLY
8317 LD A,(23768) ;check the track?
      OR A
      RET NZ ;if not, then return
Attention!!! Before returning or exiting by mistake, you must authorize
interrupts.

 to be continued...

Share your thoughts about the article