Some Real Examples
The three sample programs provided in Figures E-2, E-3, and E-4 show how the same subroutine- adding three integer arguments-can be coded in FORTRAN-SO, PL/M-SO, and SOSO/SOS5 assembly language. Notice that each program requires three parameters.
Once you have processed your subroutine through the PL/M-SO or FORTRAN-SO compilers, or through the SOSO/SOS5 assembler, you can convert it to absolute object code and place it in memory with the LOCATE command. You must give the filename of your relocatable code file and the proper starting address for the subroutine code. In the example below, LOCATE returns absolute object code whose first byte is at address OEOOOH:
-LOCATE :F1 :PLMSUB.OBJ CODE (OEOOOH)
This command returns the absolute object file :Fl:PLMSUB. You can now load this located code into Intellec memory at its proper address with the monitor DEBUG command. When you enter the DEBUG command with your filename, you invoke the Monitor, as shown in the example below. The Monitor responds with a period (.), expecting further commands:
-DEBUG:F1 :PLMSUB #0000
You can now return to ISIS-II and test your subroutine. Leave the Monitor and return to ISIS-II by entering GS and a carriage return after the period:
.G8 (CR) ISIS-II Vm.n
Invoke BASIC-SO, and specify the highest memory address BASIC-SO can use with the MEMTOP option:
-:F1 :BASIC MEMTOP(ODFFFH)
This prevents BASIC-SO from writing over your subroutine. BASIC-SO will appear and tell you how much free memory you have left:
ISIS-II BASIC-80 V1.0 18157 BYTES FREE
Once in BASIC-SO you can write programs that use your subroutine. The following BASIC-SO program defines your subroutine as USRl, asks for three integers, passes these three integer values to the subroutine, defines the result of the subroutine as the variable RESULT, and finally prints RESULT:
10 REM THIS PROGRAM ASKS FOR THREE
20REM INTEGERS, PASSES THEM TO USR1, AND
30REM RETURNS THE RESULT.
40DEFINT A-Z
50DEFUSR 1=OEOOOH
60PRINT"ENTER THREE NUMBERS:"
70INPUT A,B,C
80PRINT" A=" ,A, "B=" ,B, "C=" ,C
90RESULT=USR%1(VARPTR(A), VARPTR(B), VARPTR(C»)
100PRINT"A+B+C="; RESULT
110END