// header file for the PDP 11 code-generator  NOV 77
 
GET "libhdr"

manifest
$(
   fitch = true
$)
    
MANIFEST
$(
//relocatable object blocks
T.HUNK=1000
T.RELOC=1001
T.END=1002
$)
 
MANIFEST $( SECWORD=12345 $)
 
MANIFEST
$(
// OCODE keywords
S.TRUE=4; S.FALSE=5
S.RV=8; S.FNAP=10
S.MULT=11; S.DIV=12; S.REM=13
S.PLUS=14; S.MINUS=15; S.QUERY=16; S.NEG=17; S.ABS=19
S.EQ=20; S.NE=21; S.LS=22; S.GR=23; S.LE=24; S.GE=25
S.NOT=30; S.LSHIFT=31; S.RSHIFT=32; S.LOGAND=33
S.LOGOR=34; S.EQV=35; S.NEQV=36
S.LP=40; S.LG=41; S.LN=42; S.LSTR=43; S.LL=44
S.LLP=45; S.LLG=46; S.LLL=47
S.NEEDS=48; S.SECTION=49
S.RTAP=51; S.GOTO=52; s.mark = 53
S.RETURN=67; S.FINISH=68
S.SWITCHON=70
S.GLOBAL=76
S.SP=fitch->84,80; S.SG=81; S.SL=82; S.STIND=83
S.JUMP=85; S.JT=86; S.JF=87; S.ENDFOR=88; s.blab = 89
S.LAB=90; S.STACK=91; S.STORE=92; S.RSTACK=93; S.ENTRY=94
S.SAVE=95; S.FNRN=96; S.RTRN=97; S.RES=98
S.DATALAB=100; S.ITEML=101; S.ITEMN=102
S.ENDPROC=103
S.DEBUG=109; S.NONE=111
S.GETBYTE=120; S.PUTBYTE=121
$)
 
