%%% The liftboy %%% lets users out and in %%% loading is on while this coroutine is active. %%% waiting is off when this coroutine ends. L1 TRIP DelayI,20 Wait until the door is open. 1H 16ADDU $0,floor,Exit Anyone to exit on this floor? TRIP SendT,$0,0 Notify user, First-In-Last-Out. BNZ $255,1F If no user exits here, contine; TRIP DelayI,25 else, give user 25 units time to leave JMP 1B and repeat this step. %%off 1H 16ADDU $0,floor,Enter TRIP Send,$0,0 BZ $255,2F PUSHJ $0,:Log:E4 JMP 3F %%on 1H 16ADDU $0,floor,Enter Anyone wants to enter on this floor? TRIP Send,$0,0 Notify user. BNZ $255,1F If no user enters here, contine; 2H IS @ %%hide TRIP DelayI,25 Give user 25 units time to get in. JMP 1B and repeat this step. %%% 3H IS @ %%hide 1H SET loading,off Job done. SET waiting,on Still waiting on this floor. 1H TRIP Pause,0,0 Take a break. JMP L1 %%% %%% Subroutine to get the liftboy to start working. Loading SET loading,on We will start loading. SET waiting,off Waiting will come later. LDA $0,Liftboy TRIP Continue,$0,0 Wake up the liftboy. POP 0,0 %%off