TR-DOS Loading Routines: LOADER and MONOLOADER

Electra #01

CODING

This section is not called coding rather than programming for nothing. This means that this section is completely dedicated to programming in assembly language. However, that does not mean that other languages cannot be discussed here if you wish.

What made me choose assembly is precisely that for the Spectrum it is the only language in which one can program professionally.
It remains only to add that this section is intended for people with at least minimal prior knowledge of assembly language.
All procedures mentioned in the magazine are provided in the appendix. Therefore, only a description of the operating principles of these procedures and a brief user manual will be given here. In the appendix, these procedures will be provided in the format of two assemblers — GENS and TASM.

The topic of this issue is TR-DOS and everything related to it.
The first procedure we will look at is LOADER. This procedure performs the same functions as the BASIC LOAD operator.
Input parameters of the procedure:

HL - address where the file should be loaded.
DE - address where the file name and extension template is located.

The procedure is called using the assembly command CALL LOAD.

EXAMPLE:

LD HL,40000
LD DE,FNAME
CALL LOAD
FNAME DEFM "CODEFILEC";The template consists of nine characters, eight of which are the file name, and the ninth is the extension.

Description of the operating principle:

  1. Creates a file descriptor;
  2. Puts the file name into the descriptor;
  3. Searches for a file with the specified name; if found, reads precise data about it; if not, outputs a message on the screen — NO FILE followed by the file name and extension.
  4. Reads the data required for the ROM load procedure from the file descriptor and calls it.

The above load procedure is practical to use during program development and debugging, but as a load procedure for a finished program, it is recommended to use MONOLOADER.
MONOLOADER is so simple that it can be included completely in the magazine.

MONOLOAD
LD C,5
LD DE,(#5CF4)
CALL #3D13
RET

Input parameters:

HL - address where the file should be loaded;
B - number of sectors to load.

The procedure is called with the assembly command CALL MONOLOAD.
Description of the operating principle:

  1. Puts the current sector and track into DE.
  2. Calls the ROM load procedure.

A peculiarity of the program is that all files must be sequential, and you must specify the file length in sectors yourself.
This procedure is used as follows:

  1. Create a code file (loader) in BASIC (this is done by reserving the required number of bytes after REM and writing the loader from DOS to address 23872+257).
  2. Write the files in the correct order to the disk after the BASIC block and combine them with ADM 7.08, or do it yourself in one of the disk monitors.

This information is nowhere near enough to work normally with TR-DOS. Therefore, if you have any questions or suggestions, write to the editorial office or call.

TO BE CONTINUED

INFO

Section: Kodēšana.
Article: TR-DOS loaderi.
Author: Rihards (WORLD SOFT).
Date: 21.07.95.

Editorial office address: DAXY, Mālkalnes 27-33, LV-5000, Ogre.
Telephones: 8250-23533, ask for Egons;
8250-44058, ask for Rihards.
Fax: 8250-46295.

Share your thoughts about the article