TITLE Econet; AUTHOR "Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995"; NEEDS OS; TYPE Econet_Status = .Int "Completion statuses"; CONST Econet_StatusTransmitted = Econet_Status: 0, Econet_StatusLineJammed = Econet_Status: 1, Econet_StatusNetError = Econet_Status: 2, Econet_StatusNotListening = Econet_Status: 3, Econet_StatusNoClock = Econet_Status: 4, Econet_StatusTxReady = Econet_Status: 5, Econet_StatusTransmitting = Econet_Status: 6, Econet_StatusRxReady = Econet_Status: 7, Econet_StatusReceiving = Econet_Status: 8, Econet_StatusReceived = Econet_Status: 9, Econet_StatusNoReply = Econet_Status: 10, Econet_StatusEscape = Econet_Status: 11, Econet_StatusNotPresent = Econet_Status: 12; CONST //Error numbers Error_EconetTxReady = .Bits: &300 "Tx ready", Error_EconetTransmitting = .Bits: &301 "Transmitting", Error_EconetRxReady = .Bits: &302 "Receive block open", Error_EconetReceiving = .Bits: &303 "Receiving", Error_EconetReceived = .Bits: &304 "Received", Error_EconetTransmitted = .Bits: &305 "Transmitted OK", Error_EconetBadStation = .Bits: &306 "Bad station number", Error_EconetBadNetwork = .Bits: &307 "Bad network number", Error_EconetUnableToDefault = .Bits: &308 "Full net address required", Error_EconetBadPort = .Bits: &309 "Bad port number", Error_EconetBadControl = .Bits: &30A "Bad flag byte value", Error_EconetBadBuffer = .Bits: &30B "Bad buffer address", Error_EconetBadSize = .Bits: &30C "Bad buffer size", Error_EconetBadMask = .Bits: &30D "Bad mask", Error_EconetBadCount = .Bits: &30E "Bad count", Error_EconetBadDelay = .Bits: &30F "Bad delay", Error_EconetBadStatus = .Bits: &310 "Bad status", Error_EconetNoHardware = .Bits: &311 "No Econet hardware", Error_EconetNoEconet = .Bits: &312 "No 'Econet' installed", Error_EconetNoMoreDomains = .Bits: &313 "No more domains", Error_EconetBadDomain = .Bits: &314 "Bad domain number", Error_EconetUnRegisteredDomain = .Bits: &315 "Unknown domain", Error_EconetPortNotAllocated = .Bits: &316 "Port not already allocated", Error_EconetPortAllocated = .Bits: &317 "Port not unallocated", Error_EconetNoMorePorts = .Bits: &318 "All ports allocated"; TYPE Econet_ImmediateOp = .Int; CONST //For Econet_DoImmediate Econet_ImmediatePeek = Econet_ImmediateOp: 1, Econet_ImmediatePoke = Econet_ImmediateOp: 2, Econet_ImmediateJSR = Econet_ImmediateOp: 3, Econet_ImmediateUserProcedureCall = Econet_ImmediateOp: 4, Econet_ImmediateOSProcedureCall = Econet_ImmediateOp: 5, Econet_ImmediateHalt = Econet_ImmediateOp: 6, Econet_ImmediateContinue = Econet_ImmediateOp: 7, Econet_ImmediateMachinePeek = Econet_ImmediateOp: 8, Econet_ImmediateGetRegisters = Econet_ImmediateOp: 9; TYPE Econet_ImmediateOSProcedure = .Ref .Asm; CONST //For Econet_ImmediateOSProcedureCall Econet_OSCharFromNotify = Econet_ImmediateOSProcedure: 0, Econet_OSInitialiseRemote = Econet_ImmediateOSProcedure: 1, Econet_OSGetViewParameters = Econet_ImmediateOSProcedure: 2, Econet_OSCauseFatalError = Econet_ImmediateOSProcedure: 3, Econet_OSCharFromRemote = Econet_ImmediateOSProcedure: 4; TYPE Econet_Protection = .Bits; CONST //For Econet_GetProtection Econet_ProtectionPeek = Econet_Protection: %1, Econet_ProtectionPoke = Econet_Protection: %10, Econet_ProtectionJSR = Econet_Protection: %100, Econet_ProtectionUserProcedureCall = Econet_Protection: %1000, Econet_ProtectionOSProcedureCall = Econet_Protection: %10000, Econet_ProtectionHalt = Econet_Protection: %100000, Econet_ProtectionContinue = Econet_Protection: %1000000, Econet_ProtectionMachinePeek = Econet_Protection: %10000000, Econet_ProtectionGetRegisters = Econet_Protection: %100000000, Econet_ProtectionWriteCMOS = Econet_Protection: &80000000; TYPE Econet_TransportType = .Int; CONST Econet_TransportNotKnown = Econet_TransportType: 0, Econet_TransportInternet = Econet_TransportType: 1, Econet_TransportEconet = Econet_TransportType: 2, Econet_TransportNexus = Econet_TransportType: 3; TYPE Econet_State = .Int; CONST Econet_StateOK = Econet_State: 0, Econet_StateNoClock = Econet_State: 1; TYPE Econet_RxCB, Econet_TxCB; TYPE Econet_Action = .Int; CONST //For EconetV Econet_NetFSStartLoad = Econet_Action: &10, Econet_NetFSPartLoad = Econet_Action: &11, Econet_NetFSFinishLoad = Econet_Action: &12, Econet_NetFSStartSave = Econet_Action: &20, Econet_NetFSPartSave = Econet_Action: &21, Econet_NetFSFinishSave = Econet_Action: &22, Econet_NetFSStartCreate = Econet_Action: &30, Econet_NetFSPartCreate = Econet_Action: &31, Econet_NetFSFinishCreate = Econet_Action: &32, Econet_NetFSStartGetBytes = Econet_Action: &40, Econet_NetFSPartGetBytes = Econet_Action: &41, Econet_NetFSFinishGetBytes = Econet_Action: &42, Econet_NetFSStartPutBytes = Econet_Action: &50, Econet_NetFSPartPutBytes = Econet_Action: &51, Econet_NetFSFinishPutBytes = Econet_Action: &52, Econet_NetFSStartWait = Econet_Action: &60, Econet_NetFSFinishWait = Econet_Action: &62, Econet_NetFSStartBroadcastLoad = Econet_Action: &70, Econet_NetFSPartBroadcastLoad = Econet_Action: &71, Econet_NetFSFinishBroadcastLoad = Econet_Action: &72, Econet_NetFSStartBroadcastSave = Econet_Action: &80, Econet_NetFSPartBroadcastSave = Econet_Action: &81, Econet_NetFSFinishBroadcastSave = Econet_Action: &82, Econet_EconetStartTransmission = Econet_Action: &C0, Econet_EconetFinishTransmission = Econet_Action: &C2, Econet_EconetStartReception = Econet_Action: &D0, Econet_EconetFinishReception = Econet_Action: &D2; SWI Econet_CreateReceive = (NUMBER 0x40000 "Creates a receive control block", ENTRY (R0 = .Byte: port, R1 = .Byte: station, R2 = .Byte: net, R3 = .Ref .Data: buffer, R4 = .Int: size), EXIT (R0! = Econet_RxCB: rx_cb, R2 = .Bool: nonlocal)); SWI Econet_ExamineReceive = (NUMBER 0x40001 "Reads the status of a receive control block", ENTRY (R0 = Econet_RxCB: rx_cb), EXIT (R0! = Econet_Status: status)); SWI Econet_ReadReceive = (NUMBER 0x40002 "Reads information about a reception, including the size of data", ENTRY (R0 = Econet_RxCB: rx_cb), EXIT (R0! = Econet_Status: status, R1 = .Byte: flag, R2 = .Byte: port, R3 = .Byte: station, R4 = .Byte: net, R5 = .Ref .Data: buffer, R6 = .Int: size)); SWI Econet_AbandonReceive = (NUMBER 0x40003 "Abandons a receive control block", ENTRY (R0 = Econet_RxCB: rx_cb), EXIT (R0! = Econet_Status: status)); SWI Econet_WaitForReception = (NUMBER 0x40004 "Polls a receive control block, reads its status, and abandons it", ENTRY (R0 = Econet_RxCB: rx_cb, R1 = .Int: delay, R2 = .Bool: abort_on_escape), EXIT (R0! = Econet_Status: status, R1 = .Byte: flag, R2 = .Byte: port, R3 = .Byte: station, R4 = .Byte: net, R5 = .Ref .Data: buffer, R6 = .Int: size)); SWI Econet_EnumerateReceive = (NUMBER 0x40005 "Returns the handles of open receive control blocks", ENTRY (R0 = .Int: rx_cb_no), EXIT (R0! = Econet_RxCB: rx_cb)); SWI Econet_StartTransmit = (NUMBER 0x40006 "Creates a transmit control block and starts a transmission", ENTRY (R0 = .Byte: flags, R1 = .Byte: port, R2 = .Byte: station, R3 = .Byte: net, R4 = .Ref .Data: buffer, R5 = .Int: size, R6 = .Int: count, R7 = .Int: delay), EXIT (R0! = Econet_TxCB: tx_cb, R1?, R2?, R3?, R4 = .Bool: nonlocal)); SWI Econet_PollTransmit = (NUMBER 0x40007 "Reads the status of a transmit control block", ENTRY (R0 = Econet_TxCB: tx_cb), EXIT (R0! = Econet_Status: status)); SWI Econet_AbandonTransmit = (NUMBER 0x40008 "Abandons a transmit control block", ENTRY (R0 = Econet_TxCB: tx_cb), EXIT (R0! = Econet_Status: status)); SWI Econet_DoTransmit = (NUMBER 0x40009 "Creates a transmit control block, polls it, reads its status, and abandons it", ENTRY (R0 = .Byte: flags, R1 = .Byte: port, R2 = .Byte: station, R3 = .Byte: net, R4 = .Ref .Data: buffer, R5 = .Int: size, R6 = .Int: count, R7 = .Int: delay), EXIT (R0! = Econet_Status: status, R1?, R2?, R3?, R4 = .Bool: nonlocal)); SWI Econet_ReadLocalStationAndNet = (NUMBER 0x4000A "Returns a computer's station number and net number", EXIT (R0 = .Byte: station, R1 = .Byte: net)); SWI Econet_ConvertStatusToString = (NUMBER 0x4000B "Converts a status to a string", ENTRY (R0 = Econet_Status: status, R1 = .Ref .String: buffer, R2 = .Int: size, R3 = .Byte: station, R4 = .Byte: net), EXIT (R0?, R1! -> .Char: end, R2?)); SWI Econet_ConvertStatusToError = (NUMBER 0x4000C "Converts a status to a string, and then generates an error", ENTRY (R0 = Econet_Status: status, R1 = .Ref OS_Error: buffer, R2 = .Int: size, R3 = .Byte: station, R4 = .Byte: net)); SWI Econet_ReadProtection = (NUMBER 0x4000D "Reads the current protection word for immediate operations", EXIT (R0! = Econet_Protection: protection)); SWI Econet_SetProtection = (NUMBER 0x4000E "Sets or reads the protection word for immediate operations", ENTRY (R0 = Econet_Protection: eor_mask, R1 = Econet_Protection: and_mask), EXIT (R0! = Econet_Protection: old_protection)); SWI Econet_ReadStationNumber = (NUMBER 0x4000F "Extracts a station and/or net number from a specified string", ENTRY (R1 -> .String: s), EXIT (R1! -> .Char: end, R2 = .Int: station "Station number, or -1 (not specified)", R3 = .Int: net "Net number, or -1 (not specified)")); SWI Econet_PrintBanner = (NUMBER 0x40010 "Prints an Econet message followed by a new line"); SWI Econet_ReadTransportType = (NUMBER 0x40011 "Returns the underlying transport type to a given station", ENTRY (R0 = .Byte: station, R1 = .Byte: net, R2 #2), EXIT (R2! = Econet_TransportType: transport_type)); SWI Econet_ReleasePort = (NUMBER 0x40012 "Releases a port number that was previously claimed", ENTRY (R0 = .Byte: port)); SWI Econet_AllocatePort = (NUMBER 0x40013 "Allocates a unique port number", EXIT (R0! = .Byte: port)); SWI Econet_DeAllocatePort = (NUMBER 0x40014 "Deallocates a port number that was previously allocated", ENTRY (R0 = .Byte: port)); SWI Econet_ClaimPort = (NUMBER 0x40015 "Claims a specific port number", ENTRY (R0 = .Byte: port)); SWI Econet_StartImmediate = ( NUMBER 0x40016 "Creates a transmit control block and starts an immediate operation", ENTRY ( R0 = Econet_ImmediateOp: op_type, R1 = Econet_ImmediateOSProcedure: procedure, R2 = .Byte: station, R3 = .Byte: net, R4 = .Ref .Data: buffer, R5 = .Int: size, R6 = .Int: count, R7 = .Int: delay ), EXIT ( R0! = Econet_TxCB: tx_cb, R1?, R2?, R3?, R4 = .Bool: nonlocal ) ); SWI Econet_DoImmediate = ( NUMBER 0x40017 "Creates a transmit control block for an immediate operation, polls it, reads its status, and abandons it", ENTRY ( R0 = Econet_ImmediateOp: op_type, R1 = Econet_ImmediateOSProcedure: procedure, R2 = .Byte: station, R3 = .Byte: net, R4 = .Ref .Data: buffer, R5 = .Int: size, R6 = .Int: count, R7 = .Int: delay ), EXIT ( R0! = Econet_Status: status, R1?, R2?, R3?, R4 = .Bool: nonlocal ) ); SWI Econet_AbandonAndReadReceive = (NUMBER 0x40018 "Abandons a reception and returns information about it, including the size of data", ENTRY (R0 = Econet_RxCB: rx_cb), EXIT (R0! = Econet_Status: status, R1 = .Byte: flag, R2 = .Byte: port, R3 = .Byte: station, R4 = .Byte: net, R5 = .Ref .Data: buffer, R6 = .Int: size)); SWI Econet_Version = (NUMBER 0x40019 "Returns the version of software for the underlying transport to a given station", ENTRY (R0 = .Byte: station, R1 = .Byte: net), EXIT (R2! = .Int: version)); SWI Econet_NetworkState = (NUMBER 0x4001A "Returns the state of the underlying transport to a given station", ENTRY (R0 = .Byte: station, R1 = .Byte: net), EXIT (R2! = Econet_State: state)); SWI Econet_PacketSize = (NUMBER 0x4001B "Returns the maximum packet size recommended on the underlying transport to a given station", ENTRY (R0 = .Byte: station, R1 = .Byte: net), EXIT (R2! = .Int: packet_limit)); SWI Econet_ReadTransportName = (NUMBER 0x4001C "Returns the name of the underlying transport to a given station", ENTRY (R0 = .Byte: station, R1 = .Byte: net), EXIT (R2! -> .String: transport_name)); SWI Econet_InetRxDirect = (NUMBER 0x4001D "For internal use only - RISC O S 3.5+", ABSENT); TYPE Econet_MapFlags = .Bits; SWI Econet_EnumerateMap = (NUMBER 0x4001E "Enumerates subnetwork addresses within an AUN site network - RISC O S 3.5+", ENTRY (R0 = Econet_MapFlags: flags, R4 = .Int: context), EXIT (R1 = .Byte: net, R2 -> .String: net_name, R3 = .Int: ip_subnetwork_address, R4! = .Int: context_out)); SWI Econet_EnumerateTransmit = (NUMBER 0x4001F "Returns the handles of open transmit blocks - RISC O S 3.5+", ENTRY (R0 = .Int: tx_cb_no), EXIT (R0! = Econet_TxCB: tx_cb)); SWI Econet_HardwareAddresses = (NUMBER 0x40020 "Returns the address of the Econet hardware and interrupt control registers - RISC O S 3.5+", EXIT (R0 = .Ref .Data: hardware_address, R1 = .Ref .Data: register_address, R2 = .Bits: register_mask)); CONST Econet_Second = .Int: 4000000 "1s in Econet units"; CONST Econet_kHz = .Int: 1 "1kHz in Econet units"; SWI Econet_NetworkParameters = (NUMBER 0x40021 "Returns the Econet clock period and frequency - RISC O S 3.5+", EXIT (R0 = .Int: period, R1 = .Int: frequency, R2?, R3?)); SWI EconetV = (NUMBER 0x34, ENTRY (R0 = Econet_Action: action, R1 = .Int: count, R9 # &21 "Econet module vector")); SWI Service_ReallocatePorts = (NUMBER 0x30, ENTRY (R1 # 0x48 "Econet restarting")), Service_EconetDying = (NUMBER 0x30, ENTRY (R1 # 0x56 "Econet is about to leave")), Service_ProtocolDying = (NUMBER 0x30, ENTRY (R1 # 0x83 "Part of the AUN driver control interface")), Service_FindNetworkDriver = (NUMBER 0x30, ENTRY (R1 # 0x84 "Part of the AUN driver control interface")), Service_NetworkDriverStatus = (NUMBER 0x30, ENTRY (R1 # 0x8B "Part of the AUN driver control interface")); SWI Event_EconetUserRPC = ( NUMBER &22, ENTRY ( R0 # 8 "Econet user remote procedure event", R1 -> .Data: args, R2 = Econet_ImmediateOSProcedure: procedure, R3 = .Byte: station, R4 = .Byte: net ) ), Event_EconetRx = ( NUMBER &22, ENTRY ( R0 # 14 "Econet receive event", R1 = Econet_RxCB: rx_cb, R2 = Econet_Status: status ) ), Event_EconetTx = ( NUMBER &22, ENTRY ( R0 # 15 "Econet transmit event", R1 = Econet_TxCB: tx_cb, R2 = Econet_Status: status ) ), Event_EconetOSProc = ( NUMBER &22, ENTRY ( R0 # 16 "Econet OS remote procedure event", R1 -> .Data: args, R2 = Econet_ImmediateOSProcedure: procedure, R3 = .Byte: station, R4 = .Byte: net ) )