home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
norge.freeshell.org (192.94.73.8)
/
192.94.73.8.tar
/
192.94.73.8
/
pub
/
computers
/
cpm
/
alphatronic
/
CGRAPH.ZIP
/
FORTRAN.DOC
< prev
next >
Wrap
Text File
|
1998-07-30
|
3KB
|
129 lines
The following code may be substituted or added to the source code for
PLOT.MAC to provide linkage capability to MicroSoft's FORTRAN-80 compiler.
This version is untested, if any correction are found necessary please
inform me so that I may update the source for other PLOT users.
Thank you.
IF FORTRAN
;******************************************************************************
;
; PARAMETER LINKAGE ROUTINE FOR FORTRAN-80
;
; All calls to plot functions must be via this parameter linkage
; routine. FORTRAN-80 expects each external subroutine call to comply
; with a fixed field of parameters.
;
; The method of passing parameters depends upon the number of parameters
; to pass:
;
; 1. if less than or equal to 3, they are passed in the
; registers. Parameter 1 in HL, 2 in DE (if present),
; and 3 in BC (if present).
;
; 2. if the number of parameters is greater than 3, they
; are passed as follows:
; a. parameter 1 in HL,
; b. parameter 2 in DE,
; c. parameters 3 through N in a contiguous data
; block. BC will point to the low byte of this
; data block. (ie., to the low byte of parameter 3).
;
; All parameters are actually pointers to the actual values.
;
; The calling convention from FORTRAN-80 is as follows:
;
; EXTERNAL FPLOT
;
; CALL FPLOT('-',p1,p2,p3,p4,p5,p6,p7)
;
; where '-' is replaced by 'T', 'C', 'P', etc.
;
; FORTRAN-80 will pass the Hollirith value in an INTEGER storage
; location pair.
;
; p7 - should be declared as an INTEGER and not LOGICAL.
;
FPLOT:
PUSH HL ; save pointer #0 - to Hollirith value
LD (P1),DE ; save pointer #2
LD D,6 ; five pointers left
LD H,B
LD L,C ; use HL reg for access
LD BC,P3 ; point to next local storage
FPLOT1:
LD A,(HL) ; get low value
LD (BC),A ; save it
INC HL ; next byte
INC BC
LD A,(HL)
LD (BC),A ; save it
INC HL
INC BC
DEC D
JR NZ,FPLOT1 ; do all the parameters
;
LD C,7 ; now get actuals into p1-p7
LD HL,P1 ; start with p1
FPLOT2:
CALL HLTOHL
DEC C
JR NZ,FPLOT2 ; do all paramters
;
POP HL ; HL points to parameter #0
LD A,(HL) ; get Hollirith value for branch
;
CP 'A'
JP Z,AXIS
CP 'a'
JP Z,AXIS ; vector AXIS procedure
CP 'L'
JP Z,LINE
CP 'l'
JP Z,LINE ; vector LINE procedure
CP 'P'
JP Z,PLOT
CP 'p'
JP Z,PLOT ; vector PLOT procedure
CP 'D'
JP Z,POINT
CP 'd'
JP Z,POINT ; vector POINT procedure
CP 'I'
JP Z,INIT
CP 'i'
JP Z,INIT ; vector INIT procedure
CP 'C'
JP Z,CIRCLE
CP 'c'
JP Z,CIRCLE ; vector CIRCLE procedure
CP 'T'
JP Z,XFRPLT
CP 't'
JP Z,XFRPLT ; vector XFRPLT procedure
FERR:
JP STERR + 1 ; bad procedure call
; print error message & return
;
; Transfer actual parameter to location pointed to indirectly by
; the HL register pair
;
HLTOHL:
LD E,(HL)
INC HL
LD D,(HL) ; DE = address of parameter
DEC HL
EX DE,HL ; HL = address of FORTRAN parameter
LD A,(HL) ; get low byte
LD (DE),A ; store it
INC HL
INC DE
LD A,(HL) ; get high byte
LD (DE),A
EX DE,HL ; HL = address of p(i)
INC HL ; point to next p(i)
RET
;
ENDIF