Add README.md
[pdp8.git] / sw / src / adventure / DROP.RA
1 SECT DROP
2 / SUBROUTINE DROP(OBJECT,WHERE)
3 / C
4 / C PLACE AN OBJECT AT A GIVEN LOC, PREFIXING IT ONTO THE ATLOC LIST.
5 / C DECR HOLDNG IF THE OBJECT WAS BEING TOTED.
6 / C
7 / IMPLICIT INTEGER (A-Z)
8 / COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,HOLDNG
9 / DIMENSION ATLOC(150)
10 / DIMENSION LINK(200)
11 / DIMENSION PLACE(100)
12 / DIMENSION FIXED(100)
13
14 JA #ST
15 #XR, ORG .+10
16 TEXT +DROP +
17 #RET, SETX #XR
18 SETB #BASE
19 JA .+3
20 #BASE, ORG .+6
21 OBJECT, ORG .+3
22 WHERE, ORG .+3
23 ONE, F 1.0
24 HUND, F 100.0
25 M1, F -1.0
26 ORG #BASE+30
27 FNOP
28 JA #RET
29 FNOP
30 #GOBAK, 0;0
31 #LBL=.
32 COMMON PLACOM
33 ATLOC, ORG .+702
34 LINK, ORG .+1130
35 PLACE, ORG .+454
36 FIXED, ORG .+454
37 HOLDNG, ORG .+3
38 ORG #LBL
39 #RTN, BASE #BASE
40 JA #GOBAK
41 #ST, STARTD
42 0210
43 FSTA #GOBAK,0
44 0200
45 SETX #XR
46 SETB #BASE
47 LDX 0,1
48 FSTA #BASE
49 FLDA% #BASE,1+
50 FSTA OBJECT
51 FLDA% #BASE,1+
52 FSTA WHERE
53 STARTF
54 FLDA% WHERE /Pre-load index regs
55 ATX 6
56 FLDA% OBJECT
57 ATX 7
58 / IF(OBJECT.GT.100)GOTO 1
59 FSUB HUND
60 ATX 5 /Save object-100
61 JGT #1
62 / IF(PLACE(OBJECT).EQ.-1)HOLDNG=HOLDNG-1
63 FLDA ONE
64 FADD PLACE-3,7
65 JNE #G1
66 FLDA M1
67 FADDM HOLDNG
68 / PLACE(OBJECT)=WHERE
69 #G1, FLDA% WHERE
70 FSTA PLACE-3,7
71 / GOTO 2
72 JA #2
73
74 / 1 FIXED(OBJECT-100)=WHERE
75 #1, FLDA% WHERE
76 FSTA FIXED-3,5
77
78 / 2 IF(WHERE.LE.0)RETURN
79 #2, JLE #RTN
80 / LINK(OBJECT)=ATLOC(WHERE)
81 #G2, FLDA ATLOC-3,6
82 FSTA LINK-3,7
83 / ATLOC(WHERE)=OBJECT
84 XTA 7
85 FSTA ATLOC-3,6
86 / RETURN
87 / END
88 JA #RTN
89 END