Simple notify

From BeebWiki
Revision as of 21:05, 8 March 2015 by WikiSysop (talk | contribs) (.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
   REM Simple notify code
   :
   DIM ctrl% 255:X%=ctrl%:Y%=X%DIV256
   :
   mystation%=FNNet_Info(8,0)               :REM Read my station number
   INPUT "Input station to notify "dest$
   dest%=FNNet_StnNum(dest$)                :REM Convert station to number
   INPUT LINE "Enter message: "message$
   message$=CHR$7+"--- "+STR$mystation+" --- "+LEFT$(message$,235)
                                            :REM Maximum 248 characters
   PROCNet_Send(1,dest%,message$+CHR$0)     :REM Send to destination
   END

This code uses the following routines from the Net library:

   DEFPROCNet_Send(A%,D%,A$):?X%=A%:X%!1=D%:$(X%+3)=A$:A%=&13:CALL&FFF1:ENDPROC
   DEFFNNet_StnNum(A$)
   A%=INSTR(A$,"."):IFA%:=256*VALLEFT$(A$,A%-1)+VALMID$(A$,A%+1) ELSE =VALA$
   DEFFNNet_Info(A%,D%):?X%=A%:X%!1=D%:A%=&13:CALL&FFF1:=X%!1

Using the FNNet_Addr() function in the NetUtil library (which requires the NetFS library) the destination can be a station number or a user name:

   dest%=FNNet_Addr(dest$)                :REM Convert station/user to number

If running on a second processor, the maximum length string sendable is 120 characters.

Jgharston 15:17, 30 July 2012 (UTC)