Micro #10
28 ноября 1998
  TR-DOS  

Tape and Disk - Adapting programs to the system TR-DOS (Part 4).

<b>Tape and Disk</b> - Adapting programs to the system TR-DOS (Part 4).
  ADAPTATION PROGRAMMES OF SYSTEM TR-DOS



                 CHAPTER 4


       LOADER, native

     -------------------------------
     for those who do not know what

              machine code.


   Despite the fact that knowledge of assembler is not
is required to understand
what I'm going to write on, it does not
hurt. Even more useful is the ability to use any monitor, 
disassembler, I recommend to use program from the package 
Ultraviolet / Infrared. This is the first assembler and 
disassembler, which appeared on the market for the ZX Spectrum. 
The program is easy to use and quite acceptable for the 
solution of those tasks that will be dealt with in this 
chapter. Later you would have to switch to something more 
serious (eg, STS 6.2). 

   To present a consistent and clear organization of 
downloading files from the machine code for nepodgotolennogo 
user's task is more than difficult, but you can try. 

   Let's start with the easiest. Suppose
that the tape has a program consisting
four files: the file to BASIC, the code file and two files with 
no header. Having studied BASIC program, you've come to the 
conclusion that it loads the code file and runs it

from address 65000.

   With a Copy you have determined that
code file is loaded from address 65000 and
has a length of 30 bytes, the length of the file without the 
header is respectively 6912 and 32768 bytes.


   Now run the code file where
him to be laid, but do not run
it, and your disassembler. Disassemble
memory is needed, starting at address start-up, that is, from 
the address 65000. Suppose disassembler that showed the 
following: 

 65000 LD IX, 16384; starting address
 65004 LD DE, 6912, the length
 65007 LD A, 255
 65009 SCF
 65010 CALL 1366; call Subprogramme, we load
 65013 LD IX, 25000; starting address
 65017 LD DE, 32768, length
 65020 LD A, 255
 65022 SCF
 65023 CALL 1366; call Subprogramme, we load
 65026 JP 40000; run the program
 65029 NOP


   I do not presume to explain the meaning of all these 
zakoryuchek. If you know what they stand for your happiness, if 
not, and God bless You. To a little bit to deal with boot 
loaders, you need to remember that after LD IX should be 
addressed to download the file, after LD DE its length. 
Mnemonics LD A, 255, and SCF set the registration system, and

CALL 1 366 calls a subroutine boot
tape. Address after the CALL may vary
Depending on whether you use the standard boot loader routine 
loading, located in ROM (as in this example), or their own.


   Thus, we learned that the loader
Download two files, the first of which (6912 bytes in length 
and load address 16384), obviously, screensaver, and the second 
(32768 and 25000, respectively), the main program file (note 
that data on length of the file match the data provided by 
copyists), in addition, we learned that the program starts at 
address 40000.


   Using these data, we can begin to
adaptation programs.

   Perhaps the hardest thing that will be
to do is write the two files without the headers on the disk. 
If you have a program PCopier, PCopier Plus or L-COPY, then the 
problem is somewhat simplified. Will be sufficient to copy the 
files to disk and then run the following program: 


  10 RANDOMIZE USR 15619: REM:

      LOAD "less 001" CODE 16384


  20 RANDOMIZE USR 15619: REM:

      SAVE "screen" SCREEN $


  30 RANDOMIZE USR 15619: REM:

      LOAD "less 002" CODE 25000


  40 RANDOMIZE USR 15619: REM:

      SAVE "main" CODE 25000,32768


   Of course, addresses and file names are only suitable for 
this example. 

   However, there are many ways to copy files without using 
special kopiroschikov. We give the most simple for this 
example, the method (basically, it is suitable for most cases). 

   After downloading the file, the loader, as
Typically, runs the program. Usually,
It uses the already mentioned team
JP XXXXX, where XXXXX address programmy.Chtoby start to get a 
copy of the file, need to download the files into memory from 
tape and burn them to disc. You can use ready-made boot, after 
replacing instuktsiyu that triggers program, the instruction 
returns control to the BASIC interpreter, that is instead of 
the entity to supply JP RET, code is 201. In our example, this

can be achieved by performing an operator POKE
65026.201. The value of the address, where the user JP, change 
to 201 (command RET), which will ensure a return to the 
beysiksistemu after downloading both files. 

   Preparing such a code loader
way, you can run it, not forgetting to provide a record of 
files on the disc after completion of boot. It is convenient to 
collect program in a few lines:



  10 RANDOMIZE USR 65000: REM Start of
     longshoreman


  20 RANDOMIZE USR 15619: REM:

     SAVE "screen" SCREEN $


  30 RANDOMIZE USR 15619: REM

     SAVE "main" CODE 25000,32768


   When you see the message
successful completion of the program, you will only have to 
write the loader from the disk, with What I hope no 
difficulties will arise. 



   Chapter 5 "How To Fight RAMTOP'om," You
See the next issue of Micro.

       ---------------------------
 03/12/1998. Gloom Demons Inc.

               C.E. special for Micro 10.






Other articles:

BBS - Full description of work with BBS for Spectrum.

Opinion - an overview of game genre D & D - Last Herp of Light Force.

Tape and Disk - Adapting programs to the system TR-DOS (Part 4).

Humor - a compilation of anecdotes.

Pokes - a compilation of Poke's.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Poems - Programmers-emigrants.
Scene - The report from the Warsaw group AY Riders.
Amiga Sensor - naked under the gaze Rulez.
Smiley - new jokes.
Interview - an interview with Misha Borisov, known as, BOGO or BARMALEY.

В этот день...   2 May