How to remake games - routines for working with disks.

47th Byte #01
3. SUBROUTINES FOR WORKING WITH DISK.

       Here we will consider subroutines that work with TR-DOS
at entry point #3D13 (15635).

  3.1 Initialization.

      INIT LD HL,(23796) ; 23796-system variable
           LD (TR_SEC),HL ; TR-DOS. Contains the number
           RET ; Tabernacle sector and path.

   The subroutine saves in cell TR_SEC - any free
memory cell - track and sector in which the game will be saved.
A subroutine should only be called once BEFORE running
games (after downloading).

  3.2 Recording.

      SAVE DI; Interrupts need to be disabled.
           LD B,LENG/256 ; B - number of recorded sectors(*)
           LD HL,ADDR ; In HL - address of the block being written.
           LD DE,(TR_SEC); In DE - space on the disk where to write
           LD C,6; In C, the code for the TR-DOS command.
           CALL 15635; Call TR-DOS.
           EI; Enable interrupts.
           RET ;


     (*) When working with tape, the length of blocks is measured in bytes,
and when working with a disk - in sectors.

  3.3 Download.

      LOAD DI ;
           LD B,LENG/256 ;
           LD HL,ADDR ;
           LD DE,(TR_SEC);
           LD C,5;
           CALL 15635;
           EI;
           RET ;		To be continued ...
_______________________________________________________________Chief Editor "47th byte" - Nightmare Max.
(095)931-1990 Maxim (20:00-23:00)
The "reader" was sewn and the text corrected - Markus.
"47th byte" - distributed on "Industrial Chaos BBS" ZXNet.
______________________________________________________________

Share your thoughts about the article