The following outlines the assumptions and techniques being used in connection with adding enhancements and “bug” fixes to the 152000 OS software. Your comments and suggestions are welcome.
ASSUMPTIONS
- Availability of a total of 32K of ROM configured as 16K in the Home Bank and 16K in the Extension Bank occupying parallel addressing space in Chunks 0 and 1.
- Maintenance of current module organization and entry addresses for all Global routines. 3s Minimum movement of current code.
- When executing OS ROM routines, in addition to Chunks 0 and 1, the following Home Bank RAM must be enabled:
- Chunk 2 – Display File and System Variables
- Chunk 3 – Machine Stack and OS Ram Routines or second Display File
- Chunk 7 – Machine Stack and OS Ram Routines if second Display File open
When the ROM routines are accessed from another bank (Dock or Expansion), access must therefore be via:
- The Function Dispatcher which enables all chunks in the Home Bank if the address is in the Home Bank.
- Call to Call Bank with the Horizontal Select byte specifying at least the above chunks in the Home Bank.
This implies that access to all OS ROM routines through the above two paths should be via an entry address in the Home ROM.
IMPLEMENTATION TECHNIQUE
- To effectively use the ROM Extension for adding bug fixes and enhancements, a technique has been devised to minimize the bank switching overhead when only the system ROM’s are involved. This technique, which is detailed in the attachments, gives a switching time for a Call of approximately 100 microseconds compared to a minimum of approximately 700 microseconds using the Call Bank routine (longer if Expansion Banks are installed). In addition, it preserves all registers, including IX. This technique is based upon Assumption 4. above, and the fact that control can be passed between the Home ROM and Extension ROM independent from the current selection of Chunks 2 through 7 since disabling Chunks 0 and 1 in the Extension implicitly enables them in the Home Bank.
- The proposed method will be utilized to implement Restarts in the Extension Bank to pass control to the Home ROM Restart entry points for ERROR, IGN SP, NXT_IS and COPY_UP, with return (if applicable) switching back to the Extension ROM. The other Restarts will not be invoked in the ROM Extension. The Keyboard and NMI interruptions are handled in the RAM if they vector into other than the Home ROM.
- Candidate subroutines for moving to the Extension Bank must exit via:
- RETURN
- ERROR Restart
RETURN does the necessary bank switching and adjustment of the stack. An ERROR Restart will switch to the Home Bank where the stack will be reinitialized in processing the error.
Nested calls between banks will be possible where the above rules apply, e.g. code in the Extension, called from the Home Bank, can call routines in the Home Bank via the same switching technique as long aS a normal return will be made (or an ERROR Restart). This is similar to the technique currently used when executing the Tape routines.
Code may also be “jumped to” from the Home ROM to the Extension and vice versa using this technique when:
- Control is not to be passed back, such as for the ERROR Restart in the Extension
- Return of control is by a jump to a specified address in the other bank, such as during initialization.
- In order to add code for “bug” fixes and enhancements, as well as to add the new switching routines, space will be made available in the Home Bank by moving selected code to the Extension, but maintaining its entry point in the Home Bank as currently defined. In general, the code affected will be directly involved in either a “bug” fix or the addition of an enhancement, e.g. the IO-1 module for I/O to the screen will have changes added to support the advanced video modes. This additional code will primarily be located in the ROM Extension and will be accessed via the proposed switching technique.
- Access to the CHNG_VID routine in the ROM Extension via the Function Dispatcher or Call Bank will be implemented by providing a routine in the Home ROM (CALL_VMC) which will call CHNG_VID using the proposed switching technique. This approach guarantees the selection of the necessary RAM in the Home Bank (Chunks 2, 3 and 7). This routine will also adjust the return address to CALL BANK if necessary because of the movement of code between Chunks 3 and 7. The current interface from the Dispatcher to Call_Bank will also be changed from:
- CALL CALL_BANK
RET - to JP CALL_BANK
This eliminates the extra return address within the Chunk 3/7 code.
- CALL CALL_BANK