// selectors
MANIFEST $( H1=0; H2=1; H3=2; H4=3  $)
 
 
GLOBAL $(
 
// global routines
CGSECTS:firstfreeglobal + 00
RDN:firstfreeglobal + 01
RDL:firstfreeglobal + 02
RDGN:firstfreeglobal + 03
NEXTPARAM:firstfreeglobal + 04
CHECKPARAM:firstfreeglobal + 05
CGERROR:firstfreeglobal + 06
INITSTACK:firstfreeglobal + 07
STACK:firstfreeglobal + 08
STORE:firstfreeglobal + 09
SCAN:firstfreeglobal + 10
CGPENDINGOP:firstfreeglobal + 11
CGGLOBCALL:firstfreeglobal + 12
NUMBERIS:firstfreeglobal + 13
GETVALUE:firstfreeglobal + 14
MOVETOANYRSH:firstfreeglobal + 15
MOVETOANYR:firstfreeglobal + 16
MOVETOR:firstfreeglobal + 17
LOOKINREGS:firstfreeglobal + 18
LOOKINFREEREGS:firstfreeglobal + 19
NEXTR:firstfreeglobal + 20
REGUSEDBY:firstfreeglobal + 21
ISFREE:firstfreeglobal + 22
FREEREG:firstfreeglobal + 23
STORET:firstfreeglobal + 24
LOADT:firstfreeglobal + 25
LOSE1:firstfreeglobal + 26
CGBYTEAP:firstfreeglobal + 27
CGSTIND:firstfreeglobal + 28
STOREIN:firstfreeglobal + 29
CGRV:firstfreeglobal + 30
CGSHIFTK:firstfreeglobal + 31
CGADDK:firstfreeglobal + 32
CGPLUS:firstfreeglobal + 33
CGMINUS:firstfreeglobal + 34
CGLOGAND:firstfreeglobal + 35
CGGLOBAL:firstfreeglobal + 36
CGENTRY:firstfreeglobal + 37
CGSAVE:firstfreeglobal + 38
CGAPPLY:firstfreeglobal + 39
CGRETURN:firstfreeglobal + 40
CGJUMP:firstfreeglobal + 41
CGCMP:firstfreeglobal + 42
CGSWITCH:firstfreeglobal + 43
BSWITCH:firstfreeglobal + 44
LSWITCH:firstfreeglobal + 45
CHECKBREFS:firstfreeglobal + 46
GENBREFJUMPS:firstfreeglobal + 47
BRLABREF:firstfreeglobal + 48
CONDBRFN:firstfreeglobal + 49
GENBRANCH:firstfreeglobal + 50
GENMOV:firstfreeglobal + 51
GENSD:firstfreeglobal + 52
GENRS:firstfreeglobal + 53
GENRD:firstfreeglobal + 54
GEND:firstfreeglobal + 55
GEN:firstfreeglobal + 56
GENJ:firstfreeglobal + 57
FORMSADDR:firstfreeglobal + 58
FORMDADDR:firstfreeglobal + 59
FORMADDR:firstfreeglobal + 60
REMEM:firstfreeglobal + 61
SETINFO:firstfreeglobal + 62
FORGET:firstfreeglobal + 63
FORGETVARS:firstfreeglobal + 64
FORGETALL:firstfreeglobal + 65
CODE:firstfreeglobal + 66
CODERAND:firstfreeglobal + 67
CODED:firstfreeglobal + 68
CODERS:firstfreeglobal + 69
CODESD:firstfreeglobal + 70
INSERTCOUNT:firstfreeglobal + 71
SETLAB:firstfreeglobal + 72
CGLAB:firstfreeglobal + 73
CGNAME:firstfreeglobal + 74
RAD50:firstfreeglobal + 75
CGSTRING:firstfreeglobal + 76
LABREF:firstfreeglobal + 77
CGDATA:firstfreeglobal + 78
CGSTATICS:firstfreeglobal + 79
INITDATALISTS:firstfreeglobal + 80
CHECKSPACE:firstfreeglobal + 81
OUTPUTSECTION:firstfreeglobal + 82
OBJWORD:firstfreeglobal + 83
RSXWORD:firstfreeglobal + 84
ENDRECORD:firstfreeglobal + 85
DBOUTPUT:firstfreeglobal + 86
WRKN:firstfreeglobal + 87
 
 
// global variables
ARG1:firstfreeglobal + 90
ARG2:firstfreeglobal + 91
PENDINGOP:firstfreeglobal + 92
OP:firstfreeglobal + 93
TEMPV:firstfreeglobal + 94
TEMPT:firstfreeglobal + 95
SSP:firstfreeglobal + 96
DLIST:firstfreeglobal + 97
DLISTE:firstfreeglobal + 98
REFLIST:firstfreeglobal + 99
REFLISTE:firstfreeglobal + 100
NEEDSLIST:firstfreeglobal + 101
NEEDSLISTE:firstfreeglobal + 102
STVP:firstfreeglobal + 103
STV:firstfreeglobal + 104
DP:firstfreeglobal + 105
PROGSIZE:firstfreeglobal + 106
REG.K:firstfreeglobal + 107
REG.N:firstfreeglobal + 108
MOVED:firstfreeglobal + 109
ADDR.M:firstfreeglobal + 110
ADDR.V:firstfreeglobal + 111
CASEK:firstfreeglobal + 112
CASEL:firstfreeglobal + 113
PARAMNUMBER:firstfreeglobal + 114
BREFV:firstfreeglobal + 115
BREFP:firstfreeglobal + 116
BREFT:firstfreeglobal + 117
LABV:firstfreeglobal + 118
INCODE:firstfreeglobal + 119
MAXGN:firstfreeglobal + 120
MAXLAB:firstfreeglobal + 121
MAXSSP:firstfreeglobal + 122
STKCHKING:firstfreeglobal + 123
PROCSTK:firstfreeglobal + 124
PROCSTKP:firstfreeglobal + 125
MAPPING:firstfreeglobal + 126
NAMING:firstfreeglobal + 127
CALLCOUNTING:firstfreeglobal + 128
PROFILE:firstfreeglobal + 129
COUNTFLAG:firstfreeglobal + 130
RESTRICTED:firstfreeglobal + 131
LISTING:firstfreeglobal + 132
BINING:firstfreeglobal + 133
RSXOBJ:firstfreeglobal + 134
OVERLAYING:firstfreeglobal + 135
DEBUGGING:firstfreeglobal + 136
GOSTREAM:firstfreeglobal + 137
OCODE:firstfreeglobal + 138
BINV:firstfreeglobal + 139
BINP:firstfreeglobal + 140
$)
 
 
MANIFEST
$(
// registers
R0=0; R1=1; R2=2; R3=3; R.G=4; R.P=5; R.SP=6; R.PC=7
 
// items in simulated stack, in registers, or
// arguments to GEN routines
K.NONE=1
K.NUMB=2
K.LOC=3; K.GLOB=4; K.LAB=5
K.MLOC=6; K.MGLOB=7; K.MLAB=8
K.LVLOC=9; K.LVGLOB=10; K.LVLAB=11
K.REG=12
K.X0=13; K.X1=14; K.X2=15; K.X3=16
 
// global routine numbers
GN.STOP=2
GN.CHECKSTK=3
GN.MULT=4
GN.DIV =5
GN.REM =6
GN.LSHIFT=7
GN.RSHIFT=8
 
// PDP addressing modes
M.V=#100; M.L=#200 // operand and label flags
 
M.10=#10           // indirect bit
 
M.20=#20; M.V27=#127; M.L27=#227; M.2P=#25; M.2S=#26
 
M.4P=#45
 
M.V60=#160; M.V6G=#164; M.V6P=#165; M.V67=#167; M.L67=#267
M.V70=#170; M.V7S=#176; M.L77=#277
$)
 
MANIFEST
$(
// single operand instructions
// compiled by GEND(F,K,N)
F.CLR = #05000
F.CLRB=#105000
F.DEC = #05300
F.INC = #05200
F.NEG = #05400
F.ADC = #05500
F.TST = #05700
F.COM = #05100
F.ASR = #06200
F.ASL = #06300
F.SXT = #06700
F.ROR = #06000
F.SWAB= #00300
 
// register source instructions
// compiled by GENRS(F,K,N)
F.ASH = #72000
F.ASHC= #73000
F.MUL = #70000
F.DIV = #71000
 
// register destination instructions
// compiled by GENRD(F,K,N)
F.XOR = #74000
 
// jump instructions
// compiled by GENJ(F,R,K,N)
F.JMP = #00100
F.JSR = #04000
 
// double operand instructions
// compiled by GENSD(F,K1,N1,K2,N2)
F.MOV = #10000
F.MOVB=#110000
F.ADD = #60000
F.SUB =#160000
F.CMP = #20000
F.BIS = #50000
F.BISB=#150000
F.BIT = #30000
F.BIC = #40000
 
// branch and condition code instructions
// compiled by GENBRANCH(F,L), GEN(F)
F.BR  = #00400   // this bit reverses a cond branch
F.BEQ = #01400
F.BNE = #01000
F.BLT = #02400
F.BGE = #02000
F.BLE = #03400
F.BGT = #03000
 
F.CLC = #00241
$)

