
/INTEGER OPERATING SYSTEM FOR ROGALGOL COMPILER CODE
/VERSION 4

FIELD 0

*30
SP,	0
XPUSH,	0; DCA I SP; CMA; TAD SP; DCA SP; JMP I XPUSH

XPOP,	0; ISZ SP; TAD I SP; JMP I XPOP

PNEXT,	JMP I .+1; PNEX
NEXT,	JMP I .+1; NEX

SUDOMQ,	0
XOUT,	OUTDEV

PARAM=JMS I .; XPARAM
PUSH=JMS XPUSH
POP=JMS XPOP
NEXT6=JMS I .; XNEXT6
SW1=25
WORD=26
PC=10

*60;	0	/BIT11#0 FOR SYSTEMS OVERLAYS WHICHSET UP I/O DEVICE
		/3 WITH SINGLE DISK(1) CALL. BIT0#0 FOR OPTION T.

*67
T1,	0
T2,	0
T3,	0
T4,	0
T5,	0
ABAS,	0
DEV,	0
AKBCHK,	KBCHK
ADIX,	ERR

*100
NEX; ARR; SDEV; READ; PUT; STRING; PRINT; CHIN; CHOUT /CODES 0-8
J; EXPR; EN; GET; ADD; IGET; IPUT /CODES 9-15
SET; NEG; STOP; MUL; DIV; SUB; EQ; NE; LT /CODES 16-24
GT; LE; GE; JNT; PNEXT; NOT; XAND; OR; INIT /CODES 25-33
FORST; EO; EP; GP; GG; DI; SKIP; NEX; SETH /CODES 34-42
EO; ETWO; ETHRE; EFOUR; EXTPR; STOP; STOP; STOP /CODES 43-50
STOP; STOP; STOP; STOP; STOP; STOP; STOP; STOP /CODES 51-58
STOP; STOP; STOP; STOP; STOP	/CODES 59-63

*200

	JMP I 141	/NO TEST FOR CODE PRESENT

