fields recpin sendpin tsmall tbig tmed tpauses tpauser endfields ------------------------------------------ -- ( sendpin , recpin , )morse.init ------------------------------------------ function morse.init c1000 = 1000 c1200 = 1200 begin 0>sendpin 1>recpin ( sendpin )setout ( sendpin )set0 ( recpin )setin 150,tsmall< 300,tbig< 225,tmed< c1000,tpauser< c1200,tpauses< return load from(std.mpo) *setout *setin *set0 ------------------------------------------ -- ( sendpin , recpin , )morse.connect ------------------------------------------ function morse.connect begin ( arg0 )setout ( arg0 )set0 ( arg1 )setin return load from (std.mpo) *setout *setin ------------------------------------------ function morse.pause -morpa begin tpauses wait return ------------------------------------------ -- ( data )morse.send ------------------------------------------ function morse.send -morse y n thigh mask = $80000000 begin ->y 32 ->n :loop if(y &mask #0){ tbig } else { tsmall } ->thigh ( sendpin )set1 thigh wait ( sendpin )set0 tsmall wait <<1,y< NEXT(n):loop return load from(std.mpo) *set0 *set1 ------------------------------------------- -- ( data , n , )morse.vsend ------------------------------------------- function morse.vsend -morvse y n m thigh mask begin 0>y 1>n n -1 ->m 1 <mask :loop if(y &mask #0){ tbig } else { tsmall } ->thigh ( sendpin )set1 thigh wait ( sendpin )set0 tsmall wait <<1,y< NEXT(n):loop return load from (std.mpo) *set0 *set1 ------------------------------------------- -- )morse.rec ->data ------------------------------------------- function morse.rec -morre u tout tcrit first rmask begin 0 ->u 1 <rmask 1,first< :ww0 if(first =1):notimeout if(now >tout):exit :notimeout if(ina &rmask =0):ww0 now +tmed ->tcrit :ww1 if(ina &rmask #0):ww1 if(now >tcrit){ |1,u< } <<1,u< 0,first< now +tpauser ->tout A:ww0 :exit 100 wait u N>>1 return --function show -- x --begin -- ->x -- )pc.init -- ( "Y" )pc.bsend -- ( x &$1F )pc.vsend -- ( x >>5 )pc.vsend -- ( 13 )pc.bsend -- ( 10 )pc.bsend -- return -- --load from (pc.mpo) --*pc.init --*pc.vsend --*pc.bsend