Acrs

Add S pnn.l W2 s AND MORE

1120 WKSH SCH D 1120 Form 1120S K1 1120S

SCHO 1120S Form 1041 K1 1041 SCH O 1041 Form 1065 K1 1065

EACH TAX PACKAGE... ONLY $4995

FREE WITH EACH ORDER...PLASTIC OVERLAYS FOR PAGE 1 AND 2 OF FORM 1040!! FOR ORDERS OR INFORMATION CALL OR WRITE:

We ship within one day of receiving orders.

'hen ordering by malt, include your telephone num . credit card Information, computer model. memory a. and number of drives. Indiana resldenu add

O R&S Software Co. BO

SOprU/ARE (312)891 3502

So Don't Delay . Order Your TAX PACKAGE Today!

Tandy. The correct way to exit a program on a Model I or III is to JP 402DH.

At the beginning of your program, you should preserve the contents of every register you intend to use. Likewise, you should restore them just before you exit your program. The easiest way to do this is to PUSH all the register contents onto the stack when you start a program, and to POP them back at the end. In fact, if you have an assembler like EDAS IV, MACRO-80, or EDT-ASM+, you can write macros to do this for you with one-line commands. Preservation of registers is part of the concept of making your programs transparent to the DOS. In many cases, failing to do so will cause the DOS to blow up when your program returns control to the system.

Never use the Z-80 alternate registers (AF', HL', etc.) for your own code. These are reserved for use by the operating system. For example, some systems use these registers during interrupt handling. If you use them, the system will invariably fail to perform properly. The Z-80 stack is a more appropriate place to store data which you need to access rapidly.

Finally, honor the high memory pointer in the DOS and make all your high memory programs self-relocating. A TRSDOS-compatible DOS maintains a pointer called HIGH$ which tells the system the highest unused memory location. HIGH$ is at X'4049' in a Model I system and X'4411' in a Model III system. A properly written program will never attempt to use memory higher than the current value stored in HIGH$. This is why memory above the current value in HIGH$ is referred to as Protected. Programs such as special device drivers, I/O filters, and machine language sorts are often placed in protected memory to keep them from being overwritten by the main program that is currently executing. Here's where we run into the second part of the problem. Suppose you have two high-memory programs, say a printer driver and a machine language sort for a data base manager. If they both are designed to load at X'FOOOO', you have an obvious problem! Only one program

Compatibility can occupy a given part of memory at one time. The solution is to make all your high-memory programs self-relocating. Here's the basic procedure for doing this:

1) ORG your program to start at some low memory location (usually X'5200').

2) Have your program examine the current value of HIGH$ and decrement it by the length of the program to be placed in high memory. This will protect the program once you've moved it to its final location.

3) Resolve all absolute address references inside the program to reflect the fact that it is going to be moved to a new starting address. This would include any CALL, JP, or LD instruction which refers to a location within your program. For example, let's say you ORG the program at X'5200' and the first instruction is JP 5300H. Suppose also that after step 2 above, your program determines that it is to be relocated starting at X'FIOO'. You would then have to change the first instruction to be a JP F200H.

4) Finally, move your program to the new high, protected memory. This is easily done with the Z-80 LDIR instruction.

Keep in mind that all four of these steps are done each time you load the program (i.e., at runtime). If you follow this kind of procedure, the current value of HIGH$ becomes

Figure 1 LOOP

0 0

Post a comment