Educational program - full description + complete TR-DOS ROM disassembler (continued).

┌──────────────────────── ─────────────────── ───────────────────┐
│ ** LIKBEZ ** │
└─────────────────────────────── ───────────────────────────────┘

(c) P. Fedin
 FULL DESCRIPTION + FULL ROM DISASSEMBLER TR-DOS 5.04T (5.03)
 FOR PROFESSIONALS, AND ALSO FOR THOSE WHO WANT TO BECOME THEM

 continued

Address 6657. Preparing to download the program in BASIC.
6657 LD DE,(23635);take the address of the beginning of the program in BASIC
      LD HL,(23641); take the address of the end of the program in BASIC
      DEC HL
      PUSH HL ;save the beginning and end of the program
      PUSH DE
      SBC HL,DE ;calculating program length in BASIC
      LD DE,(23782);take the length of the program with variables
      PUSH DE ;save it
      PUSH HL ;save the length of the old program
      LD HL,0 ;verification in progress?
      LD A,(23801)
      CP 255
      JR Z,6688; if yes, then we do not change the length
      LD HL,5 ;otherwise we will increase it by 5 bytes
6688 ADD HL,DE
      LD (23771),HL;setting loading length
      POP HL ;restoring the length of the oldprograms
      LD A,(23801) ;verification ?
      CP 255
      JR NZ,6705; if not, then prepare the memory
      POP DE ;pop registers from stack
      POP DE
      POP HL
      JR 6728 ;return
6705 CALL 6642 ;checking availability of space for the program
      POP BC ;restoring program length with variables
      POP DE ;restore the beginning of the program
      POP HL ;restore end of program
      PUSH BC ;save program length
      RST 32 ;erasing old program
      DEFW #19E5
      POP BC ;restore program length
      CALL 7730 ;reserving space for a new program
      INC HL ;setting the VARS variable
      LD BC,(23784)
      ADD HL,BC
      LD (23627),HL
6728 LD HL,(23635); take the program download address
      RET ;return
───────────────────────── ─────────────────── ────────────────────
Address 6732.Preparing memory for loading the array. Install
23784, 23767, 23769 and 23801.
6732 LD DE,(23784);download entire file
      LD (23771),DE
      LD HL,(23767);take the address of the array in memory
      LD A,(23801) ;verification ?
      CP 255
      RET Z ;if yes, then return
      LD HL,(23769); take the file download address
      PUSH HL ;savehim
6753 CALL 6642 ;checking whether there is space for the array
      POP HL ;restore file download address
      LD A,H ;is it equal to 0?
      OR L
      JR Z,6777 ;if yes, then we do not remove the old array
      LD HL,(23767);take the beginning of the old array
      DEC HL
      DEC HL
      DEC HL
      LD BC,(23769);take its length
      INC B.C.
      INC B.C.
      INC B.C.
      CALL 7726 ;erasing old array
6777 LD HL,(23641);take the beginning of the domain of variables
      DEC HL
      LD BC,(23784);take the file length
      PUSH BC ;save it
      INC B.C.
      INC B.C.
      INC B.C.
      CALL 7730 ;reserving space for new array
      INC HL ;set array name
      LD A,(23762)
      LD(HL),A
      INC HL ;restore and set array length
      POP DE
      LD(HL),E
      INC HL
      LD(HL),D
      INC HL ;take the address of the array body
      RET ;return

 to be continued...

Share your thoughts about the article