forked from dspinellis/unix-history-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ed1.s
758 lines (727 loc) · 10.1 KB
/
ed1.s
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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
"[handwritten page number top right of scan - 1]
" ed1
lac d1
sys write; 1f; 3
lac o17
sys creat; tname
spa
sys save
dac sfo
sys open; tname; 0
spa
sys save
dac sfi
-1
tad lnodp
dac zermp
tad d1
dac zerop
dac dot
tad d1
dac eofp
dzm i eofp
dzm i zerop
dzm lastre
dzm fbuf
lac d1
dac dskadr
dac wrflg
dzm diskin
"o------------> [scan markup]
jmp advanc
1:
<ed>; <it>; 012
advanc:
jms rline
lac linep
dac tal
dzm adrflg
jms addres
jmp comand
-1
dac adrflg
lac addr
dac addr1
dac addr2
1:
lac char
sad o54
jmp 2f
sad o73
skp
jmp chkwrp
lac addr
dac dot
2:
jms addres
jmp error
lac addr2
dac addr1
lac addr
dac addr2
jmp 1b
"[handwritten page number top right of scan - 2]
chkwrp:
-1
tad addr1
jms betwen; d1; addr2
jmp error
comand:
lac char
sad o141
jmp ca
sad o143
jmp cc
sad o144
jmp cd
sad o160
jmp cp
sad o161
jmp cq
sad o162
jmp cr
sad o163
jmp cs
sad o167
jmp cw
sad o12
jmp cnl
sad o75
jmp ceq
jmp error
ca:
jms newline
jms setfl
lac addr2
dac dot
ca1:
jms rline
lac line
sad o56012
jmp advanc
jms append
jmp ca1
cc: cd:
jms newline
jms setdd
lac addr1
sad zerop
jmp error
dac dot
tad dm1
dac 9
lac addr2
dac 8
2:
lac i 8
dac i 9
sza
jmp 2b
lac 9
"[handwritten page number top right of scan - 3]
dac eofp
lac char
sad o144
jmp advanc
-1
tad dot
dac dot
jmp ca1
cp:
jms newline
cp1:
jms setdd
lac addr1
sad zerop
jmp error
1:
lac addr1
dac dot
lac i addr1
jms gline
dac 2f
lac d1
sys write; line; 2: 0
lac addr1
sad addr1
jmp advanc
tad d1
dac addr1
jmp 1b
cq:
jms newline
lac adrflg
sza
jmp error
sys exit
cr:
jms setfl
lac addr2
dac dot
jms rname
"------------> [scan markup]
sys open; fbuf; 0
spa
jmp error
dac tfi
lac linep
dac tal
dzm num
1:
lac tfi
sys read; tbuf; 64
sza
jmp 2f
lac tfi
sys close
jms number
jmp advanc
2:
cma
"[handwritten page number top right of scan - 4]
tad d1
rcl
dac c1
lac tbufp
dac tal1
2:
jms getsc; tal1
sna
jmp 3f
jms putsc; tal
isz num
sad o12
skp
jmp 3f
lac tal
add o400000
and o17777
cma
tad linep
cma
dac linsiz
jms append
lac linep
dac tal
3:
isz c1
jmp 2b
jmp 1b
cw:
jms setfl
lac i addr1
sna
jmp error
jms rname
lac o17
sys creat; fbuf
spa
jmp error
dac tfi
-128
dac c2
lac tbufp
dac tal1
dzm num
1:
lac i addr1
jms gline
rcl
cma
tad d1
dac c1
lac linep
dac tal
2:
jms getsc; tal
sna
jmp 3f
isz num
jmp putsc; tal1
isz c2
"[handwritten page number top right of scan - 5]
jmp 3f
lac tfi
sys write; tbuf; 64
-128
dac c2
lac tbufp
dac tal1
3:
isz c1
jmp 2b
lac addr1
sad addr2
jmp 1f
isz addr1
jmp 1b
1:
lac tal1
sma cla
jmp 1f
jms putsc; tal1
1:
-1
tad tbufp
cma
tad tal1
dac 1f
lac tfi
sys write; tbuf; 1: 0
lac tfi
sys close
jms number
jmp advanc
cnl:
lac adrflg
sna
jmp 1f
lac addr2
dac addr1
jmp cp1
1:
lac dot
tad d1
sad eofp
jmp error
dac dot
jmp cp1
ceq:
jms newline
jms setfl
lac addr2
dac dot
cma
tad zerop
cma
dac num
jms number
jmp advanc
setdd: 0
"[handwritten page number top right of scan - 6]
lac adrflg
sza
jmp i setdd
lac dot
dac addr1
dac addr2
jmp i setdd
setfl: 0
lac adrflg
sza
jmp i setfl
lac zerop
tad d1
dac addr1
-1
tad eofp
dac addr2
jmp i setfl
newline: 0
jms getsc; tal
sad o12
jmp i newline
jmp error
addres: 0
dzm minflg "..) [stray scan mark?]
-1
dac addr
ad1:
jms getsc; tal
ad2:
jms betwen; d47; d58
skp
jmp numb
sad o40 "[o40 circled in scan]
jmp ad1 "[hand drawn check mark follows operand in scan]
sad o11
jmp ad1 "[hand drawn check mark follows operand in scan]
"[check mark underlined in scan]
sad o55
jmp amin "[hand drawn check mark follows operand in scan]
sad o56
jmp adot "[hand drawn check mark follows operand in scan]
sad o53
jmp ad1 "[hand drawn check mark follows operand in scan]
sad o44
jmp adol "[hand drawn check mark follows operand in scan]
sad o57
jmp fsrch "[hand drawn check mark follows operand in scan]
sad o77
jmp bsrch "[hand drawn check mark follows operand in scan]
dac char
lac minflg
sza
jmp error
lac addr
sma
isz addres
jmp i addres
"[handwritten page number top right of scan - 7]
adot:
lac minflg
sza
jmp error
lac addr
sma
jmp error
lac dot
dac addr
jmp ad1
adol:
lac minflg
sza
jmp error
lac addr
sma
jmp error
-1
tad eofp
dac addr
jmp ad1
amin:
-1
dac minflg
jmp ad1
numb:
dac char
sad o60
jmp 1f
lac d10
jmp 2f
1:
lac d8
2:
dac 2f
dzm num
1:
lac num
cll; mul; 2: 0
lacq
tad char
tad dm48
dac num
jms getsc; tal
dac char
jms betwen; d47; d58
skp
jmp 1b
lac minflg
sna
jmp 1f
-1
tad num
cma
dac num
dzm minflg
1:
lac addr
"[handwritten page number top right of scan - 8]
spa
lac zerop
tad num
dac addr
jms betwen; zermp; eofp
jmp error
lac char
jmp ad2
number: 0
lac d100000
dac n1
law tbuf-1
dac 8
n0:
lac num
cll; idiv; n1: 0
dac num
lacq
tad d48
dac i 8
lac n1
cll; idiv; 10
lacq
dac n1
sza
jmp n0
lac o12
dac i 8
law tbuf-1
dac 8
dac 9
-5
dac n1
n2:
lac i 8
sad d48
skp
jmp n3
dzm i 9
isz n1
jmp n2
n3:
lac d1
sys write; tbuf; 7
jmp i number
rname: 0
lac fbufp
dac tal1
-8
dac c1
1:
jms getsc; tal
sad o40
jmp 1b
sad o12
jmp 1f
jms putsc; tal1
isz c1
jmp 1b
"[handwritten page number top right of scan - 9]
jmp i rname
1:
lac tal1
sad fbufp
skp
jmp 1f
lac fbuf
sna
jmp error
jmp i rname
1:
lac o40
jms putsc; tal1
isz c1
jmp 1b
jmp i rname
gline: 0
dac glint1
jms getdsk
lac glint1 " [these 6 lines were surrounded by a box
and o1777 " that was Xed out with an arrow pointing to it]:
tad dskbfp " --
dac ital "|\/|
lac linep "|/\|<---
dac otal " --
1:
lac ital
sad edskbfp
skp
jmp 2f
lac diskin
tad d1024
jms getdsk
lac dskbfp
dac ital
2:
jms getsc; ital
jms putsc; otal
sad o12
skp
jmp 1b
lac otal
sma
jmp 1f
cla
jms putsc; otal
1:
lac linpm1
cma
tad otal
jmp i gline
rline: 0
lac linep
dac tal
1:
cla
sys read; char; 1
lac char
"[handwritten page number top right of scan - 10]
lrss 9
jms esc
lac char
and o777
jms esc
jmp 1b
esc: 0
sna
jmp i esc
jms putsc; tal
sad o12
jmp 2f
sad o100
jmp 1f
sad o43
skp
jmp i esc
-1
tad tal
dac tal
and o17777
sad linpm1
jmp 1f
jmp i esc
1:
lac linep
dac tal
jmp i esc
2:
lac tal
sma cla
jmp 1f
jms putsc; tal
1:
-1
tad linep
cma
tad tal
dac linsiz
jmp i rline
getsc: 0
lac i getsc
dac sctalp
isz getsc
lac i sctalp
dac sctal
add o400000
dac i sctalp
ral
lac i sctal
szl
lrss 9
and o777
jmp i getsc
putsc: 0
and o777
"[handwritten page number top right of scan - 11]
lmq
lac i putsc
dac sctalp
isz putsc
lac i sctalp
dac sctal
add o400000
dac i sctalp
sma cla
jmp 1f
llss 27
dac i sctal
lrss 9
jmp i putsc
1:
lac i sctal
and o777000
omq
dac i sctal
lacq
jmp i putsc
append: 0
-1
tad eofp
dac 8
cma
tad dot
dac apt1
1:
lac i 8
dac i 8
-3
tad 8
dac 8
isz apt1
jmp 1b
isz eofp
dzm i eofp
isz dot
jms addline
jmp i append
addline: 0
lac dskadr
dac i dot
jms getdsk "[line crossed out - scan markup]
-1
tad linsiz
cma
dac apt1
law line-1
dac 8
lac dskadr "[line crossed out - scan markup]
and o1777 "[line crossed out - scan markup]
tad dskbfp "[line crossed out - scan markup]
dac otal "[line crossed out - scan markup]
lac dskadr "[line crossed out - scan markup]
tad linsiz "[line crossed out - scan markup]
dac dskadr "[line crossed out - scan markup]
"[handwritten page number top right of scan - 12]
1:
lac otal " [these 9 lines were surrounded by a box
sad edskbfp " that was Xed out]:
skp " --
jmp 2f "|\/|
lac diskin "|/\|
tad d1024 " --
jms getdsk "
lac dskbfp "
dac otal "
2: "[line crossed out - scan markup]
lac i 8
dac i otal "[line crossed out and a note that looks like *jms prtwrd*]
isz otal
dzm wrflg "[line crossed out - scan markup]
isz apt1
jmp 1b
jmp i addline
getdsk: 0 "[the entire getdsk procedure was surrounded
and o776000 " by a box that was Xed out]:
sad diskin " --
jmp i getdsk "|\/|
dac 2f "|/\|
lac wrflg " --
sza "
jmp 3f "
lac diskin "
dac 1f "
lac sfo "
sys seek; 1: 0; 0 "
lac sfo "
sys write; dskbuf; 1024 "
lac d1 "
dac wrflg "
3: "
lac 2f "
dac diskin "
lac sfi "
sys seek; 2: 0; 0 "
spa "
jmp i getdsk "
lac sfi "
sys read; dskbuf; 1024 "
jmp i getdsk "
betwen: 0
dac bett1
lac i betwen
dac bett2
isz betwen
lac i bett2
cma
tad bett1
spa
jmp 1f
lac i betwen
dac bett2
isz betwen
-1
tad i bett2
"[handwritten page number top right of scan - 13]
cma
tad bett1
spa
1:
isz betwen
lac bett1
jmp i betwen
error:
lac d1
sys write; 1f; 1
jmp advanc
1:
077012