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

City #53
        ░░░    ░░░  ░░░░ ░░░░ ░░░░ ░░░░░▒░ ░░░░░░▒░  ░▒░░
       ░▓█▒   ░███  ▓██▒ ▒██▓▒██▓░░██████▒ ▒██████░ ▓████▒
      ░▓██▓░  ▒███ ▒███▒ ▓██▓▓██░ ▒██████▒ ▒█████▓ ░▓█▓███
      ░▓███▒  ░███▒████▒ ▒█████▒  ░███░░░░ ░███░░░  ░░░▓██
      ░██▓█▓   ████████▒ ░████▓    ███▒▓▓▒  ███▓▓▓    ▓██▒
      ▒██▒██░  █████▓██▒ ░█████▒   ███▓███░ ███▒▒▒    ▓██▓░
     ░██▓ ▓█▓  ████▓░██▓░░██▓▓██░  ███ ▓██▒ ███▒▒▒░░▒▒░▓██▒
     ▒██░ ▒██░ ███▓░░██▓ ░██▓▒██▓░ ███▓███▒ ██████░▓██████░
     ▓▓▓  ░▓▓▒ ▓▓▓░ ░▓▓▒ ░▓▓▒ ▒▓▓▒ ▓▓▓▓▓▒░  ▓▓▓▓▓▓ ░▒▓▓▓▓▒

  (c) П.Федин

  ПОЛНОЕ ОПИСАНИЕ + ПОЛНЫЙ ДИЗАССЕМБЛЕР ПЗУ TR-DOS 5.04 (5.03)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ДЛЯ ПРОФЕССИОНАЛОВ, А ТАКЖЕ ДЛЯ ТЕХ, КТО ХОЧЕТ ИМИ СТАТЬ
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          продолжение

Адрес 8501. Принятие команды. Установите 23823 и если  там не 0,
то и 23840.
8501  LD A,(23823) ;ошибка была?OR A
      PUSH AF ;save test result
      CALL NZ,8490;if yes, then restore the first three sim-
                    oxen
Don't do this!!! COPY corrupts the buffer at address 23840, and
The editor's ferrule always remains intact.
      POP AF ;restoring test result
      CALL Z,8478 ;if there was no error, then erase the old one
                    lines
      LD HL,(23641); this command is also not needed
      CALL 15744 ;line feed
      LD A,(23833) ;take the default drive number
      ADD A,"A" ;print his name
      RST 16
      LD A,">" ;print ">"
      RST 16
      LD HL,23610 ;for normal exit from the editor
      LD (HL),255
      JP 7568 ;command input and return
───────────────────────── ─────────────────── ────────────────────
Address 8536.  Receiving a number.  CH_ADD set to the character before
number. A number increased by 1 will be placed in 23767, and co-
held 23771 will be copied to 23769. The number must not be equal to
bother 0.
8536 CALL 7722 ;next character
      CALL 7564
      CP "," ;is this a comma?
      JP NZ,7450 ;if yes, then error
      LD HL,(23771);save 23771
      LD (23769),HL
      CALL 7691 ;putting a number on the calculator stackCALL 7541 ;if there is a syntax check, then return
      LD HL,(23771);is the number equal to 0?
      LD A,
      OR L
      JP NZ,7450 ;if yes, then error
      INC HL ;there will also be an ENTER byte
      LD (23767),HL;setting the number
      LD HL,(23769);recovery 23771
      LD (23771),HL
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 8578. Executing the OPEN# command.  Install 23825 and 23611.
8578 LD HL,(23825);install CH_ADD
      LD (23645),HL
      CALL 7691 ;accept thread number
      CALL 7632 ;accepting file name onto calculator stack
8590 CALL 7564 ;take the current character
      CP "A";is it smaller than "A"?
      JR NC,8602; if not, then check the file mode
      CALL 7722 ;next character
      JR 8590 ;repeat
8602 CP 165 ;is this RND?
      PUSH AF ;save symbol and test result
      CALL Z,8536 ;if this is RND, then record length processing
      POP AF ;restore character and check result
      JR Z,8622 ;if this is RND, then open the stream
      AND 223 ; letter capitalized
      CP "R" ;is this "R"?
      JR Z,8622 ;if yes, then open the stream
      CP "W" ;is this "W"?
      JP NZ,7450 ;if not, then error
8622LD (23817),A ;save file mode letter
      CALL 7541 ;if there is a syntax check, then return
      LD A,"#" ;file extension - "#"
      LD (23781),A
      LD A,0 ;search starts from block 0
      LD (23782),A
      CALL 8667 ;search for last block of file
      PUSH AF ;save search result flag
      CALL 8719 ;check flow
      POP AF ;restoring search result flag
      PUSH AF ;save search result flag
      CALL NZ,8840 ;if the file was not found, then create block 0
      POP AF ;restoring search result flag
      CALL 8770 ;open thread
      LD HL,(23825);correction of variable with command address
                    lines
      LD BC,292
      ADD HL,BC
      LD (23825),HL
      JP 467 ;completion
───────────────────────── ─────────────────── ────────────────────
Address 8667. Search for a data file block. Input: put file name
on the calculator stack, set 23773 and 23817 and place in
23782 is the number of the first block of the file. Output: if the file is found, then
The descriptor of the last or first block is read, depending on
from 23817 and the accumulator is reset and the Z flag is set; otherwise flag Z
will be reset, and the accumulator will contain a byte from23817.
8667 LD A,10; file search is carried out by 10 bytes
      LD (23814),A
      CALL 7344 ;set file name and search for file
      PUSH AF ;save search result
      CALL 1029 ;setting to disk
      POP AF ;restoring search result
      JR NZ,8710 ;if the file is not found, then check the file mode
      LD A,(23817);open the file for reading?
      CP "R"
      JR Z,8705; if yes, then exit
8689 LD HL,23782 ;next block
      INC(HL)
      CALL 7347;block search
      JR Z,8689 ;if a block is found, then the next block
      LD HL,23782
      DEC (HL) ;last existing block
      CALL 7347 ;determining its catalog number
8705 CALL 5725 ;reading its handle
      XOR A ;zeroing the accumulator and setting the Z flag
      RET ;return
8710 LD A,(23817);open the file for reading?
      CP "R"
      RET NZ ;if yes, then return
      JP 985 ;message NO FILE

 to be continued...

Share your thoughts about the article