package sim // Peripheral port numbers. Values are int32; positions are kilometres, // velocities metres/second, angles milliradians, masses kilograms. Axes are // right-handed with Z perpendicular to the ecliptic; azimuth is measured from // +X towards +Y and elevation (pitch) up from the XY plane towards +Z. const ( // System. PortTick = 0x00 // in: tick within the current day PortDay = 0x01 // in: day number PortTicks = 0x02 // in: ticks per day // Navigation (relative to the star). PortPosX = 0x10 PortPosY = 0x11 PortPosZ = 0x12 PortVelX = 0x13 PortVelY = 0x14 PortVelZ = 0x15 // Engine. PortThrottle = 0x20 // out: 0..1000 permille PortAzimuth = 0x21 // out: thrust direction azimuth, milliradians PortPitch = 0x22 // out: thrust direction elevation, milliradians PortFuel = 0x23 // in: fuel kg PortMass = 0x24 // in: total mass kg // Scanner. PortScanSelect = 0x30 // out: asteroid id to track (0 clears) PortScanNearest = 0x31 // in: id of nearest asteroid PortScanRelX = 0x32 // in: target position relative to ship, km PortScanRelY = 0x33 PortScanRelZ = 0x34 PortScanRelVX = 0x35 // in: target velocity relative to ship, m/s PortScanRelVY = 0x36 PortScanRelVZ = 0x37 PortScanDist = 0x38 // in: distance to target, km PortScanOre = 0x40 // in: PortScanOre+ore = kg of ore remaining (8 ports) // Mining laser and cargo hold. PortMine = 0x50 // out: 1 to mine the selected asteroid, 0 to stop PortCargo = 0x51 // in: total cargo kg PortCargoCap = 0x52 // in: cargo capacity kg PortCargoOre = 0x58 // in: PortCargoOre+ore = kg of ore carried (8 ports) // Dropoff station. PortStnRelX = 0x60 // in: station position relative to ship, km PortStnRelY = 0x61 PortStnRelZ = 0x62 PortStnRelVX = 0x63 // in: station velocity relative to ship, m/s PortStnRelVY = 0x64 PortStnRelVZ = 0x65 PortSell = 0x66 // out: 1 to sell all cargo (needs to be docked) PortCredits = 0x67 // in: credits earned by this ship (saturating) // Comms buffers live in RAM; these ports coordinate them. PortUplinkNew = 0x70 // in: 1 if an uplink arrived this day; out: any value acknowledges PortUplinkLen = 0x71 // in: uplink length in bytes // Math coprocessor. Write operands, then read a result. PortMathX = 0x80 // out PortMathY = 0x81 // out PortMathZ = 0x82 // out PortMathAtan2 = 0x83 // in: atan2(y, x) in milliradians PortMathHypot = 0x84 // in: sqrt(x*x + y*y) PortMathNorm3 = 0x85 // in: sqrt(x*x + y*y + z*z) )