XNEXT6,	0; ISZ SW1; JMP NEXWD
	TAD WORD; AND (77; JMP I XNEXT6
NEXWD,	CDF 10; TAD I PC; CDF
	DCA WORD; CLA CMA; DCA SW1
	TAD WORD; RTR; RTR; RTR; AND (77; JMP I XNEXT6

PNEX,	DCA I SP; CMA; TAD SP; DCA SP
NEX,	ISZ SW1; JMP NEXA
	TAD WORD; AND (77; TAD (JMP I 100; DCA .+1; HLT
NEXA,	CDF 10; TAD I PC; CDF
	DCA WORD; CLA CMA; DCA SW1
	TAD WORD; RTR; RTR; RTR; AND (77
	TAD (JMP I 100; DCA .+1; HLT

J,	DCA SW1; CMA; CDF 10; TAD I PC
	DCA PC; JMP NEXA+1

EP,	NEXT6; JMP EN
EFOUR,	IAC
ETHRE,	IAC
ETWO,	IAC
EO,	IAC
EN,	DCA T3; JMS I AKBCHK	/NUMBER OF PARAMS TO T3
	TAD 23; DCA 11	/ADDRESS V0 NEW LEVEL
	TAD ABAS; DCA I 11	/V0=OLD ARRAY BASE
	CDF 10; TAD I PC; DCA T1	/ADDRESS OF PROCEDURE
	TAD I T1; CDF; IAC; TAD 23; DCA 23 /ADD FIXED SPACE TO POINTER
	TAD 22; DCA I 11	/SAVE BASE OF OLD LEVEL IN V1
	CMA; TAD 11; DCA 22 /NEW BASE = OLD FREE SPACE POINTER+1
	TAD PC; DCA I 11	/SAVE RETURN ADDRESS IN V2
	TAD T1; DCA PC	/SET PC TO ENTER PROCEDURE
	TAD T3; SNA; JMP NEXA	/ENTER IF NO PARAMS
	TAD 11; IAC; DCA T2	/ADDRESS LAST PARAMATER
	TAD T3; CIA; DCA T3	/SET UP COUNT
EP1,	ISZ SP; TAD I SP; DCA I T2; ISZ T3; SKP; JMP NEXA
	CMA; TAD T2; DCA T2
	JMP EP1

ARR,	NEXT6; CIA; DCA T4	/NO. OF DECLARATIONS
	NEXT6; TAD 20; DCA T1	/ADDRESS OF FIRST
	POP; DCA T2; POP; DCA T3 /BOUNDS
	TAD T3; CIA; TAD T2; IAC; DCA T2 /SIZE
AR1,	TAD T3; CIA; TAD 23; IAC; DCA I T1/ADDRESS ELEM. ZERO
	ISZ T1; TAD 23; TAD T2; DCA 23
	ISZ T4; JMP AR1; JMP I NEXT+1

*400
GG,	NEXT6; TAD 20; DCA T1
	TAD I T1; JMP I PNEXT+1

EXTPR,	CMA
EXPR,	DCA T1
	CMA; TAD 22; DCA 11	/ADDRESS V0
	TAD 11; DCA 23	/FREE SPACE POINTER=OLD BASE-1
	TAD I 11; DCA ABAS
	TAD I 11; DCA 22	/RESTORE OLD BASE
	JMP EXCON


INIT,	DCA SW1; CLA; DCA PC; IAC; DCA DEV /TELETYPE
	TAD XEINT; DCA 20	/VARAIBLES START AFTER INTERPRETER
	TAD 20; DCA 22	/LOCAL BASE IS GLOBAL BASE
	TAD 21; TAD 22; DCA 23	/FREE SPACE POINTER
	TAD 23; DCA ABAS	/ARRAYS START AT BOTTOM OF FREE SPACE
	TAD STSP; DCA SP	/WORKING STACK BEFORE SYSTEM
	RFC; TLS; PLS; JMP NEXT
XEINT,	EINT
STSP,	5560	/JUST BELOW OS/8 DRIVER

AAAMUL=.
MUL,	DCA T4; JMS SIGN1; DCA M1; JMS SIGN1
	DCA SUDOMQ; JMS PSDMUY
M1,	0; JMP SIGN2

AAADIV=.
DIV,	DCA T4; JMS SIGN1; DCA D1; JMS SIGN1
	DCA SUDOMQ; JMS PSDDVI
D1,	0
SIGN2,	CLA; TAD SUDOMQ; DCA SIGN1; TAD T4; RAR; CLA
	TAD SIGN1; SZL; CIA; JMP PNEXT
SIGN1,	0; ISZ SP; TAD I SP; SPA; ISZ T4; SPA; CIA; JMP I SIGN1

IPUT,	ISZ SP; TAD I SP; DCA T1	/VALUE
	NEXT6; TAD 20; DCA T2	/ADDRESS ARRAY VARIABLE
	TAD I T2; ISZ SP; TAD I SP; DCA T2	/ADDRESS ELEMENT
	TAD T1; DCA I T2; JMP I NEXT+1

NEG,	ISZ SP; TAD I SP; CIA; JMP I PNEXT+1

NOT,	ISZ SP; TAD I SP; CMA; JMP I PNEXT+1

XAND,	ISZ SP; TAD I SP; DCA T1; ISZ SP; TAD I SP
	AND T1; JMP I PNEXT+1

XPARAM,	0
	ISZ SW1; NOP; CDF 10
	TAD I PC; CDF; JMP I XPARAM

STOP,	JMP I .+1; WAIT

SDEV,	ISZ SP; TAD I SP; DCA DEV; JMP I NEXT+1

SUB,	POP; CIA; POP; JMP I PNEXT+1

EQ,	ISZ SP; TAD I SP; CIA
	ISZ SP; TAD I SP; SNA CLA; CMA; JMP I PNEXT+1

*600

NE,	ISZ SP; TAD I SP; CIA; ISZ SP; TAD I SP
	SZA CLA; CMA; JMP I PNEXT+1

LT,	POP; CIA; POP; SPA CLA; CMA; JMP I PNEXT+1

GT,	POP; CIA; POP; SMA SZA CLA; CMA; JMP I PNEXT+1

LE,	POP; CIA; POP; SPA SNA CLA; CMA; JMP I PNEXT+1

GE,	POP; CIA; POP; SMA CLA; CMA; JMP I PNEXT+1

JNT,	CDF 10; TAD I PC
	CDF; DCA T1; ISZ SP; TAD I SP; SZA CLA; JMP I .+5
	CMA; TAD T1; DCA PC; JMP I .+1; NEXA

AAAOR=.
OR,	POP; DCA T1; POP; SZA CLA; JMP ORTRU
	TAD T1; JMP I PNEXT+1
ORTRU,	CMA; JMP I PNEXT+1

CHIN,	JMS INDEV; JMP I PNEXT+1

SETH,	NEXT6; JMP I PNEXT+1

FORST,	ISZ SP; TAD I SP; DCA T3	/FINAL VALUE
	ISZ SP; TAD I SP; DCA T2	/INCREMENT
	NEXT6; TAD P20; DCA T1	/GLOBAL OR LOCAL BASE
	NEXT6; TAD I T1; DCA T1	/ADDRESS CONTROLLED VARIABLE
	TAD T2; SMA CLA; CMA; DCA T4 /T4=0 IF INCR. NEGATIVE
	TAD T2; TAD I T1; DCA I T1	/DO INCREMENT
	TAD I T1; CIA; TAD T3; ISZ T4; CIA /FINAL-CURRENT
	SMA CLA; CMA; JMP I PNEXT+1
P20,	20

SET,	TAD SW1; SZA CLA; JMP SET1	/IS CONSTANT IN NEXT WORD?
	CDF 10; TAD I PC; CDF; JMP I PNEXT+1	/YES
AASET1=.
SET1,	TAD WORD; AND (77; DCA T2	/MS BITS
	CDF 10; TAD I PC; CDF; DCA WORD
	TAD WORD; RAL; AND (7600 /LS BITS
	TAD T2; RTL; RTL; RTL; JMP I PNEXT+1

IGET,	NEXT6; TAD 20; DCA T1	/ADDRESS ARRAY VARIABLE
	ISZ SP; TAD I SP; TAD I T1; DCA T1	/ADDRESS ELEMENT
	TAD I T1; JMP I PNEXT+1

GP,	NEXT6; TAD 20; DCA T1
	ISZ SP; TAD I SP; DCA I T1; JMP I NEXT+1

*1000

READ,	DCA T1; DCA T2; JMS READ1
	TAD (-215; SNA; JMP READ+2
	TAD (215-240; SNA; JMP READ+2
	TAD (240-212; SNA; JMP READ+2
	TAD (212-255; SZA; JMP POS
	JMS READ1; JMP LOOPR
POS,	TAD (255; DCA T4; CMA; DCA T2; TAD T4
LOOPR,	TAD (-260; SPA; JMP EREAD
	TAD (-11; SMA SZA; JMP EREAD
	TAD (11; DCA T3
	TAD T1; CLL RTL; TAD T1; CLL RAL
	TAD T3; DCA T1; JMS READ1; JMP LOOPR
EREAD,	CLA; TAD T1; ISZ T2; CIA; JMP PNEXT

READ1,	0
	CLA CMA; TAD DEV; SZA CLA; JMP NOECHO
	JMS TTIN; JMP I READ1
NOECHO,	JMS INDEV; JMP I READ1

STRING,	NEXT6; SNA; JMP I NEXT+1
	TAD (-40; SPA; TAD (100; TAD (240
	JMS I XOUT; JMP STRING

AAPRIN=.
PRINT,	POP; CLL; SPA; CIA CML; DCA SUDOMQ
	TAD (255; SZL; JMS I XOUT; CLA; DCA T5
	JMS PSDDVI; 12; DCA T1; JMS PSDDVI; 12; DCA T2
	JMS PSDDVI; 12; DCA T3; TAD SUDOMQ; SZA; JMS DIG
	TAD T3; JMS DIG; TAD T2; JMS DIG
	TAD T1; TAD (260; JMS I XOUT; JMP NEXT

DIG,	0; SNA; JMP D0
PRDIG,	TAD (260; JMS I XOUT; JMP I DIG
D0,	TAD T5; SNA CLA; JMP I DIG; JMP PRDIG

GET,	NEXT6; TAD 22; DCA T1
	TAD I T1; JMP I PNEXT+1


*1200

INDLST,	ERR; LSI; HSI; ERR; ERR; ERR; ERR; ERR
OUTLST,	DUM; TTO; HSO; ERR; ERR; ERR; ERR; ERR

PSDDVI,	0
	DCA PSDCAM; TAD I PSDDVI; ISZ PSDDVI
	CLL CIA; DCA MQLMUY
	TAD P7763; DCA PSDLSR; JMP .+11
	TAD PSDCAM; RAL; DCA PSDCAM
	TAD PSDCAM; TAD MQLMUY; SZL
	DCA PSDCAM; CLA; TAD SUDOMQ; RAL; DCA SUDOMQ
	ISZ PSDLSR; JMP .-14
	TAD PSDCAM; JMP I PSDDVI
PSDCAM,	0
MQLMUY,	0
PSDLSR,	0
P7763,	7763

PSDMUY,	0
	CLA CLL; DCA MQLMUY; TAD P7763; DCA PSDLSR
	TAD I PSDMUY; DCA PSDCAM; ISZ PSDMUY; JMP .+10
	TAD MQLMUY; SNL; JMP .+3
	CLL; TAD PSDCAM; RAR
	DCA MQLMUY; TAD SUDOMQ; RAR; DCA SUDOMQ
	ISZ PSDLSR; JMP .-13; TAD MQLMUY; JMP I PSDMUY


DI,	POP; JMS I ADIX; JMP NEXT

INDEV,	0; TAD DEV; SNA; JMP INZER
	TAD XINLST; DCA .+1; HLT
	SNA; JMP .-2; TAD (-377; SNA; JMP .-5
	TAD (377; JMP I INDEV
INZER,	TAD 60; JMP I INDEV

OUTDEV,	0; DCA T5; TAD DEV; TAD XOUTLST; DCA .+2
	TAD T5; HLT; CLA; JMP I OUTDEV
XINLST,	JMS I INDLST
XOUTLS,	JMS I OUTLST

LSI,	0; KSF; JMP .-1; JMS I AKBCHK; KRB; JMP I LSI

SHL6,	0; RTL; RTL; RTL; AND (7700; JMP I SHL6

PUT,	NEXT6; TAD 22; DCA T1
	ISZ SP; TAD I SP; DCA I T1; JMP I NEXT+1

EXCON,	TAD I 11; DCA PC	/RESTORE PC
	ISZ T1; JMP NEXA	/TYPE PROCEDURE?
	DCA SW1; TAD I 11; JMP I PNEXT+1	/YES, GET RESULT

*1400

MESS,	0; TAD I MESS; ISZ MESS; SNA; JMP I MESS
	JMS TTO; CLA; JMP MESS+1

OCTOUT,	0; DCA SUDOMQ
	JMS PSDDVI; 10; TAD (260; DCA DIG4
	JMS PSDDVI; 10; TAD (260; DCA DIG3
	JMS PSDDVI; 10; TAD (260; DCA DIG2
	TAD SUDOMQ; TAD (260; JMS TTO
	CLA CLL; JMS MESS
DIG2,	0
DIG3,	0
DIG4,	0; 0; JMP I OCTOUT

TTIN,	0; JMS LSI; JMS TTO
	TAD XM215; SNA; JMP CR
CROUT,	TAD X215; JMP I TTIN
CR,	TAD X212; JMS TTO; CLA; JMP CROUT
X215,	215
X212,	212
XM215,	-215

ERR,	0; CLA; TAD (277; JMS TTO; CLA
	TAD ERR; JMS OCTOUT
WAIT,	KCC; JMS MESS; 215; 212; 336; 0
	JMS KBCHK; JMP .-1

KBCHK,	0;
X7600,	7600; KSF; JMP I KBCHK
	KRS; TAD (-220; SNA; JMP EXECUT
	TAD (220-223; SNA; JMP WAIT
	TAD (223-203; SZA CLA; JMP I KBCHK
	KCC; CDF CIF; JMP I X7600
EXECUT,	KCC; CDF CIF; JMP I X200
X200,	200


HSI,	0; JMS KBCHK; RSF; JMP .-2; RRB RFC; JMP I HSI
DUM,	0; JMP I DUM
TTO,	0; TSF; JMP .-1; TLS; JMP I TTO
HSO,	0; PSF; JMP .-1; PLS; JMP I HSO

ADD,	ISZ SP; TAD I SP; ISZ SP; TAD I SP; JMP I PNEXT+1

CHOUT,	ISZ SP; TAD I SP; JMS I XOUT; JMP I NEXT+1

SKIP,	TAD (215; JMS I XOUT; TAD (212; JMS I XOUT; JMP I NEXT+1

PAGE
EINT=.
$
