.symbol
 fp 30
 sp 29
 retval 28
 rads 27
 cnt 1100
.code 0
 mov fp #3500
 mov sp #3000
 jal rads main
 trap r0 #0
:int0
; gnAsg :(#1 (call readport 13 ))
st r1 @1 fp
st r2 @2 fp
add fp fp #3
st rads @0 fp
mov r2 #13
trap r2 #18
mov r1 r28
trap r1 #1
ld rads @0 fp
sub fp fp #3
ld r2 @2 fp
ld r1 @1 fp
reti
:int1
add fp fp #1
st rads @0 fp
mov r2 #13
trap r2 #18
mov r1 r28
trap r1 #1
ld rads @0 fp
sub fp fp #1
reti
:int2
add fp fp #1
st rads @0 fp
mov r2 #13
trap r2 #18
mov r1 r28
trap r1 #1
ld rads @0 fp
sub fp fp #1
reti
:int3
add fp fp #1
st rads @0 fp
mov r2 #13
trap r2 #18
mov r1 r28
trap r1 #1
ld rads @0 fp
sub fp fp #1
reti
; fun delay pv 0 fs 1
:delay
; gnAsg :(#1 0 )
st r1 @1 fp
st r2 @2 fp
add fp fp #3
st rads @0 fp
mov r1 #0
jmp L112
:L113
add r1 r1 #1
:L112
lt r2 r1 #30
jt r2 L113
:L111
ld rads @0 fp
sub fp fp #3
ld r2 @2 fp
ld r1 @1 fp
ret rads
; fun main pv 0 fs 0
:main
st r1 @1 fp
add fp fp #2
st rads @0 fp
mov r1 #int0
st r1 1000
mov r1 #int1
st r1 1001
mov r1 #int2
st r1 1002
mov r1 #int3
st r1 1003
mov r1 #200
trap r1 #13
jmp L115
:L116
trap r0 #17
:L115
mov r1 #1
jt r1 L116
:L114
ld rads @0 fp
sub fp fp #2
ld r1 @1 fp
ret rads
.data 200
.end
