fix(interrupt): parse correct amount of data

This commit is contained in:
2025-07-01 12:20:23 +09:00
parent a5cffa4852
commit 0a55b5a68b
2 changed files with 5 additions and 4 deletions

View File

@@ -760,12 +760,12 @@ impl Interpreter {
fn interpret_interrupt(&self, id: u8) -> Result<(), InterpreterError> { fn interpret_interrupt(&self, id: u8) -> Result<(), InterpreterError> {
let bx = self.computer.regs.bx.read(); let bx = self.computer.regs.bx.read();
let w1 = self.computer.read(bx.into())?;
let w2 = self.computer.read((bx + 2).into())?;
let mut data = Vec::new(); let mut data = Vec::new();
data.extend_from_slice(&w1.to_le_bytes()); for i in 0..8 {
data.extend_from_slice(&w2.to_le_bytes()); let word = self.computer.read((bx + 2 * i).into())?;
data.extend_from_slice(&word.to_le_bytes());
}
let msg = InterruptMessage::new(&data); let msg = InterruptMessage::new(&data);

View File

@@ -22,6 +22,7 @@ pub struct Mess1 {
impl Mess1 { impl Mess1 {
pub fn new(data: &Vec<u8>) -> Self { pub fn new(data: &Vec<u8>) -> Self {
log::debug!("Mess1 from data {data:?}");
Self { Self {
i1: Word::from_le_bytes([data[4], data[5]]), i1: Word::from_le_bytes([data[4], data[5]]),
i2: Word::from_le_bytes([data[6], data[7]]), i2: Word::from_le_bytes([data[6], data[7]]),