looklook 0.8.0

Descriptive signal synthesiser.
// Copyright 2026 Gabriel Bjørnager Jensen.
//
// This file is part of LOOKLOOK.
//
// LOOKLOOK is free software: you can redistribute it and/or modify it under the
// terms of the GNU Affero General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later ver-
// sion.
//
// LOOKLOOK is distributed in the hope that it will be useful, but WITHOUT ANY WAR-
// RANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License along
// with LOOKLOOK. If not, see <https://www.gnu.org/licenses/>.

//! The [`Instruction::decode`] method.

use crate::vm::{Exception, Vm};

use std::sync::atomic::{Atomic, Ordering};

/// Temporary counter for [`Vm::exec`].
static COUNTER: Atomic<u8> = Atomic::<u8>::new(0);

impl Vm {
	/// Executes the virtual machine.
	#[inline]
	#[must_use]
	pub fn exec(&mut self) -> Option<Exception> {
		// TODO: Decode instructions.

		// NOTE: This is just a temporary thing.
		match COUNTER.fetch_add(1, Ordering::AcqRel) {
			0 => {
				Event::Configure(
					&ll_mode {
						channel_count: 3,
						width:         64,
						height:        64,
						frame_count:   1,
					},
				)
			}

			1 => {
				Event::Push(
					&[
						0x00, 0x00, 0x00,
						0xFF, 0x00, 0x00,
						0x00, 0xFF, 0x00,
						0xFF, 0xFF, 0x00,
						0x00, 0x00, 0xFF,
						0xFF, 0x00, 0xFF,
						0x00, 0xFF, 0xFF,
						0xFF, 0xFF, 0xFF,
					]
				)
			}

			2 => {
				Event::Exit
			}

			_ => {
				unreachable!();
			}
		}
	}
}