Msg: 5511 *Conference*

10-25-94 19:26:52

From: RON WIESEN

To : COMET _

Subj: REPLY TO MSG #5497 (RELOCATING M/L)

Attached find two source assembly files and a BASIC file: EXEC.DO, EXDEMO.DO,
and EXDEMO.BA.
 
EXEC is the Executive for running any .CE machine language program in-place.
Commentary in EXEC.DO is terse but sufficient as a base for continued
development beyond the "simple .CE form" disclosed in the Conference.  I plan
no further development at this time.
 
EXDEMO demonstrates how a .CE program can run in-place or run in .CO fashion.
EXDEMO when run, just emits 3 beeps spaced at 2-second intervals.  Its
structure is a simple loop.  Commentary in EXDEMO.DO is about .CE program
requirements and implementation, as well as a summary of actions by EXEC.
 
EXDEMO.BA is used after you assemble EXDEMO.CO to safely change file name
EXDEMO.CO to EXDEMO.CE in the File Directory of the Op Sys.
 
 
Preparation procedure:
 
1.  EXEC.DO - Either set your HIMEM less than or equal to 61558 (BASIC -
CLEAR256,61558) or change the ORG 61558 statement to whatever is convenient for
you.
 
2.  Assemble EXEC (BASICwithROM2/CALL911 - ASMN EXEC) above HIMEM and record
its Top, End, and Exe addresses in decimal (BASICwithROM2/CALL911/DBG - EX TOP:
- EX END: - EX EXE:).  Then save the assembled code as EXEC.CO (BASIC -
SAVEM"EXEC",Top,End,Exe ).
 
3.  This step is needed for demonstration purposes to show how HIMEM
requirements can be completely (for EXEC.CO and for all .CE programs) avoided.
Avoid a HIMEM requirement for EXEC.CO by biasing it so that when you invoke it
(conventional .CO fashion only), the Op Sys copies/runs it in the "Prev Screen
Buffer" at address 64704.  Use RELOC1.BA (or RELOC.BA) to bias EXEC.CO for
address 64704.  Prompt entries are:
    File name? EXEC
    Top? as recorded in step 2 (e.g., 61558)
    End? as recorded in step 2 (e.g., 61677)
    Exe? as recorded in step 2 (e.g., 61558)
    Is there a data table in the file? N
    Relocate to? 64704
    A)utomatic or M)anual? A
    Save "EXEC" at the new location? Y
 
4.  EXDEMO.DO - Either set your HIMEM less than or equal to 61558 (BASIC -
CLEAR256,61558) or change the ORG 61558 statement to whatever is convenient for
you.
 
5.  Assemble EXDEMO (BASICwithROM2/CALL911 - ASMN EXDEMO) above HIMEM and
record its Top, End, and Exe addresses in decimal (BASICwithROM2/CALL911/DBG -
EX TOP: - EX END:  - EX EXE:).  Then save the assembled code as EXDEMO.CO
(BASIC - SAVEM"EXDEMO",Top,En d,Exe) 
 
6.  This step changes the file name of EXDEMO.CO to EXDEMO.CE.  The safe way to
do this is to run BASIC program EXDEMO.BA and then go on to the Demonstration
procedure.  If you want to use some other means to do this step, the following
paragraph is relevant but be very careful because you are messing with the File
Directory of the Op Sys and a mistake is disastrous!
 
Search the File Directory for file name EXDEMOCO (periods are not stored in the
directory) and change the last character from O to E (new name is EXDEMOCE).
The first portion of the File Directory is for the five applications within the
Standard Rom (BASIC, TEXT, TELCOM, etc.) and are of no interest.  The RAM file
portion follows beginning at address 63930 and has up to 19 RAM file entries of
11 bytes each.  For each entry, the 4th through 9th bytes are the file name and
the 10th and 11th bytes are the file name extension.
 
 
Demonstration procedure:
 
1.  Invoke BASIC.  Type ?HIMEM.  Record your current HIMEM address so you can
restore it later.
 
2.  Type CLEAR256,MAXRAM.  This sets HIMEM to its maximum value which leaves no
memory reserved for conventional runs of machine language programs.
Conversely, it frees all of your unused memory for other purposes!
 
3.  Type MENU.
 
4.  Place the wide cursor over EXDEMO.CE and press ENTER.  The Op Sys beeps
once and immediately presents the main screen menu to you again.  A single beep
from the Op Sys means there is no memory reserved where it can make a copy of
EXDEMO.CE for a conventional run.
 
5.  Place the wide cursor over EXEC.CO and press ENTER.  EXEC.CO lists all your
files and waits for you to enter the file name of a .CE machine language
program.  The fact that the Op Sys did run EXEC.CO demonstrates that it has no
HIMEM requirement!  Let me explain.  EXEC.CO is biased for execution from
within the "Prev Screen Buffer".  Because this is a higher address than the
maximum HIMEM address, the Op Sys copied the code of EXEC.CO into the "Prev
Screen Buffer" and it is this code that is now executing.
 
6.  Type EXDEMO and press ENTER.  EXDEMO.CE emits 3 beeps spaced at 2-second
intervals, exits back to EXEC.CO, which exits back to the Op Sys, which
presents the main screen menu to you.  Although 3 beeps isn't much, it
demonstrates that a .CE program does run "in-place" when it is invoked via
EXEC.CO.  If you doubt that EXDEMO.CE actually ran, then how do you explain the
3 beeps in contrast to the single beep result you got in step 4?
 
7.  Invoke BASIC.  Type CLEAR256,MAXRAM-FRE(0)+4500.  This sets HIMEM to a very
low value which leaves a lot of memory reserved for conventional runs of
machine language programs.  Conversely, it leaves little memory for other
purposes!
 
8.  Type MENU.  Note how few "Bytes free" are shown at the bottom right of the
main screen menu.
 
9.  Place the wide cursor over EXDEMO.CE and press ENTER.  EXDEMO.CE emits 3
beeps spaced at 2-second intervals and exits back to the Op Sys, which presents
the main screen menu to you.  This demonstrates that a .CE program can be run
in the conventional .CO fashion when the Op Sys finds enough memory reserved
where it can make a copy of the program for a conventional run.
 
10. Invoke BASIC.  Type CLEAR256,myhimem where "myhimem" is the address you
recorded in step 1.  This restores HIMEM to its original value and ends the
demonstration.

*Enclosed File: 3files