Commit: 95ecd3e8f70327cc99af48d025582ff4987329e1 Author: Vi Grey Date: 2022-11-02 05:11 UTC Summary: Initial Commit .gitignore | 1 + Makefile | 41 ++ bin/sattrak | Bin 0 -> 6294800 bytes docs/draft-sattrak-v1-00.html | 1728 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/draft-sattrak-v1-00.pdf | 2006 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/draft-sattrak-v1-00.txt | 425 +++++++++++++++++ go.mod | 15 + go.sum | 23 + lua/sattrak.lua | 71 +++ nes/sattrak.nes | Bin 0 -> 40976 bytes src/docs/draft-sattrak-v1-00.xml | 327 +++++++++++++ src/nes/controller.asm | 508 ++++++++++++++++++++ src/nes/decompress.asm | 95 ++++ src/nes/defs.asm | 53 +++ src/nes/draw.asm | 385 +++++++++++++++ src/nes/graphics/crew-name.go | 34 ++ src/nes/graphics/crew.nam | Bin 0 -> 960 bytes src/nes/graphics/east.atr | Bin 0 -> 64 bytes src/nes/graphics/east.nam | Bin 0 -> 960 bytes src/nes/graphics/tilemap.chr | Bin 0 -> 8192 bytes src/nes/graphics/west.atr | Bin 0 -> 64 bytes src/nes/graphics/west.nam | Bin 0 -> 960 bytes src/nes/include.asm | 124 +++++ src/nes/map.asm | 518 +++++++++++++++++++++ src/nes/prg.asm | 149 ++++++ src/nes/ram.asm | 94 ++++ src/nes/sattrak.asm | 46 ++ src/nes/screen.asm | 32 ++ src/sattrak/config.go | 141 ++++++ src/sattrak/conversion.go | 91 ++++ src/sattrak/device.go | 256 ++++++++++ src/sattrak/http.go | 83 ++++ src/sattrak/http/fonts/MaterialIcons-Regular.ttf | Bin 0 -> 327360 bytes src/sattrak/http/images/map.png | Bin 0 -> 793184 bytes src/sattrak/http/index.html | 164 +++++++ src/sattrak/http/scripts/index2.js | 37 ++ src/sattrak/http/styles/index2.css | 202 ++++++++ src/sattrak/info.go | 39 ++ src/sattrak/io.go | 11 + src/sattrak/modify.go | 67 +++ src/sattrak/moon.go | 438 ++++++++++++++++++ src/sattrak/omm.go | 111 +++++ src/sattrak/orbits.go | 98 ++++ src/sattrak/sat.go | 60 +++ src/sattrak/sattrak.go | 402 ++++++++++++++++ src/sattrak/search.go | 43 ++ src/sattrak/sun.go | 54 +++ src/sattrak/syzygy.go | 40 ++ src/sattrak/tcp.go | 65 +++ src/sattrak/test.txt | 99 ++++ src/sattrak/timer.go | 59 +++ src/sattrak/ws.go | 108 +++++ 52 files changed, 9343 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..58fef41 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +# Copyright (C) 2022, Vi Grey +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +PKG_NAME := sattrak +CURRENTDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +DOC_NAME := draft-sattrak-v1-00 + +all: + mkdir -p $(CURRENTDIR)build/bin; \ + mkdir -p $(CURRENTDIR)build/docs; \ + mkdir -p $(CURRENTDIR)build/nes; \ + go build -ldflags="-s -w" -o $(CURRENTDIR)build/bin/$(PKG_NAME) $(CURRENTDIR)src/$(PKG_NAME)/; \ + xml2rfc $(CURRENTDIR)src/docs/$(DOC_NAME).xml -p $(CURRENTDIR)build/docs --text --html --pdf --no-external-js --no-external-css --v3 --id-is-work-in-progress --no-pagination; \ + cd $(CURRENTDIR)src/nes/; \ + asm6 $(PKG_NAME).asm ../../build/nes/$(PKG_NAME).nes; \ + cd $(CURRENTDIR); \ + +clean: + rm -rf -- $(CURRENTDIR)build; \ diff --git a/bin/sattrak b/bin/sattrak new file mode 100755 index 0000000..6e6718d Binary files /dev/null and b/bin/sattrak differ diff --git a/docs/draft-sattrak-v1-00.html b/docs/draft-sattrak-v1-00.html new file mode 100644 index 0000000..0e3a79d --- /dev/null +++ b/docs/draft-sattrak-v1-00.html @@ -0,0 +1,1728 @@ + + +
+ + + ++ | SatTrak Controller Input Specification | +November 2022 | +
Grey | +Informational | +[Page] | +
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
+Data Types:¶
+We use the terms byte and octet interchangeably in this document.¶
+Unless specified otherwise, all multi-octet binary coded decimal numbers, unsigned integers, and signed integers are big-endian.¶
+String values MUST use UTF-8 encoding. If an example of a string value is given, the example will be between quotation marks. The quotation marks are not included in the string. Not all content between quotations will be string value examples, so be aware of that when continuing through this document.¶
+Binary coded decimal numbers, Unsigned integers, and signed integers can have different bit widths. For instance, an 8-bit signed integer can be used in one part of the specification and a 64-bit signed integer can be used in another part of the specification.¶
+Boolean values MUST be a single octet with the value of 0
for FALSE or 1
for TRUE.¶
[N octets]
[00 7F FF]
00
, 7F
, and FF
in that order.¶
+[80 FF (01 02)]
80
, FF
, 01
, and 02
in that order with visual grouping of 01
and 02
. The visual grouping are only used as a visual indicator to imply that the bytes are related to each other in some way.¶
+In packet diagrams, a single octet is represented with a box like this:¶
++ +-----+ + | Var | <-- Vertical bars MAY be missing + +-----+ +¶ +
In packet diagrams, an arbitrary number of octets are represented with a box like this:¶
++ +=====+ + | Var | + +=====+ +¶ +
In packet diagrams, boxes can be connected like these examples:¶
++ +-----------+-----------+ + | Var 1 (B) | Var 2 (I) | + +-----------+-----------+ +¶ +
+ +-----+-----+===========+ + | Var 1 (N) | Var 2 (S) | + +-----+-----+===========+ +¶ +
In packet diagrams, boxes MAY have relative offset values above them like in the following example:¶
++ 0 1 2... + +-----+-----+===========+ + | Var 1 (N) | Var 2 (S) | + +-----+-----+===========+ +¶ +
Packet diagrams MAY be split into multiple lined sections like in the following example:¶
++ 0 1 2 3 + +-----------+-----------+-----------+-----------+ + | Var 1 (N) | Var 2 (I) | Var 3 (B) | Var 4 (I) | ... + +-----------+-----------+-----------+-----------+ + 4 5 + +-----------+===========+ + | Var 5 (N) | Var 6 (S) | + +-----------+===========+ +¶ +
...
) on the same text row as the variable names to signify that the packet diagram is continuing.¶
+Location packets MUST be in the following format:¶
++ 0 1 2 4 5 6 7 8 9 + +----------+---------+-----------+--+--+--+--+-----+-----+ + | Sync (A) | Day (D) | Month (N) | Year (D) | Hour (D) | ... + +----------+---------+-----------+--+--+--+--+-----+-----+ + 10 11 12 13 14 15 16 17 18 19 20 21 + +------+------+------+------+--+--+--+--+--+--+--+--+ + | Minute (D) | Second (D) | Altitude (D) | ... + +------+------+------+------+--+--+--+--+--+--+--+--+ + 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 + +--+--+--+--+--+--+--+--+--+---+---+---+---+--+--+--+--+--+ + | NORAD ID (D) | Sat Lat (D) | Sat Lon (D) | ... + +--+--+--+--+--+--+--+--+--+---+---+---+---+--+--+--+--+--+ + 40 + +----------------+ + | Sat Status (A) | + +----------------+ + + Sync (Binary Data) [1 Octet] + Day (Binary-Coded Decimal Number) [2 Octets] + Month (Unsigned Integer) [1 Octet] + Year (Binary-Coded Decimal Number) [2 Octets] + Hour (Binary-Coded Decimal Number) [2 Octets] + Minute (Binary-Coded Decimal Number) [2 Octets] + Second (Binary-Coded Decimal Number) [2 Octets] + Altitude (Binary Coded Decimal) [8 octets] + NORAD ID (Binary Coded Decimal) [9 octets] + Sat Lat (Binary-Coded Decimal Number) [4 Octets] + Sat Lon (Binary-Coded Decimal Number) [5 Octets] + Sat Status (Binary Data) [1 Octet] + 7654 3210 + ---- ---- + || ||| + || ||+- Time Is UTC (1 if true otherwise 0) + || |+-- Time is 12 Hour (1 if true otherwise 0) + || +--- Time is PM (1 if true otherwise 0) + |+-------- Sat Longitude East (1 if lon East otherwise 0) + +--------- Sat Latitude North (1 if lat North otherwise 0) +¶ +
[F0]
.¶
+[00 01]
(1) and [03 01] (31)
.¶
+[00 00]
(0) and [02 03]
(23).¶
+[00 00]
(0) and [05 09]
(59).¶
+[00 00]
(0) and [05 09]
(59).¶
+[00 00 00 00]
(0) and [09 00 00 00]
(9000).¶
+[00 00 00 00 00]
(0) and [01 08 00 00 00]
(18000).¶
+The information of February 27, 2022 02:46:18 UTC, Latitude: 21.56 N, Longitude: 18.70 S will result in a Location packet of [(F0) (01) (02 07) (02) (02 00 02 02) (00 02) (04 06) (01 08) (00) (02 01 05 06) (01) (00 01 08 07 00)]
.¶
Home/Sun/Moon packets MUST be in the following format:¶
++ 0 1 2 3 + +----------+--------------+--------------+-------------+ + | Sync (A) | Home Lat (N) | Home Lon (N) | Sun Lat (N) | ... + +----------+--------------+--------------+-------------+ + 4 5 6 + +-------------+--------------+--------------+ + | Sun Lon (N) | Moon Lat (N) | Moon Lon (I) | ... + +-------------+--------------+--------------+ + 7 8 + +----------------+--------------------------+ + | Moon Phase (U) | Sun/Moon Lon Pos/Neg (A) | + +----------------+--------------------------+ + + Sync (Binary Data) [1 octet] + Home Lat (Unsigned Integer) [1 octet] + Home Lon (Signed Integer) [1 octet] + Sun Lat (Unsigned Integer) [1 octet] + Sun Lon (Signed Integer) [1 octet] + Moon Lat (Unsigned Integer) [1 octet] + Moon Lon (Signed Integer) [1 octet] + Moon Phase (Unsigned Integer) [1 octet] + Home/Sun/Moon Status [1 octet] + 7654 3210 + ---- ---- + |||| | || + |||| | |+- Enable Home (1 if true otherwise 0) + |||| | |+- Enable Sun (1 if true otherwise 0) + |||| | +-- Enable Moon (1 if true otherwise 0) + |||| +---- Home Longitude East (1 if lon East otherwise 0) + |||+------ Sun Longitude East (1 if lon East otherwise 0) + ||+------- Moon Longitude East (1 if lon East otherwise 0) + |+-------- Sat In Daylight (1 if true otherwise 0) + +--------- Sat In View (1 if true otherwise 0) + + +¶ +
[F5]
.¶
+The Sun and Moon information of Sun Latitude: -7, Sun Longitude: Earth Station - 16, Moon Latitude: 12, Moon Longitude: Earth Station - 22, Moon Phase: New Moon will result in a Sun/Moon packet of [(FC) (44) (F0) (66) (EA) (00) (44) (F0)
.¶
The Sun and Moon information of Moon Latitude: 0, Moon Longitude: Earth Station - 140, Moon Phase: First Quarter Moon, Sun Latitude: -4, Sun Longitude: Earth Station - 64, Moon Latitude: 0, Moon Longitude: Earth Station - 140, and Moon Phase: First Quarter Moon will result in a Sun/Moon packet of [(FC) (56) (C0) (5A) (80) (04)
.¶
+ 7654 3210 + ---- ---- + |||| |||| + |||| |||+- Right on D-Pad (1 if Pressed otherwise 0) + |||| ||+-- Left on D-Pad (1 if Pressed otherwise 0) + |||| |+--- Down on D-Pad (1 if Pressed otherwise 0) + |||| +---- Up on D-Pad (1 if Pressed otherwise 0) + |||+------ Start Button (1 if Pressed otherwise 0) + ||+------- Select Button (1 if Pressed otherwise 0) + |+-------- B Button (1 if Pressed otherwise 0) + +--------- A Button (1 if Pressed otherwise 0) +¶ +
To send the byte value [F5]
, the following buttons MUST to be pressed:¶
and the following buttons MUST NOT to be pressed:¶
+ +Copyright (c) 2022, Vi Grey¶
+All rights reserved.¶
+Redistribution and use of this documentation in source (XML format) and/or "compiled" forms (TXT, PDF, HTML, etc), with or without modification, are permitted provided that the following conditions are met:¶
+THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR(S) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.¶
+