-
Notifications
You must be signed in to change notification settings - Fork 38
/
gclock.zap
55 lines (48 loc) · 986 Bytes
/
gclock.zap
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
.FUNCT QUEUE,RTN,TICK,CINT
CALL INT,RTN >CINT
PUT CINT,C-TICK,TICK
RETURN CINT
.FUNCT INT,RTN,DEMON=0,E,C,INT
ADD C-TABLE,C-TABLELEN >E
ADD C-TABLE,C-INTS >C
?PRG1: EQUAL? C,E \?ELS5
SUB C-INTS,C-INTLEN >C-INTS
ZERO? DEMON /?ELS7
SUB C-DEMONS,C-INTLEN >C-DEMONS
?ELS7: ADD C-TABLE,C-INTS >INT
PUT INT,C-RTN,RTN
RETURN INT
?ELS5: GET C,C-RTN
EQUAL? STACK,RTN \?CND3
RETURN C
?CND3: ADD C,C-INTLEN >C
JUMP ?PRG1
.FUNCT CLOCKER,C,E,TICK,FLG=0
ZERO? CLOCK-WAIT /?CND1
SET 'CLOCK-WAIT,FALSE-VALUE
RFALSE
?CND1: ZERO? P-WON /?ELS9
PUSH C-INTS
JUMP ?CND5
?ELS9: PUSH C-DEMONS
?CND5: ADD C-TABLE,STACK >C
ADD C-TABLE,C-TABLELEN >E
?PRG13: EQUAL? C,E \?ELS17
INC 'MOVES
RETURN FLG
?ELS17: GET C,C-ENABLED?
ZERO? STACK /?CND15
GET C,C-TICK >TICK
ZERO? TICK \?ELS22
JUMP ?CND15
?ELS22: SUB TICK,1
PUT C,C-TICK,STACK
GRTR? TICK,1 /?CND20
GET C,C-RTN
CALL STACK
ZERO? STACK /?CND20
SET 'FLG,TRUE-VALUE
?CND20:
?CND15: ADD C,C-INTLEN >C
JUMP ?PRG13
.ENDI