This repository has been archived by the owner on May 31, 2022. It is now read-only.
forked from PDP-6/JOSS-II
-
Notifications
You must be signed in to change notification settings - Fork 0
/
josinit.mac
563 lines (465 loc) · 10.4 KB
/
josinit.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
TITLE PREAMBLE AND RECOVERY 8/1/67 COPYRIGHT 1966 THE RAND CORP.
; PG 1.
; JOSS INITIALIZATION AND RECOVERY PROGRAMS
; G.E. BRYAN
; ASSEMBLED 8/1/67 FROM TAPE 56 (A SEQUENCE COPY OF 31)
; BINARIES ON TAPE 24 AS IU
; PG 2
SUBTTL ASSEMBLY PARAMETERS
; INITIALIZATION DIALOG FOR JOSS STARTUP.
; THIS CODE MUST BE LOADED LAST, DIRECTLY
; PRECEDED BY DDT; A (THE ARITHMETIC) MUST
; BE LOADED FIRST TO PRESERVE A DDT ENTRY AT 140.
; ASSEMBLY PARAMETERS FOR THE PI CHANNELS
CDC=1; 1 - DATA CONTROL
CDRM=2; 2 - I/O PROCESSOR AND DRUM CONTROL
CI630=3; 3 - 630 INPUT
CO630=4; 4 - 630 OUTPUT
CDAT=6; INTERRUPT CHANNEL FOR TAPE
CCTY=6; 6 - CONSOLE TELETYPE
CAPR=7; 7 - PROCESSOR
CHDC=100; THESE ARE CORRESPONDING DEFINITIONS FOR PI CONOS
CHDRM=40;
CH630=30
CHDAT=0
CHCTY=2
CHAPR=1
MTC=220; DEVICE CODES FOR MAG TAPE REGISTERS
MT1=224
MT2=230
DR=400
DP=010
DMT=20; DATA CONTROL DEVICE NUMBER FOR MAG TAPE
DDK=50; AND FOR DISC
A=0
B=1
C=2
D=3
E=4
F=5
G=6
H=7
I=10
J=11
K=12; USED BY DISTRIBUTOR
L=13; USED BY DISTRIBUTOR
M=14; USED BY DISTRIBUTOR
N=15; USED BY DISTRIBUTOR
S=16; USED FOR STATION INDEX
PP=17; PUSH-POP REGISTER
DEFINE XMT (M,A); TRANSMIT M CHARACTERS FROM A
<OPDEF X[M'B12]
X A>
OPDEF TSX[PUSHJ PP,0]
OPDEF DONE[POPJ PP, 0]
; PG 3
SUBTTL INTERNS AND EXTERNS
EXTERN DDT,MONTH,YEAR,HR,MIN,ADATE,DATE
EXTERN CMESS,PROP,DRMR,C25,C26,CTYR,APRR
EXTERN OCTW
EXTERN CORE,C20,PPW,TYPE6,SOUT,HMES,SIGPR
INTERN DUMP,RJD,WJD,DATIME
INTERN SWITCH,FAKE,L100,BEGIN
DISMIS: Z
CONO PI,100+CHDC; TURN OFF INTERRUPT CHANNEL
JRST 12,@DISMIS; DISMISS INTERRUPT
; PG 4
SUBTTL DUMP CORE ON TAPE
SAVE=120; SAVE LOCATION FOR THE ACS
IOA=777700
DUMP: CONO PI,200; TURN ON THE INTERRUPT SYSTEM
EXCH B,[XWD 0,SAVE]
BLT B,SAVE+17; SAVE THE ACCUMULATORS
EXCH B,[XWD 0,SAVE]
MOVEM B,SAVE+1
CONO MTC,0
CONO MT1,2; READY UNIT ZERO
MOVE B,[JSR DISMIS]
MOVEM B,41+2*CDC
MOVE B,[BLKO DC,S]
MOVEM B,40+2*CDC
MOVEI E,0; LOCATION COUNTER
MOVEI F,20; A BLANK
MOVE D,[POINT 3,SAVE]
JRST TD1; FIRST THE ACCUMULATORS
TD05: CAIN E,20; AND THEN CORE
MOVE D,[POINT 3,20]; INPUT POINTER
TD1: MOVE G,[POINT 6,IOA]; OUTPUT POINTER
MOVEI B,0
IDPB F,G; CARRIAGE CONTROL
MOVE C,[POINT 3,E,^D20]; POINT TO LOCATION COUNTER
TD2: ILDB A,C
IDPB A,G; ADDRESS
CAIGE B,4
AOJA B,TD2
MOVEI B,10; EIGHT WORDS PER LINE
TD3: IDPB F,G
IDPB F,G; TWO BLANKS BETWEEN WORDS
TD4: MOVEI H,14; TWELVE CHARACTERS PER WORD
ILDB A,D
IDPB A,G; CONVERT TO BCD
SOJG H,.-2
SOJG B,TD3; JUMP IF LINE NOT FULL
IDPB F,G
IDPB F,G
CONSO MT1,40000; WAIT FOR XFER NEW COMMAND
JRST .-1; WAIT FOR TAPE CONTROL FREE
MOVE S,[XWD -^D20,IOA-1]; DATA CONTROL WORD
CONO DC,CDC+DMT+3400
CONO MTC,31000
CONO PI,2000+CHDC
CONSZ PI,CHDC; WAIT FOR DATA CONTROL FINISHED
JRST ,-1; WAIT FOR END OF RECORD
ADDI E,^D8
CAIGE E,100000; AINT NONE UP THERE
JRST TD05
CONSO MT1,40000
JRST .-1
CONO MTC,1400; END FILE
CONSO MT1,40000; WAIT FOR COMMAND OK
JRST .-1
CONO MTC,400; REWIND
JRST DDT; GO TO DDT
; PG 5
SUBTTL ROUTINE TO INPUT DATE AND TIME
DATIME: CONO TTY,3600; ALL TTY FLAGS OFF
TSX SLM; SET LOW MEMORY
TSX ADATE; CONVERT TO ASCII
TSX D50; ASK ABOUT DDT
TSX DTO; OUTPUT CURRENT DATE AND TIME
D1: SETZB D,H; SLASH COUNT AND CONVERTER
TSX LM
MOVEI B,6
MOVE C,[POINT 7,S1]
JSP G, TS; SEND "DATE: "
D2: JSP G,TTCH; GET TTY CHARACTER
CAIN F,"/"
JRST D10; ITS A SLASH
CAIN F,15
JRST D12; ITS A CR
ANDI F,160
CAIE F,60
JRST D1; NON-NUMERIC -- TRY AGAIN
DATAI TTY,F; RECOVER CHARACTER
ANDI F,17; MASK OFF ASCII BITS
IMULI D,^D10
ADD D,F
CAIL D,^D100;
JRST D1; DATE COMPONENT MUST BE < 100
JRST D2; GET ANOTHER
D10: CAIL H,2; HERE WE HAVE A SLASH
JRST D1; BUT ONLY 2 ARE ALLOWED
JUMPE D,D1; AND I MUST BE A NUMBER > 0
CAMLE D,R1(H); CHECK RANGE
JRST D1; GO ASK AGAIN
MOVEM D,MONTH(H); SAVE MONTH OR DAY
SETZM D; ZERO CONVERTER
AOJA H,D2
D12: JUMPE D,D14; HERE A CR, IF NOT DIGITS USE OLD VALUES
CAIGE D,^D66; CHECK YEAR
JRST D1; NOT UP TO DATE
MOVEM D,YEAR
; PG 6
D14: SETZM D
TSX LM
MOVEI B,6
MOVE C,[POINT 7,S2]
JSP G,TS
D16: JSP G,TTCH; GET A CHAR FROM TTY
CAIN F,":"
JRST D20; ITS A COLON
CAIN F,15
JRST D22; ITS A CR
ANDI F,160
CAIE F,60; MUST BE NUMERIC
JRST D14; NON-NUMERIC
DATAI TTY,F; RECOVER CHARACTER
ANDI F,17; MASK TO NUMERIC
IMULI D,^D10
ADD D,F; CONVERT TO BINARY
CAIL D,^D60;
JRST D14; TIME COMPONENT MUST BE < 60
JRST D16; GET NEXT
D20: MOVEM D,HR
SETZM D
JRST D16
D22: MOVEM D,MIN
TSX ADATE; CONVERT TO ASCII
TSX WJD; DUMP SYSTEM ON DRUM
DONE; DONE WITH INITIALIZATION
R1: DEC 12; BIGGEST MONTH
DEC 31; BIGGEST DAY
; PG 7
; ASK ABOUT DDT AND ALLOCATE USE OF USER BLOCKS ACCORDINGLY
D50: MOVEI J,DATIME
CAIGE J,40000
JRST D70; DDT AVAILABLE ANYWAY
TSX LM
MOVEI B,^D10
MOVE C,[POINT 7,S3]
JSP G,TS; ASK FOR DDT
D51: JSP G,TTCH; GET TTY CHAR
CAIN F,"Y"
JRST D70; YES - DDT
CAIN F,"N"
JRST D60; NO DDT
JRST D50; BAD CHAR - TRY AGAIN
D60: TSX LM
MOVEI B,6
MOVE C,[POINT 7,S5]
JSP G,TS; SAY: NO DDT
TSX LM
MOVEI J,DDT
JRST D71
D70: TSX LM
MOVEI B,^D13
MOVE C,[POINT 7,S4]
JSP G,TS; SAY: DDT AVAILABLE
TSX LM
D71: MOVEI C,0
D73: CAIGE J,40000
DONE
SETOM CORE(C); BUSY BLOCKS USED BY SYSTEM
SUBI J,2000
AOJA C,D73
; PG 8
; WRITE AND READ CONSOLE TTY
, SEND STRING TO CONSOLE TTY
, B IS CHAR COUNT, C IS POINTER, F IS USED
TS: ILDB F,C
DATAO TTY,F
CONSO TTY,10;
JRST .-1;
CONO TTY,200;
SOSE B;
JRST TS;
JRST (G);
S1: ASCII $DATE: $
S2: ASCII $TIME: $
S3: ASCII $DDT?-Y/N: $
S4: ASCII $DDT AVAILABLE$
S5: ASCII $NO DDT$
, OUTPUT DATE AND TIME TO CONSOLE
DTO: TSX LM
MOVEI B,^D15
MOVE C,PDATE
JSP G,TS
TSX LM
DONE
, READ AND ECHO ON TTY
TTCH: CONSO TTY,40
JRST .-1; WAIT FOR A CHAR
CONO TTY,1000; FLAG OFF
DATAI TTY,F; READ CHAR
DATAO TTY,F; ECHO BACK
CONSO TTY,10
JRST .-1; WAIT ON OUTPUT
CONO TTY,200; FLAG OFF
ANDI F,177; JUST 7 BITS
JRST (G); RETURN
, MOVE CARRIER TO LEFT MARGIN
LM: MOVE B,2
MOVE C,[POINT 7,CRLF]
JSP G,TS
DONE
CRLF: OCT 064240000000; CARIAGE RETURN,LINE FEED AND ZERO
PDATE: POINT 7,DATE; POINT TO DATE
; PG 9
SUBTTL RECOVERY AND ERROR DUMP ROUTINE
; ENTERED FOLLOWING READING JOSS FROM DRUM
RECOVER:MOVE C,42
MOVE D,43
MOVEI B,ACS; PLACE TO SAVE THE ACS FOR A MOMENT
BLT B,ACS+17
MOVE B,30
MOVEM B,ACS+1; AND REG 1
XCT BEG3; SET UP PUSH REGISTER
TSX CLEAR; CLEAR MACHINE FLAGS
TSX DISPLAY; SEND ERROR MESSAGE AND DUMP
TSX RESTORE; SET UP TO GO
CONO TTY,6; ENABLE TTY OUTPUT CHANNEL
CONO PI,2402; ENABLE CHANNEL FOR TTY
CONSZ TTY,20
JRST .-1; WAIT UNTIL NON-BUSY
TSX ADATE
JRST BEG5; AND GO.
; PG 10
SUBTTL CLEAR MACHINE STATUS
CLEAR: MOVEI B,7
JRST 10,.+1; DISMISS ALL INTERRUPTS
SOJG B,.-1
CONO TTY,1200; TTY FLAGS OFF
CONO APR,111000; PROCESSOR FLAGS OFF
CONO MT1,0; TAPE INTERRUPTS OFF
CONO DC,0; CLEAR DATA CONTROL
CONO 270,0; CLEAR DISC FILE
DONE
; PG 11
SUBTTL OUTPUT ERROR MESSAGE AND PANEL DUMP
DISPLAY:TSX CMESS
TSX MR0; SEND ERROR NUMBER
TSX CMESS
XMT ^D13,M100; AC TITLE
MOVEI F,ACS; PLACE THE ACS ARE STORED
EC1: TSX CMESS; DISPLAY ACS
TSX MR1
CAIGE F,ACS+20
JRST EC1
TSX CMESS
XMT ^D50,M101; VARIOUS @ CELLS
MOVE B,ACS+11; REGISTER 11
MOVEM B,SA
MOVEI F,SA
TSX CMESS
TSX MR1
TSX CMESS
XMT 5,M102; MORE LINE FEEDS
DONE
; PG 12
SUBTTL OUTPUT FORMATTING ROUTINES
; MAKE UP HALT NUMBER MESSAGE
MR0: MOVE F,40;
XMT ^D18,M102
MOVE A,F
TSX OCTW
DONE
; FORMAT FOUR OCTAL WORDS FROM (F) INTO A LINE
MR1: MOVEI G,4
MR1.1: MOVE A,(F)
TSX O1
AOS F
SOJG G,MR1.1
DONE
O1: TSX OCTW
XMT 3,BLANKS
DONE
M100: ASCII ?ACCUMULATORS:?
M101: ASCII ?OFFENDING LOCATION (11): CONTENTS(@11): @17: @0:?
M102: OCT 064241205024; CR AND 4 LFS
ASCII ?HALT NUMBER: ?
; PG 13
SUBTTL RESTORE DATE, TIME, ETC.
RESTORE:MOVE B,RE1
BLT B,MIN
TSX SLM; SET LOWER MEMORY
DONE
RE1: XWD 31,YEAR
BLANKS: ASCII ? ?
; SET UP LOWER MEMORY
SLM: MOVE A,[XWD LOC41,41]
BLT A,137
DONE
; PG 14
SUBTTL LOW MEMORY CONTENTS
; 0-17 EXEC LOADER (SHADOW MEMORY)
; 20-27 PAPER TAPE LOADER - RIM
; 30 SAVE CELL FOR REG 1 DURING RECOVERY
; 31-35 SAVE CELLS FOR DATE AND TIME IN RECOVERY
; 36-37 USED BY DDT
; 40-41 UUO CELLS
; 42-57 INTERRUPT SYSTEM TRAP CELLS
; 60-77 PART OF DRUM READ ROUTINE
; 100 PSEUDO SWITCHES
; 101 DUMP ENTRY
; 102 PSEUDO CONSOLE SIGNAL CELL
; 103 ENTRY TO READ DRUM ROUTINE
; 104 DRUM READ AND WRITE ROUTINES
; PG 15
SUBTTL LOW MEMORY CELLS
; CONTENTS OF CELLS 41-137
LOC41: JSR PROP
Z
JSR DDT; 43
JSR DRMR; 44 - CHANNEL 2, THE DRUM
Z
JSR C25; 46 - CHANNEL 3, 630 INPUT
Z
JSR C26; 48 - CHANNEL 4, 630 OUTPUT
Z
JRST DDT; 52 - CHANNEL 5, DISC FILE
Z
JSR CTYR; 54 - CHANNEL 6, TAPE AND CONSOLE TTY
Z
JSR APRR; 56 - CHANNEL 7, PROCESSOR
Z
; DEFINITIONS FOR WHEN DRUM CODE IS MOVED TO LOW MEMORY
BTW=116
RJ=60
RIO=72
DS=73
DS1=74
SWITCH=100
FAKE=102
RJD=103
WJD=117
WD=132
RC=135
SA=112
CKD=63
; PG 16
; READ AND WRITE JOSS ON DRUM
RJ.: CONO DP,0; 167 TO READ
JSP D,DS1
CONO DR,230; READ
CKD.: CONSO DR,1000; CHECK DRUM ERRORS
CONSZ DP,100060; IOP ERRORS
JRST 4,7770
CONSO DR,100; WAIT FOR DONE
JRST CKD
CONO DR,270; DESELECT
JRST (C)
RIO.: XWD -40000,40000; I/O WORD - 16K FROM UPPER BOX
DS.: CONO DP,100; SELECT FOR WRITE
DS1.: DATAO DP,RIO; DRUM SELECT
DATAO DP,B; UNIT AND TRACK
CONO DR,260; SELECT
JRST (D)
HALTS=20000
L100: Z; 100 - PSEUDO SWITCH CELL
JRST DUMP
FAKE.: Z; 102 - PSEUDO SIGNAL CELL
RJD.: MOVEI B,0; 103 - RECOVERY ENTRANCE
JSP C,RJ
MOVE B, BTW; MOVE TO LOW MEMORY
BLT B,37777
MOVEI B,2000
JSP C,RJ; FILL UPPER BOX
JRST RECOVER
SA.: BLOCK 4; FOUR SAVE CELLS
BTW.: XWD 40140,140; BLT CONTROL WORD
WJD.: MOVEI B,2000; WRITE JOSS ON DRUM
JSP C,WD; WRITE
JSP C,RC; READ COMPARE
MOVEI B,40000
BLT B,77777; MOVE LOW TO HIGH MEMORY
MOVEI B,0
JSP C,WD; WRITE LOW BOX
JSP C,RC; READ COMPARE
MOVEI B,2000
JSP C,RJ; READ BACK UPPER BOX
DONE
WD.: JSP D,DS; WRITE DRUM - SELECT
CONO DR,220; WRITE DRUM
JRST CKD; GO CHECK
RC.: JSP D,DS; READ COMPARE - SELECT
CONO DR,210; COMPARE DRUM AND CORE
JRST CKD
ACS: BLOCK 20; TEMP STORAGE FOR ACS
; PG 17
SUBTTL JOSS INITIALIZATION
BEGIN: CONO APR,210000; RESET STUFF
BEG3: MOVE PP,PPW
TSX DATIME; ASK FOR DATE AND TIME
CONO TTY,206; TURN OFF FTO FLAG AND ENABLE CHANNEL
BEG5: TSX C20; INITIALIZE IRWIN
CONO APR,122007; SET PROCESSOR FLAGS AND CHANNEL
CONO MTC,0
CONO MT1,2; GET TAPE DRIVE ZERO READY
CONO PI,20000; ENABLE PARITY ERROR TRAP
HRREI S,-2; CONTEXT FOR TAPE
MOVEI B,TYPE6
TSX SOUT
HRREI S,-1; CONTEXT FOR CONSOLE TTY
TSX HMES; LOAD HEADING MESSAGE
JRST SIGPR
END