Source file: /~heha/vt/viewers/vt080.zip/src/v2/ODIS.ASM

;Residente ??
;na was wohl?

NewInt08:	;Der einzige HardwareInterrupt
	pushf
	 inc	[cs:IntFlg]
	 inc	[cs:MyTimer]	;weil der eingebaute bis 1800AFh zählt...
	 call	[cs:OldInt08]
	btst	[cs:TheSw],bit 2 ;Gerade beschäftigt?
	jz	ni8		;dann kein PENDING setzen, dem NC Zeit geben!
	bset	[cs:TheSw],bit 0 ;PENDING setzen
ni8:	call	ChkPending	;DANN natürlich "pending"
	iret

NewInt09:
	pushf
	 inc	[cs:IntFlg]
	 call	[cs:OldInt09]	;Interruptvergangenheit uninteressant!
	call	ChkPending
	iret

NewInt16:
	pushf
	 inc	[cs:IntFlg]
	popf
	pushf
	 call	[cs:OldInt16]
	call	ChkPending
	retf	2

ifdef maximal
NewInt7A:
	pushf
	 inc	[cs:IntFlg]
	popf
	pushf
	 call	[cs:OldInt7A]
	call	ChkPending
	retf	2

NewInt72:
	pushf
	 inc	[cs:IntFlg]
	 call	[cs:OldInt72]	;Interruptvergangenheit uninteressant!
	call	ChkPending
	iret

NewInt21:	;Das ist SICHERHEITSHALBER
	pushf
	 or	ah,ah
	 jz	ni1a
	 cmp	ax,4b00h ;Programm ausführen?
	 jz	ni1a
	 cmp	ah,31h	;Programmende?
	 jz	ni1a
	 cmp	ah,4ch	;dito?
	 jz	ni1a
	 bset	[cs:TheSw],bit 2 ;Execute-und Terminate-Flag wieder 1
	 cmp	ah,0dh	;Nur Zeichenfunktionen u.ä.?
	 jc	ni1	;Nicht "einpacken"

	 inc	[cs:IntFlg]
	popf
	pushf
	 call	[cs:OldInt21]
	jr	ni13

ni1a:	 bres	[cs:TheSw],bit 2 ;Execute-und Terminate-Flag auf 0: sperren
ni1:	popf
	jmp	[cs:OldInt21] ;bei o.g. Funktionen NUR anspringen
endif

NewInt13:	;Das ist NOTWENDIG
	pushf
	 inc	[cs:IntFlg]
	popf
	pushf
	 call	[cs:OldInt13]
ni13:	call	ChkPending
	retf	2

NewInt25:	;NOTWENDIG
	pushf
	 inc	[cs:IntFlg]
	popf
	call	[cs:OldInt25]
	jr	ni26

NewInt26:	;NOTWENDIG
	pushf
	 inc	[cs:IntFlg]
	popf
	call	[cs:OldInt26]
ni26:	call	ChkPending
	retf

NewInt28:	;Idle-Interrupt (zum Leerlaufzeit entdecken) GÜNSTIG
	pushf
	 inc	[cs:IntFlg]
	popf
	pushf
	 call	[cs:OldInt28]
ni28:	call	ChkPend1	;auch mit INDOS=1
	retf	2		;vielleicht war's DAS?

NewInt2A:	;NOTWENDIG
	pushf
ifdef maximal
	 inc	[cs:IntFlg]
endif
	 cmp	ah,80h		;Begin Critical Section?
	 jnz	ni2a1
	 push	ax cx
	  mov	cl,al
	  mov	ax,1
	  rol	ax,cl
	  or	[cs:CSections],ax
	 pop	cx ax
ni2a1:	 cmp	ah,81h		;End Critical Section?
	 jnz	ni2a2
	 push	ax cx
	  mov	cl,al
	  mov	ax,not 1
	  rol	ax,cl
	  and	[cs:CSections],ax
	 pop	cx ax
ni2a2:	 cmp	ah,82h		;End All Critical Sections?
	 jnz	ni2a3
	 mov	[cs:CSections],0
ni2a3:	popf
ifdef maximal
	pushf
	 call	[cs:OldInt2A]
ni13a:	jmp	ni13
else
	jmp	[cs:OldInt2A]	;nur anspringen
endif

NewInt2F:	;NOTWENDIG LT KONZEPT
	pushf
	 cmp	ah,[cs:MUXI]	;Selber gemeint?
	 jnz	ni2f		;nein
	 cmp	al,80h		;Ein Rundruf (der geht nach daußen!)
	 jc	ni2fFunc	;liefert AL=[IntFlg] bei Reentranz
ni2f:				; und FF bei InDOS! .. AL=0: alles okay
ifdef maximal
	 inc	[cs:IntFlg]
endif
	popf
ifdef maximal
	pushf
	 call	[cs:OldInt2F]
	jr	ni13a
else
	jmp	[cs:OldInt2F]	;nur anspringen
endif

ni2fFunc:	;die "Funktionalität" steckt hier drin
	popf			;Flags uninteressant
	sti
	or	al,al		;Installationscheck
	jnz	ni2f1
	MUXRESPONSE
;	mov	bx,AnsCode
;	mov	cx,VerCode
;	mov	dx,cs
;	mov	si,ofs IntTab	;zur Deinstallation
;	dec	al		;=FF: installiert!
	iret

