þ a‹R þ w Qþ m^9     þ hý	 oP    þ nSystem-wide    NAME Roms

; This is Os.RomStubs.Asm.  This file stubs
; the routines that deal with the low level
; roms

SYSDEP_DGROUP GROUP SYSDEP_DATA
SYSDEP_CGROUP GROUP SYSDEP_CODE

PUBLIC xCpGetMySlot, xCpBankInfo, xCpSetActiveSlot, xCpGetSlotAddress
PUBLIC SingleByteInterrupt

; constants

nullWord          EQU 0ffffh
nullByte          EQU 0ffh
oldProms          EQU 4         ; last old prom rev

;  External Routines

EXTRN CpBankInfo: FAR
EXTRN CpGetMySlot: FAR
EXTRN CpSetActiveSlot: FAR
EXTRN CpGetSlotAddress: FAR


; Data

SYSDEP_DATA SEGMENT PUBLIC 'DATA'
  EXTRN promRev: BYTE
SYSDEP_DATA ENDS

$EJ

SYSDEP_CODE SEGMENT PUBLIC 'CODE'
  ASSUME CS:SYSDEP_CGROUP, DS:SYSDEP_DGROUP

; CpBankInfo : PROCEDURE PTR CLEAN
;
; This will return a pointer to the slot information

xCpBankInfo PROC FAR
    PUSH DS
    MOV  AX, SYSDEP_DGROUP
    MOV  DS, AX

    CMP  promRev, oldProms
    JLE  BankStub
    POP  DS
    JMP  CpBankInfo

BankStub:
    MOV  BX, NULLWORD
    MOV  ES, BX
    POP  DS
    RET
xCpBankInfo ENDP


; CpGetSlotAddress : PROCEDURE (slot) PTR CLEAN
;     DCL slot BYTE;
;
; This will return the actual address of a given slot
; by looking at the table that was set up init time
; If slot is nullByte, then curSlot will be used

xCpGetSlotAddress PROC FAR
    PUSH DS
    MOV  AX, SYSDEP_DGROUP
    MOV  DS, AX

    CMP  promRev, oldProms
    JLE  GetAddrStub
    POP  DS
    JMP  CpGetSlotAddress

GetAddrStub:
    MOV  BX, NULLWORD
    MOV  ES, BX
    POP  DS
    RET  2
xCpGetSlotAddress ENDP


; CpGetMySlot : PROCEDURE (romID) BYTE CLEAN
;     DCL romID WORD
;
; This will return the slot # of the rom which
; has the given ID.  If the romID is not found, then
; nullByte will be returned

xCpGetMySlot PROC FAR
    PUSH DS
    MOV  AX, SYSDEP_DGROUP
    MOV  DS, AX

    CMP  promRev, oldProms
    JLE  GetSlotStub
    POP  DS
    JMP  CpGetMySlot

GetSlotStub:
    MOV  AL, NULLBYTE
    POP  DS
    RET  2
xCpGetMySlot ENDP


; CpSetActiveSlot : PROCEDURE (slot) BYTE CLEAN;
;     DCL slot BYTE;
;
; This will make the rom is slot be the "active" rom.
; It assumes that slot is either valid, or nullByte.  The
; current active slot will be returned.

xCpSetActiveSlot PROC FAR
    PUSH DS
    MOV  AX, SYSDEP_DGROUP
    MOV  DS, AX

    CMP  promRev, oldProms
    JLE  SetSlotStub
    POP  DS
    JMP  CpSetActiveSlot

SetSlotStub:
    MOV  AL, NULLBYTE
    POP  DS
    RET  2
xCpSetActiveSlot ENDP

; Single Byte Interrupt
;
; This is the interrupt service routine for the single byte
; interrupt.  It will do an FWAIT IRET
;
SingleByteInterrupt PROC FAR

  FWAIT
  IRET
SingleByteInterrupt ENDP

SYSDEP_CODE ENDS

    END
