29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8. APPENDIX<br />

8.1 BOOT INITIALIZATION ICNFG INTERFACING<br />

In order <strong>to</strong> bring up the "DOS Ready" message when first powering up your computer, all<br />

that you need do is place a SYSTEM diskette in<strong>to</strong> the disk drive physically assigned <strong>to</strong><br />

the zero slot and depress a RESET but<strong>to</strong>n. In a few short moments, the ready prompt<br />

appears on the display screen. Although, <strong>to</strong> the casual observer, not much appears <strong>to</strong> have<br />

taken place, the machine has executed many "behind-the-scenes" procedures in order <strong>to</strong><br />

make the operating system available for your commands. <strong>The</strong> appendix section on SYSTEM<br />

DISK BOOTING covers the individual steps undertaken. Here we discuss one of the final<br />

steps - the execution of an initialization configuration routine.<br />

Certain items of hardware require an initialization process before they can be used. For<br />

instance, the RS-232 hardware needs <strong>to</strong> have parameters such as baud rate, word length,<br />

and number of s<strong>to</strong>p bits initialized before it can be used. This initialization process<br />

could be a software routine which transfers the required parameters <strong>to</strong> the UART and Baud<br />

Rate Genera<strong>to</strong>r. Certain hard disk controllers (the XEBEC controller, for instance) may<br />

also need <strong>to</strong> be initialized before the attached disk drive can be used. This<br />

initialization process may be implemented as a program executing under the AUTO command<br />

or it may be a small routine that is part of the disk driver. If the latter, it would be<br />

useful <strong>to</strong> have it execute prior <strong>to</strong> the "DOS Ready" message. You may also develop a<br />

complex system function that takes over one or more SuperVisor Call functions. Since such<br />

a function could reside in memory as part of a configuration, it would be useful <strong>to</strong><br />

have it au<strong>to</strong>matically hook in<strong>to</strong> the SVC table. Again, if the interfacing routine were<br />

part of the function code in memory and the system provided a method <strong>to</strong> execute such a<br />

routine, it would alleviate the problem of executing the hook.<br />

After the system booting process loads a configuration file, it CALLs a vec<strong>to</strong>r, called<br />

the @ICNFG vec<strong>to</strong>r. <strong>The</strong> contents of the vec<strong>to</strong>r are accessible from the FLAGS pointer<br />

returned by the @FLAGS$ SuperVisor Call. Thus, any initialization routine that is part of<br />

a memory configuration can be executed if its entry address is made available <strong>to</strong> @ICNFG.<br />

This is accomplished by placing your entry address in<strong>to</strong> @ICNFG while you save the former<br />

address - eventually transferring control <strong>to</strong> the former address when your routine<br />

completes its execution. This process is called "chaining in<strong>to</strong> @ICNFG". If you need <strong>to</strong><br />

configure your own routine that requires initialization when the machine is booted, you<br />

chain in<strong>to</strong> @ICNFG.<br />

Let's first look at a sample initialization configuration routine linkage. Your<br />

initialization routine would obviously be unique <strong>to</strong> the function it was <strong>to</strong> perform so we<br />

will not illustrate that part. A template for such a routine would appear as:<br />

INIT CALL ROUTINE ;Start of init<br />

LINK DB 'Roy' ;Pass <strong>to</strong> the chain<br />

ROUTINE .<br />

Your initialization routine<br />

.<br />

.<br />

RET ;End with a RET instruction!<br />

<strong>The</strong> relocated address identified by the label "INIT" is the entry point that will be<br />

placed in<strong>to</strong> the @ICNFG vec<strong>to</strong>r field. <strong>The</strong> 3-byte field identified as "LINK" will be used<br />

<strong>to</strong> s<strong>to</strong>re the original contents of the @ICNFG vec<strong>to</strong>r field. Thus, when INIT receives<br />

control, it "calls" your initialization routine then passes back <strong>to</strong> the next routine<br />

chained in<strong>to</strong> @ICNFG.<br />

We will now illustrate a procedure <strong>to</strong> accomplish the chaining linkage. <strong>The</strong> chaining<br />

procedure is performed by that part of your program which is going <strong>to</strong> place the memory-<br />

8-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!