home *** CD-ROM | disk | FTP | other *** search
- ; ROSIF.A86
- title 'IBM ROS Entry and Semaphores'
- pagesize 60+11
- ;****************************************
- ;* IBM ROS ENTRY POINTS *
- ;* MUTUAL EXCLUSION SEMAPHORES *
- ;* CDOS 6,0 XIOS *
- ;* DRI OS ENGR, JMB *
- ;****************************************
- ; Major mods:
- ; 6.0
- ; 21 Jul 88 -- intercept int 14 as well IJ
- ; 7 DEC 87 -- ROS equip_flag no longer changed for int 10h's GS
- ; 17 JUL 87 -- converted XIOS to small model JW
- ; 5.0
- ; 6 JAN 86 -- disable keyboard ROS MX control
- ; 12 DEC 85 -- don't rely on DS = SYSDAT
- ; 11 DEC 85 -- cli before entering ROS
- ; 1 JUL 85 -- initial creation
-
- ; include COPYRITE.TXT
-
- nolist
- include CDOS.EQU
- include PCHW.EQU
- include ROSDATA.EQU
- list
- ; These were included:
- ; include CDOS.EQU
- ; include PCHW.EQU
- ; include ROSDATA.EQU
-
- CGROUP group CODE,rosif
-
- public vector_table$
- public int10_isr$
- public int10_entry@, int13_entry@, int14_entry@
- public int16_entry@, int40_entry@
- public NUM_VECTORS
-
- cseg
- extrn supif@:near
- extrn sysdat$:word
-
- LOCKED equ 0ffh
- FREE equ 0
- eject
-
- cseg
-
- ; These routines depend on XIOS INIT to initialize the ROS entry point
- ; variables, and because they swap the actual int. vectors (int. 10 calls
- ; itself), they rely on the fact that the interrupt vectors are part of the
- ; context that gets saved for each process.
-
- int10_entry@: ; Entry point to ROS VIDEO driver
- ;------------
- push ax
- call get_ros_mx
-
- mov ax,int10_isr$
- mov word ptr ros_entry,ax
- mov ax,int10_isr$+2
- mov word ptr ros_entry+2,ax
- pop ax ; get back original
- call call_ros ; alternate entry
- mov ros_mx,FREE
- ret
- eject
-
- int13_entry@: ; Entry point to ROS DISKETTE driver
- ;------------
- push bx
- mov bx,offset int13_isr
- jmps common_code
-
-
- int14_entry@: ; Entry point to ROS ASYNC driver
- ;------------
- ; push bx
- ; mov bx,offset int14_isr
- ; jmps common_code
-
- pushf
- callf dword ptr int14_isr
- ret
-
- int16_entry@: ; Entry point to ROS KEYBOARD driver
- ;------------
- ; push bx
- ; mov bx,offset int16_isr
- ; jmps common_code
-
- pushf
- callf dword ptr int16_isr
- ret
-
- int40_entry@: ; Entry point to ROS HD driver
- ;------------
- push bx
- mov bx,offset int40_isr
- ; jmps common_code
-
-
- common_code:
- push ax
- call get_ros_mx
- mov ax,cs:[bx] ; offset
- mov word ptr ros_entry,ax
- mov ax,cs:2[bx] ; segment
- mov word ptr ros_entry+2,ax
- pop ax
- pop bx
- call call_ros
- mov ros_mx,FREE
- ret
- eject
-
- call_ros:
- call save_5 ; Save these 4 around the
- ; vector swap
- sub di,di
- mov es,di ; point ES at int. vectors
- mov si,offset vector_table
- mov cx,NUM_VECTORS
- cli ! cld
-
- lp:
- mov di,cs:[si] ; get vector address
- inc si ! inc si ; point to data
- push es:word ptr[di] ; save current offset
- lods cs:ax ! stosw ; and replace
- push es:word ptr[di] ; save current segment
- lods cs:ax ! stosw ; and replace
- sti ! nop ! cli ; let one in
- loop lp
- sti
-
- ; Now call ROS:
- ; All registers should be correct...flags are the only ones that are dif.,
- ; but flags are not part of the entry spec. for any of these calls.
- call restore_5 ; Restore the saved regs
- pushf ! cli ; fake the int.
- callf ros_entry
-
- pushf ; save the return flags
- pop flags_save ; around the vector restore
-
- call save_5 ; and these five, too.
- eject
-
- ; Restore the vectors:
- sub si,si
- mov es,si ; point to low mem.
- mov ds,sysdat$
- mov si,offset table_end
- sub si,6 ; point to vect. address
- mov cx,NUM_VECTORS
- cli
- lp1:
- mov di,cs:[si]
- sub si,6
- pop es:word ptr 2[di]
- pop es:word ptr [di]
- sti ! nop ! cli ; allow one
- loop lp1
- sti
-
- ; Restore the flags:
- push flags_save
- popff iret_op@
- call restore_5 ; as ROS left them.
-
- ; And go home:
- ret ; back to caller
-
- eject
-
- get_ros_mx:
- ; Uses ax.
- mov al,LOCKED ; locked for us
- xchg al,ros_mx
- inc al ; if already locked, set ZF
- jnz got_it ; jump if not already locked
-
- push bx ! push cx ! push dx
- push bp ! push di ! push si ! push es
- mov cl,P_DELAY
- mov dx,1 ; delay for one tick
- call supif@
- pop es ! pop si ! pop di ! pop bp
- pop dx ! pop cx ! pop bx
-
- jmps get_ros_mx ; try again
-
- got_it:
- ret
-
-
- save_5:
- mov es_save,es
- mov ds_save,ds
- mov si_save,si
- mov di_save,di
- mov cx_save,cx
- mov ax_save,ax
- ret
-
-
- restore_5:
- mov es,es_save
- mov ds,ds_save
- mov si,si_save
- mov di,di_save
- mov cx,cx_save
- mov ax,ax_save
- ret
- eject
- rosif cseg
-
- ros_entry rd 1 ; space for current entry
- ; address
- vector_table$ rw 0
- dw 10h*4 ; video entry
- int10_isr$ dw 0,0
- dw 13h*4 ; diskette entry
- int13_isr dw 0,0
- dw 14h*4 ; async entry
- int14_isr dw 0,0
- dw 16h*4 ; keyboard entry
- int16_isr dw 0,0
- dw 40h*4 ; hard-disk entry
- int40_isr dw 0,0
-
- table_end rb 0
- NUM_VECTORS equ (offset $ - offset vector_table) / 6
-
-
- flags_save rw 1
- es_save rw 1
- ds_save rw 1
- si_save rw 1
- di_save rw 1
- cx_save rw 1
- ax_save rw 1
-
- ros_mx db FREE
-
- end
-
- ; END OF ROSIF.A86
-