Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Applied links to System Call Reference API's

...

Because the segment registers are write-only, the operating system needs 'soft copies' of the current bindings so it can restore the old bindings correctly after it has rebound banks at the start of OS calls or interrupt service routines. These soft copies are stored at machine locations $04D0 to $04D3. It is VITAL that the desired bindings are stored here BEFORE actually binding the bank; if the bank were bound first, then in the event of an interrupt occurring immediatly after the output instruction, the interrupt service routine would rebind the bank to the contents of the soft copy (assuming it does rebind the relevant segment), and the desired change would be lost. The equivalent of an OS_Mpb would be:

            ld   bc, $04D0 + segment            ; address of soft copy
            ld   a, bank                        ; bank number
            ld   (bc),a                         ; update the soft copy
            out  (c),a                          ; bind in the bank

Similarly, the equivalent of the OS_Mgb would be simply to read the soft copy:

...