Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0003/calfor.mac
There is 1 other file named calfor.mac in the archive. Click here to see a list.
	title calfor - module to call fortran for arithmetic errors

comment %

***************************************************
WARNING:  This module uses KL instructions !!!!!!!
***************************************************

You must load this with FORDUM, rather than FORERR, if you are
to avoid (1) undefined symbols (2) calls to the emulator.  If
necessary, you should load FORDUM explicitly with the program,
using the modified version of FORDUM furnished with PASCAL.

The exception to this is that if you do not want fortran to
print any messages at all, you should let FORERR come in from
FORLIB.  It will be default be set up with ERRSET(0), i.e. you
will never see any messages.  Since nothing is printed, no
emulator calls happen and everybody is happy.  Should you need
some other value of ERRSET, you would have to fix up FORERR to
run in native mode.  Also, ignore the undefined globals when
FORERR is loaded.

The routine is designed to be set up as the handler for channels
6 and 7, using the normal pascal psidefine, e.g.

  psidefine(6,1,calfor);
  psidefine(7,1,calfor);
  psienable(6);
  psienable(7);

Good luck.
%

entry calfor

	reloc 0

	t==0
	a==1
	b==2
	c==3
	d==4
	e==5
	f==6
	p==17

;where called by the interrupt procedure, arguments are set up:
;	c - old PC
;	e - where the saved old PC is
;	f - where the saved AC's are

calfor:	move t,-1(c)	;interrupted instruction
	movem t,pc-1	;where fortran will find it
	hrri c,pc	;fake up PC to point to our return addr
	movem c,.jbtpc##;where fortran looks for PC
	hrrzs (e)	;clear error bits in PC for return
	movei t,free	;some free space for Fortran's static work space
	movem t,.jbops##
	hrrz c,trpin.##	;where to start fortran
	movem c,forcal	;put in location from which we will do indirect jrst
	hrrzm f,whereac	;save where ac's are
	hrlzi 0,1(f)	;restore ac's to the way the interrupted program had
	hrri 0,1
	blt 0,16
	move 0,@whereac
	jrst @forcal

	block 1		;here is where the interrupted instruction goes
			;and fortran is told PC points here:
pc:	dmovem 0,@whereac;put back ac's to program
	hrrz 1,whereac
	move 0,1
	adjsp 0,2	;just a funny way of adding 2 to both halves
	blt 0,16(1)
	popj p,

free:	block 300	;this is a dummy static data area for Fortran
forcal:	block 1
whereac:block 1	
	end