ni2f1:	;ansonsten "heiße" Funktionen rufen (auf Reentranz checken!)
	xchg	ah,al		;Funktionsnummer retten
	mov	al,[cs:IntFlg]	;Das Flag...
	or	al,al 		;Keine Verschachtelung in irgendeinen Int?
	jnz	NullISR		;Oh doch!
	inc	[cs:IntFlg]	;Alle Schotten dicht!
	inc	al		;=1
	call	RunV		;dem Kern überlassen, mit AL=1!
	;RunV läßt sich diesmal auf dem Stack des Wirts aus!
	;Übergabeparameter: DX SI
	;Rückgabeparameter: CX SI DI
	dec	[cs:IntFlg]	;Und Interrupts wieder zulassen...
	xor	al,al		;markiert korrekte Ausführung!
NullISR:  iret

NewInt24:
	VID	0eh,7		;Kontrollausgabe
	bset	[ctrl1],bit 1	;Critical Error has occured-Bit
	mov	al,3		;Fail
	iret

proc ChkPend1	;Einstieg mit CY=1: InDOS-Flag darf 1 sein!
	sti
	pushf
	push	ax
	 mov	ax,402h
	 jr	@@2

ChkPending:		;Wird nach jedem Interrupt gerufen...
	sti
	pushf		;Flags hinüberretten, auf jeden Fall!
	push	ax
	 mov	ax,401h
@@2:	 dec	[cs:IntFlg]
	 jnz	@@e		;Kann nix tun, sorry!
	 cmp	[cs:TheSw],0ffh	;Wenn Z=1 dann CY=0
	 jnz	@@e		;Niemand hat requested... (sonst CLC!)
	 inc	[cs:IntFlg]	;Selbstverriegelung!
	 SSS	[cs:StkMem],sp	;leider lohnt sich das Pushen nicht sonderlich!
	 LD	ss,cs
	 mov	sp,ofs TmpStack	;Stackumschaltung!
	 push	cx si di bp	;Jetzt pushen was das Zeug hält!
	  call	RunV
	 pop	bp di si cx	;(der Basepointer sollte überflüssig sein..)
	 LSSx	sp,[cs:StkMem]	;Stack zurückgestellt...
	 dec	[cs:IntFlg]	;Wiederaufruf zulassen
@@e:	pop	ax
	popf
	ret
endp ChkPend1

proc RunV c
 uses es,bx,ds,dx
	LD	ds,cs
	les	bx,[CritErrFlag]
	cmp	[by es:bx],1
	jnc	@@d		;Fehler - RAUS
	les	bx,[InDOSFlag]
	cmp	[by es:bx],al	;1 oder 2
	jnc	@@d		;Pech - RAUS
	cmp	[CSections],0	;Keine Critical Section eingeschaltet?
	jnz	@@d		;Leider doch - RAUS
	bres	[TheSw],bit 0 + bit 2 ;Pending Request abschalten und Riegel ][
;MSDOS-Interruptprogrammierung ist ganz schön schweißtreibend...
;Wir sind leider immer noch nicht ganz fertig!
;Aber wenigstens gibt's jetzt keinen Rausschmiß mehr.
	mov	cl,ah		;da ist's einigermaßen sicher!
	DOS	3523h		;Abbruch-Interrupt
	push	es bx
	 mov	dx,ofs NullISR
	 DOS	2523h
	 DOS	351bh
	 push	es bx
	  DOS	251bh		;CTRL-Break - ebenfalls eine Null-TSR!
	  DOS	3524h		;Kritischer Fehler...
	  push	es bx
	   mov	dx,ofs NewInt24	;Rückgabewert IGNORE
	   DOS	2524h
	   call	InnerRunV
	  pop	dx ds
	  DOS	2524h		;Kritischer Fehler zurück
	 pop	dx ds
	 DOS	251bh		;CTRL-Break-Handler
	pop	dx ds
	DOS	2523h
	bset	[cs:TheSw],bit 2 ;Selbstentriegelung ][
	xor	al,al
	jr	@@e
@@d:	mov	al,0ffh
@@e:	mov	ah,al		;noch kopieren
	ret
endp RunV

proc InnerRunV
	DOS	62h		;Aktives PSP lesen
	push	bx
	 mov	bx,cs
	 DOS	50h		;Aktives PSP setzen
	 DOS	2fh		;DTA des Wirts retten
	 push	es bx
	  mov	dx,ofs DTA
	  DOS	1ah		;DTA "nach Hause" setzen
	  push	ds si bp
	   DOS	59h		;Erweiterte Fehlerinfo lesen
	  pop	bp si ds	;Zerstörte Register restaurieren
	  push	es es di di dx cx bx ax ;Fehler-Infos retten
	   LD	es,cs		;DS steht ja wohl noch!
	   dec	cl		;Funktion 0 ausklammern
	   cmp	cl,6		;nur 6 Funktionen erst einmal
	   jnc	@@m		;Überlauf!
	   mov	bl,cl
	   mov	bh,0
	   shl	bx,1
	   cld			;Geordnete Verhältnisse unbedingt!
	   call	[IntUpv+bx]
@@m:	   mov	dx,sp		;DS:DX zeigt immer noch auf ErrorInfos
	   DOS	5d0ah		;Set Error Info
	  add	sp,16		;Stack korrigieren
	 pop	dx ds
	 DOS	1ah		;DTA rücksetzen
	pop	bx
	DOS	50h		;PSP rücksetzen
endp InnerRunV

proc GetAdrs	;dem Anwender 3 Adressen mitgeben...
	mov	cx,ofs Req0	;hier kann er Seiten anfordern
	mov	si,ofs CurIdx	;hier weiß er, wie groß der Index z.Z. ist
	mov	di,ofs Index	;und hier ist der Index selbst
	ret
endp

proc EnableBackground
	bset	[TheSw],bit 1
	ret
endp

proc DisableBackground
	bres	[TheSw],bit 1
	ret
endp

Detected encoding: OEM (CP437)1
Wrong umlauts? - Assume file is ANSI (CP1252) encoded