Changed magic

This commit is contained in:
Erin 2023-08-01 22:20:11 +02:00
parent 73b998911c
commit 8287b1bdc1
3 changed files with 4 additions and 4 deletions

View file

@ -72,7 +72,7 @@ impl Assembler {
/// Why 12 bytes? That's the size of largest instruction parameter part.
pub fn finalise(&mut self) {
self.buf.extend([0; 12]);
self.buf[0..3].copy_from_slice(&[0xAB, 0x1E, 0x0B]);
self.buf[0..4].copy_from_slice(&0xAB1E0B_u32.to_le_bytes());
}
}

View file

@ -40,7 +40,7 @@ macro_rules! gen_valider {
/// sound to execute.
pub fn validate(mut program: &[u8]) -> Result<(), Error> {
// Validate magic
if program.get(0..3) != Some(&[0xAB, 0x1E, 0x0B]) {
if program.get(0..4) != Some(&0xAB1E0B_u32.to_le_bytes()) {
return Err(Error {
kind: ErrorKind::MissingMagic,
index: 0,
@ -67,7 +67,7 @@ macro_rules! gen_valider {
}
let start = program;
program = &program[3..];
program = &program[4..];
loop {
use crate::opcode::*;
program = match program {

View file

@ -73,7 +73,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize>
pfhandler: traph,
pc: 0,
program_len: program.len() - 12,
program: &program[3..],
program: &program[4..],
timer: 0,
copier: None,
}