Checkpoint - trying to mitigate EOF clicking

This commit is contained in:
kris 2022-05-24 22:19:40 +01:00
parent b97a625d7d
commit 8ea4f150ad
7 changed files with 431 additions and 261 deletions

View File

@ -145,7 +145,7 @@ class Speaker:
y2 = y1
y1 = y
x2 = x1
x1 = voltages[:, i] # XXX does this really always lag?
x1 = voltages[:, i] # XXX does this really always lag?
# print(output)
return output
@ -161,7 +161,7 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
# TODO: avoid temporarily doubling memory footprint to concatenate
data = numpy.ascontiguousarray(numpy.concatenate(
[data, numpy.zeros(max(lookahead_steps, opcodes.cycle_length(
opcodes.Opcode.END_OF_FRAME, is_6502)), dtype=numpy.float32)]))
opcodes.Opcode.END_OF_FRAME_1, is_6502)), dtype=numpy.float32)]))
# Starting speaker position and applied voltage.
# position = 0.0
@ -174,37 +174,6 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
# print(sp.evolve(0, 0, 1.0, 1.0, numpy.full((1, 10000), 1.0)) * sp.scale)
# assert False
# all_partial_positions = {}
# # Precompute partial_positions so we don't skew ETA during encoding.
# for i in range(2048):
# for voltage in [-1.0, 1.0]:
# opcode_hash, _, voltages = opcodes.candidate_opcodes(
# frame_horizon(i, lookahead_steps), lookahead_steps, is_6502)
# print(i, voltages.shape[0])
# delta_powers, partial_positions = _partial_positions(
# voltage * voltages, step)
#
# # These matrices usually have more rows than columns, so store
# # then in column-major order which optimizes for this.
# delta_powers = numpy.asfortranarray(delta_powers)
# partial_positions = numpy.asfortranarray(
# partial_positions)
#
# all_partial_positions[opcode_hash, voltage] = (
# delta_powers, partial_positions)
#
# opcode_partial_positions = {}
# all_opcodes = opcodes.Opcode.__members__.values()
# for op in set(all_opcodes) - {opcodes.Opcode.EXIT}:
# voltages = opcodes.voltage_schedule(op, is_6502)
# for voltage in [-1.0, 1.0]:
# delta_powers, partial_positions = _partial_positions(
# voltage * voltages, step)
# assert delta_powers.shape == partial_positions.shape
# assert delta_powers.shape[-1] == opcodes.cycle_length(op, is_6502)
# opcode_partial_positions[op, voltage] = (
# delta_powers, partial_positions, voltage * voltages[-1])
# XXX
# Smoothing window N --> log_2 N bit resolution
# - 64
@ -228,16 +197,18 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
opcode_counts = collections.defaultdict(int)
y1 = y2 = 0.0 # last 2 speaker positions
while i < int(dlen / 1):
min_lookahead_steps = lookahead_steps
while i < int(dlen / 10):
# print(i, dlen)
if i >= next_tick:
eta.print_status()
next_tick = int(eta.i * dlen / 1000)
# Compute all possible opcode sequences for this frame offset
opcode_hash, candidate_opcodes, voltages = opcodes.candidate_opcodes(
frame_horizon(frame_offset, lookahead_steps), lookahead_steps,
is_6502)
opcode_hash, candidate_opcodes, voltages, lookahead_steps = \
opcodes.candidate_opcodes(
frame_horizon(frame_offset, min_lookahead_steps),
min_lookahead_steps, is_6502)
# print(frame_offset, lookahead_steps)
all_positions = sp.evolve(y1, y2, voltage1, voltage2, voltage1
* voltages)
@ -255,7 +226,7 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
# smoothed_window, voltage * voltages, data[i:i + lookahead_steps],
# lookahead_steps)
assert all_positions.shape[1] == lookahead_steps
# assert all_positions.shape[1] == lookahead_steps
# Pick the opcode sequence that minimizes the total squared error
# relative to the data waveform. This total_error() call is where
# about 75% of CPU time is spent.
@ -266,7 +237,7 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
opcode = candidate_opcodes[opcode_idx][0]
opcode_length = opcodes.cycle_length(opcode, is_6502)
opcode_counts[opcode] += 1
toggles += opcodes.TOGGLES[opcode]
# toggles += opcodes.TOGGLES[opcode]
# Apply this opcode to evolve the speaker position
opcode_voltages = (voltage1 * opcodes.voltage_schedule(
@ -284,13 +255,19 @@ def audio_bytestream(data: numpy.ndarray, step: int, lookahead_steps: int,
y1 = all_positions[0, -1]
y2 = all_positions[0, -2]
# print(y1, y2, all_positions[0] * sp.scale)
total_err += total_error(
new_error = total_error(
all_positions[0] * sp.scale, data[i:i + opcode_length]).item()
total_err += new_error
if new_error > 1:
print(i, frame_offset, new_error)
# print(all_positions[0] * sp.scale, data[i:i + opcode_length])
# print(frame_offset, opcode)
for v in all_positions[0]:
yield v * sp.scale
# print(v * sp.scale)
# for v in opcode_voltages[0]:
# print(" %d" % v)
i += opcode_length
frame_offset = (frame_offset + 1) % 2048

View File

@ -78,6 +78,24 @@ def all_opcodes(
num_opcodes += 1
def _make_end_of_frame_voltages(skip) -> numpy.ndarray:
"""Voltage sequence for end-of-frame TCP processing."""
length = 160 # 4 + 14 * 10 + 6
c = numpy.full(length, 1.0, dtype=numpy.float32)
voltage_high = True
# toggles = 0
for i in range(0, 16):
voltage_high = not voltage_high
# toggles += 1
for j in range(3 + 10 * i + skip , min(length, 3 + 10 * (i + 1) +
skip)):
c[j] = 1.0 if voltage_high else -1.0
return c
eof_bits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def generate_player(player_ops: List[Tuple[Opcode]], opcode_filename: str,
player_filename: str):
num_bytes = 0
@ -129,13 +147,20 @@ def generate_player(player_ops: List[Tuple[Opcode]], opcode_filename: str,
for o in unique_opcodes.keys():
f.write(" TICK_%02x = 0x%02x\n" % (o, o))
f.write(" EXIT = 0x%02x\n" % num_bytes)
f.write(" END_OF_FRAME = 0x%02x\n" % (num_bytes + 3))
# f.write(" END_OF_FRAME = 0x%02x\n" % (num_bytes + 3))
for i in eof_bits:
f.write(" END_OF_FRAME_%d = 0x%02x\n" % (i, num_bytes + 4 + i))
f.write("\n\nVOLTAGE_SCHEDULE = {\n")
for o, v in unique_opcodes.items():
f.write(
" Opcode.TICK_%02x: numpy.array(%s, dtype=numpy.float32),"
"\n" % (o, v))
for i in eof_bits:
f.write(" Opcode.END_OF_FRAME_%d: numpy.array([%s], "
"dtype=numpy.float32),\n" % (i, ", ".join(
str(f) for f in _make_end_of_frame_voltages(
i))))
f.write("}\n")
f.write("\n\nTOGGLES = {\n")
@ -145,6 +170,11 @@ def generate_player(player_ops: List[Tuple[Opcode]], opcode_filename: str,
)
f.write("}\n")
f.write("\n\nEOF_OPCODES = (\n")
for i in eof_bits:
f.write(" Opcode.END_OF_FRAME_%d,\n" % i)
f.write(")\n")
def all_opcode_combinations(
max_cycles: int, opcodes: Iterable[Opcode], start_opcodes: List[int]

View File

@ -4,26 +4,32 @@ import opcodes_generated
import numpy
from typing import Dict, List, Tuple, Iterable
def _make_end_of_frame_voltages() -> numpy.ndarray:
"""Voltage sequence for end-of-frame TCP processing."""
length = 4 + 14 * 10 + 6
c = numpy.full(length, 1.0, dtype=numpy.float32)
voltage_high = True
toggles = 0
for i in range(15):
voltage_high = not voltage_high
toggles += 1
for j in range(3 + 10 * i, min(length, 3 + 10 * (i + 1))):
c[j] = 1.0 if voltage_high else -1.0
return c, toggles
#
# def _make_end_of_frame_voltages(bits) -> numpy.ndarray:
# """Voltage sequence for end-of-frame TCP processing."""
# length = 8 * 20 # 4 + 14 * 10 + 6
# c = numpy.full(length, 1.0, dtype=numpy.float32)
# voltage_high = True
# toggles = 0
# for i in range(8):
# if bool((bits >> i) & 1):
# voltage_high = not voltage_high
# toggles += 1
# for j in range(3 + 20 * i, min(length, 3 + 20 * (i + 1))):
# c[j] = 1.0 if voltage_high else -1.0
# return c, toggles
Opcode = opcodes_generated.Opcode
TOGGLES = opcodes_generated.TOGGLES
_VOLTAGE_SCHEDULE = opcodes_generated.VOLTAGE_SCHEDULE
_VOLTAGE_SCHEDULE[Opcode.END_OF_FRAME], TOGGLES[Opcode.END_OF_FRAME] = (
_make_end_of_frame_voltages())
# _VOLTAGE_SCHEDULE[Opcode.END_OF_FRAME], TOGGLES[Opcode.END_OF_FRAME] = (
# _make_end_of_frame_voltages())
# _VOLTAGE_EOF = {}
# # _TOGGLES_EOF = {}
# for i in range(256):
# _VOLTAGE_EOF[i], _ = _make_end_of_frame_voltages(i)
def cycle_length(op: Opcode, is_6502: bool) -> int:
@ -49,12 +55,13 @@ def opcode_choices(frame_offset: int, is_6502: bool) -> List[Opcode]:
stream bitrate.
"""
if frame_offset == 2047:
return [Opcode.END_OF_FRAME]
return opcodes_generated.EOF_OPCODES
def _cycle_length(op: Opcode) -> int:
return cycle_length(op, is_6502)
opcodes = set(_VOLTAGE_SCHEDULE.keys()) - {Opcode.END_OF_FRAME}
opcodes = set(_VOLTAGE_SCHEDULE.keys()) - set(opcodes_generated.EOF_OPCODES)
# print(frame_offset, opcodes)
return sorted(list(opcodes), key=_cycle_length, reverse=True)
@ -104,6 +111,14 @@ def candidate_opcodes(
lookahead_cycles, retains the first such opcode sequence.
"""
opcodes = opcode_lookahead(frame_offset, lookahead_cycles, is_6502)
# Look ahead over the common cycle subsequence to make sure we see as far
# as possible into the future
cycles = []
for ops in opcodes:
op_len = sum(cycle_length(op, is_6502) for op in ops)
cycles.append(op_len)
# print(cycles)
lookahead_cycles = min(cycles)
seen_cycles = set()
pruned_opcodes = []
pruned_cycles = []
@ -119,4 +134,4 @@ def candidate_opcodes(
# Precompute and return the hash since it's relatively expensive to
# recompute.
return hash(pruned_opcodes), pruned_opcodes, numpy.array(
pruned_cycles, dtype=numpy.float32)
pruned_cycles, dtype=numpy.float32), lookahead_cycles

View File

@ -7,83 +7,92 @@ class Opcode(enum.Enum):
TICK_03 = 0x03
TICK_06 = 0x06
TICK_09 = 0x09
TICK_0c = 0x0c
TICK_0f = 0x0f
TICK_12 = 0x12
TICK_0a = 0x0a
TICK_0d = 0x0d
TICK_10 = 0x10
TICK_13 = 0x13
TICK_14 = 0x14
TICK_1f = 0x1f
TICK_24 = 0x24
TICK_1a = 0x1a
TICK_1d = 0x1d
TICK_1e = 0x1e
TICK_27 = 0x27
TICK_2a = 0x2a
TICK_2f = 0x2f
TICK_32 = 0x32
TICK_34 = 0x34
TICK_3b = 0x3b
TICK_3e = 0x3e
TICK_40 = 0x40
TICK_47 = 0x47
TICK_4a = 0x4a
TICK_33 = 0x33
TICK_36 = 0x36
TICK_39 = 0x39
TICK_3a = 0x3a
TICK_3f = 0x3f
TICK_42 = 0x42
TICK_43 = 0x43
TICK_4b = 0x4b
TICK_53 = 0x53
TICK_56 = 0x56
TICK_62 = 0x62
TICK_6a = 0x6a
TICK_6d = 0x6d
TICK_75 = 0x75
TICK_80 = 0x80
TICK_8a = 0x8a
TICK_95 = 0x95
TICK_9f = 0x9f
TICK_a2 = 0xa2
TICK_a4 = 0xa4
TICK_ae = 0xae
TICK_b5 = 0xb5
TICK_b8 = 0xb8
TICK_bf = 0xbf
TICK_c9 = 0xc9
EXIT = 0xd2
END_OF_FRAME = 0xd5
TICK_4e = 0x4e
TICK_4f = 0x4f
TICK_57 = 0x57
TICK_5a = 0x5a
TICK_5b = 0x5b
TICK_63 = 0x63
TICK_6e = 0x6e
TICK_79 = 0x79
TICK_84 = 0x84
TICK_87 = 0x87
TICK_88 = 0x88
TICK_8f = 0x8f
EXIT = 0x99
END_OF_FRAME_0 = 0x9d
END_OF_FRAME_1 = 0x9e
END_OF_FRAME_2 = 0x9f
END_OF_FRAME_3 = 0xa0
END_OF_FRAME_4 = 0xa1
END_OF_FRAME_5 = 0xa2
END_OF_FRAME_6 = 0xa3
END_OF_FRAME_7 = 0xa4
END_OF_FRAME_8 = 0xa5
END_OF_FRAME_9 = 0xa6
VOLTAGE_SCHEDULE = {
Opcode.TICK_00: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_03: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_06: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_09: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_0c: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_0f: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_12: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_14: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_1f: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_24: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_27: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_2a: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_2f: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_32: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_34: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_3b: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_3e: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_40: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_47: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_4a: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_4b: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_53: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_56: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_62: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_6a: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_6d: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_75: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_80: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_8a: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_95: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_9f: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_a2: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_a4: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_ae: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_b5: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_b8: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_bf: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_c9: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_00: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_03: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_06: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_09: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_0a: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_0d: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_10: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_13: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_14: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_1a: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_1d: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_1e: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_27: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_33: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_36: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_39: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_3a: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_3f: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_42: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_43: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_4b: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_4e: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_4f: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_57: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_5a: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_5b: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_63: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_6e: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_79: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_84: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.TICK_87: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_88: numpy.array((1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), dtype=numpy.float32),
Opcode.TICK_8f: numpy.array((1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0), dtype=numpy.float32),
Opcode.END_OF_FRAME_0: numpy.array([1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_1: numpy.array([1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_2: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_3: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_4: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_5: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_6: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_7: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_8: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], dtype=numpy.float32),
Opcode.END_OF_FRAME_9: numpy.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], dtype=numpy.float32),
}
@ -92,38 +101,47 @@ TOGGLES = {
Opcode.TICK_03: 2,
Opcode.TICK_06: 1,
Opcode.TICK_09: 0,
Opcode.TICK_0c: 2,
Opcode.TICK_0f: 1,
Opcode.TICK_12: 0,
Opcode.TICK_14: 0,
Opcode.TICK_1f: 0,
Opcode.TICK_24: 2,
Opcode.TICK_27: 1,
Opcode.TICK_2a: 0,
Opcode.TICK_2f: 2,
Opcode.TICK_32: 1,
Opcode.TICK_34: 1,
Opcode.TICK_3b: 2,
Opcode.TICK_3e: 1,
Opcode.TICK_40: 1,
Opcode.TICK_47: 2,
Opcode.TICK_4a: 1,
Opcode.TICK_4b: 1,
Opcode.TICK_53: 2,
Opcode.TICK_56: 1,
Opcode.TICK_62: 1,
Opcode.TICK_6a: 2,
Opcode.TICK_6d: 1,
Opcode.TICK_75: 2,
Opcode.TICK_80: 2,
Opcode.TICK_8a: 2,
Opcode.TICK_95: 2,
Opcode.TICK_9f: 1,
Opcode.TICK_a2: 0,
Opcode.TICK_a4: 0,
Opcode.TICK_ae: 0,
Opcode.TICK_b5: 1,
Opcode.TICK_b8: 0,
Opcode.TICK_bf: 1,
Opcode.TICK_c9: 1,
Opcode.TICK_0a: 0,
Opcode.TICK_0d: 3,
Opcode.TICK_10: 2,
Opcode.TICK_13: 1,
Opcode.TICK_14: 1,
Opcode.TICK_1a: 3,
Opcode.TICK_1d: 2,
Opcode.TICK_1e: 2,
Opcode.TICK_27: 3,
Opcode.TICK_33: 2,
Opcode.TICK_36: 1,
Opcode.TICK_39: 0,
Opcode.TICK_3a: 0,
Opcode.TICK_3f: 2,
Opcode.TICK_42: 1,
Opcode.TICK_43: 1,
Opcode.TICK_4b: 2,
Opcode.TICK_4e: 1,
Opcode.TICK_4f: 1,
Opcode.TICK_57: 2,
Opcode.TICK_5a: 1,
Opcode.TICK_5b: 1,
Opcode.TICK_63: 2,
Opcode.TICK_6e: 2,
Opcode.TICK_79: 2,
Opcode.TICK_84: 1,
Opcode.TICK_87: 0,
Opcode.TICK_88: 0,
Opcode.TICK_8f: 1,
}
EOF_OPCODES = (
Opcode.END_OF_FRAME_0,
Opcode.END_OF_FRAME_1,
Opcode.END_OF_FRAME_2,
Opcode.END_OF_FRAME_3,
Opcode.END_OF_FRAME_4,
Opcode.END_OF_FRAME_5,
Opcode.END_OF_FRAME_6,
Opcode.END_OF_FRAME_7,
Opcode.END_OF_FRAME_8,
Opcode.END_OF_FRAME_9,
)

View File

@ -396,3 +396,161 @@ checkrecv:
STA TICK ; 4 [10]
JMP (WDATA) ; 6
.endproc
; 72 cycles --> 133 with tick padding
; 13 ticks is too much to parametrize
_end_of_frame:
; Save the W5100 address pointer so we can come back here later
; We know the low-order byte is 0 because Socket RX memory is page-aligned and so is 2K frame.
; IMPORTANT - from now on until we restore this below, we can't trash the Y register!
STA zpdummy ; 3
STA TICK ; 4
LDY WADRH ; 4
; Read Received Read pointer
; XXX we know what it should be though, += 8 from last time
LDA #>S0RXRD ; 2
STA TICK ; [10]
STA WADRH ; 4
LDX #<S0RXRD ; 2
STA TICK ; [10]
STX WADRL ; 4
; Update new Received Read pointer
; We have received an additional 2KB
CLC ; 2
STA TICK ; [10]
LDA RXRD ; 4
ADC #$08 ; 2
STA TICK ; [10]
STA WDATA ; 4 Store new high byte
LDX #<S0CR ; 2 prepare to reset WADRL
STA TICK ; [10]
STA RXRDZP ; 4
; Send the Receive command
LDA #SCRECV ; 2
STA TICK ; [10]
STX WADRL ; 4
LDX #<S0RXRSR ; 2 Socket 0 Received Size register
STA TICK ; [10]
STA WDATA ; 4 #SCRECV
checkrecv:
LDA #$07 ; 2
; we might loop an unknown number of times here waiting for data but the default should be to fall
; straight through
@0:
STA TICK ; [10]
STX WADRL ; 4 #<S0RXRSR
NOP ; 2
STA TICK ; [10]
CMP WDATA ; 4 High byte of received size
BCS @0 ; 2 in common case when there is already sufficient data waiting.
STA TICK ; [10]
; point W5100 back into the RX buffer where we left off
; There is data to read - we don't care exactly how much because it's at least 2K
;
; Restore W5100 address pointer where we last found it.
;
; It turns out that the W5100 automatically wraps the address pointer at the end of the 8K RX/TX buffers
; Since we're using an 8K socket, that means we don't have to do any work to manage the read pointer!
STY WADRH ; 4
LDX #$00 ; 2
STA TICK ; [10]
STX WADRL ; 4
NOP ; 2
STA TICK ; [10]
JMP (WDATA) ; 6
; frame trampoline
LDX WDATA ; 4
STA @0+2 ; 4
@0:
JMP ($xx00) ; 6 - 7 bit index table
; 72 cycles --> 133 with tick padding
; 13 ticks is too much to parametrize with 8 bits
;
; splitting still requires 9 + 8 ticks, can't fit in 7-bit jump table
_end_of_frame:
; Save the W5100 address pointer so we can come back here later
; We know the low-order byte is 0 because Socket RX memory is page-aligned and so is 2K frame.
; IMPORTANT - from now on until we restore this below, we can't trash the Y register!
STA zpdummy ; 3
STA TICK ; 4
LDY WADRH ; 4
; Read Received Read pointer
; XXX we know what it should be though, += 8 from last time
LDA #>S0RXRD ; 2
STA TICK ; [10]
STA WADRH ; 4
LDX #<S0RXRD ; 2
STA TICK ; [10]
STX WADRL ; 4
; Update new Received Read pointer
; We have received an additional 2KB
CLC ; 2 - XXX maybe can assume
STA TICK ; [10]
LDA RXRD ; 4 - could use ZP but that would mess up our tick offsets
ADC #$08 ; 2
STA TICK ; [10]
STA WDATA ; 4 Store new high byte
LDX #<S0CR ; 2 prepare to reset WADRL
STA TICK ; [10]
STA RXRDZP ; 4
NOP ; 2
STA TICK ; [10]
STY WADRH ; 4
LDX #$00 ; 2
STA TICK ; [10]
STX WADRL ; 4
NOP ; 2
STA TICK ; [10]
JMP (WDATA) ; 6
_end_of_frame2:
STA zpdummy ; 3
STA TICK ; 4
LDY WADRH ; 4
; Send the Receive command
LDA #SCRECV ; 2
STA TICK ; [10]
STX WADRL ; 4 #<S0CR
LDX #<S0RXRSR ; 2 Socket 0 Received Size register
STA TICK ; [10]
STA WDATA ; 4 #SCRECV
checkrecv:
LDA #$07 ; 2
; we might loop an unknown number of times here waiting for data but the default should be to fall
; straight through
@0:
STA TICK ; [10]
STX WADRL ; 4 #<S0RXRSR
NOP ; 2
STA TICK ; [10]
CMP WDATA ; 4 High byte of received size
BCS @0 ; 2 in common case when there is already sufficient data waiting.
STA TICK ; [10]
; point W5100 back into the RX buffer where we left off
; There is data to read - we don't care exactly how much because it's at least 2K
;
; Restore W5100 address pointer where we last found it.
;
; It turns out that the W5100 automatically wraps the address pointer at the end of the 8K RX/TX buffers
; Since we're using an 8K socket, that means we don't have to do any work to manage the read pointer!
STY WADRH ; 4
LDX #$00 ; 2
STA TICK ; [10]
STX WADRL ; 4
NOP ; 2
STA TICK ; [10]
JMP (WDATA) ; 6

View File

@ -1,151 +1,118 @@
tick_00: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_00: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_03: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_03: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_06: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_06: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_09: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
JMP (WDATA)
tick_0c: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_0f: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_12: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA zpdummy
tick_14: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_09: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
tick_0a: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
JMP (WDATA)
tick_0d: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_10: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_13: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
tick_1f: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA zpdummy
tick_14: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
JMP (WDATA)
tick_24: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_1a: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_27: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_1d: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
tick_1e: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_2a: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
JMP (WDATA)
tick_27: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
STA $C030
STA $C030
JMP (WDATA)
tick_33: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_36: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_39: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
tick_3a: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
NOP
JMP (WDATA)
tick_2f: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_3f: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_32: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA zpdummy
tick_34: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_42: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
tick_43: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
NOP
NOP
JMP (WDATA)
tick_3b: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_4b: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_3e: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA zpdummy
tick_40: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_4e: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
STA $C030
JMP (WDATA)
tick_47: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_4a: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
tick_4b: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
STA zpdummy
JMP (WDATA)
tick_53: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_56: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_4f: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
STA $C030
NOP
JMP (WDATA)
tick_57: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_5a: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
tick_62: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA zpdummy
STA $C030
JMP (WDATA)
tick_6a: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_6d: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_5b: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
NOP
NOP
STA $C030
JMP (WDATA)
tick_75: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
tick_63: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
STA $C030
STA zpdummy
JMP (WDATA)
tick_80: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
STA $C030
NOP
JMP (WDATA)
tick_8a: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
STA zpdummy
STA $C030
JMP (WDATA)
tick_95: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
NOP
STA $C030
JMP (WDATA)
tick_9f: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_a2: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA zpdummy
tick_a4: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
NOP
NOP
JMP (WDATA)
tick_6e: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
NOP
tick_ae: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA zpdummy
NOP
STA $C030
NOP
JMP (WDATA)
tick_b5: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_79: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
STA $C030
tick_b8: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
NOP
STA $C030
JMP (WDATA)
tick_84: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
tick_87: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
tick_88: ; voltages (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
NOP
NOP
NOP
NOP
JMP (WDATA)
tick_bf: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
tick_8f: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
STA zpdummy
NOP
NOP
JMP (WDATA)
tick_c9: ; voltages (1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0)
STA $C030
NOP
NOP
NOP
JMP (WDATA)
; 210 bytes
; 153 bytes

View File

@ -29,21 +29,26 @@ def wave(count: int):
x1 = 1.0
th = 44100/3875/2
switch = th
scale = 25 # TODO: analytic expression
scale = 3 # TODO: analytic expression
maxy = 0
for i in range(count):
y = c1 * y1 - c2 * y2 + b1 * x1 + b2 * x2
x2 = x1
if i >= switch:
x1 = -x1
switch += th
# if i >= switch:
# x1 = -x1
# switch += th
y2 = y1
y1 = y
if math.fabs(y) > maxy:
maxy = math.fabs(y)
yield y / scale
print(maxy)
def main():
with sf.SoundFile("out.wav", "w", samplerate=44100, channels=1) as f:
f.write(list(wave(441000)))
print(list(wave(1020400)))
# with sf.SoundFile("out.wav", "w", samplerate=44100, channels=1) as f:
# f.write(list(wave(441000)))
if __name__ == "__main__":