Compare commits
No commits in common. "83f6ffab56369d1524c3c046a9f5151587e67f54" and "4657e649b80335d07ca4a84c81a15fe46265c927" have entirely different histories.
83f6ffab56
...
4657e649b8
30
src/main.rs
30
src/main.rs
|
@ -252,28 +252,21 @@ impl Lsdpack {
|
||||||
self.repeat_cmd = None;
|
self.repeat_cmd = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let (cmd, flagged_ongoing) = self.load_new_cmd_from_stream();
|
let cmd = self.load_new_cmd_from_stream();
|
||||||
ongoing = flagged_ongoing;
|
ongoing = self.apply_cmd(cmd);
|
||||||
ongoing &= self.apply_cmd(cmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[link_section = ".iwram"]
|
#[link_section = ".iwram"]
|
||||||
fn load_new_cmd_from_stream(&mut self) -> (LsdpackCmd, bool) {
|
fn load_new_cmd_from_stream(&mut self) -> LsdpackCmd {
|
||||||
const FLAG_REPEAT: u8 = 0x40;
|
let cmd = self.next_byte();
|
||||||
const FLAG_END_TICK: u8 = 0x80;
|
if cmd & 0x40 != 0 {
|
||||||
let mut cmd = self.next_byte();
|
self.repeat_cmd = Some((cmd & 0x3f).into());
|
||||||
let mut ongoing = true;
|
|
||||||
if cmd & FLAG_END_TICK != 0 {
|
|
||||||
cmd &= !FLAG_END_TICK;
|
|
||||||
ongoing = false;
|
|
||||||
}
|
|
||||||
if cmd & FLAG_REPEAT != 0 {
|
|
||||||
cmd &= !FLAG_REPEAT;
|
|
||||||
self.repeat_cmd = Some(cmd.into());
|
|
||||||
self.repeat_cmd_counter = self.next_byte() as usize;
|
self.repeat_cmd_counter = self.next_byte() as usize;
|
||||||
|
self.repeat_cmd.unwrap()
|
||||||
|
} else {
|
||||||
|
cmd.into()
|
||||||
}
|
}
|
||||||
(cmd.into(), ongoing)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[link_section = ".iwram"]
|
#[link_section = ".iwram"]
|
||||||
|
@ -425,13 +418,12 @@ extern "C" fn main() -> ! {
|
||||||
IE.write(IrqBits::VBLANK.with_timer0(true));
|
IE.write(IrqBits::VBLANK.with_timer0(true));
|
||||||
IME.write(true);
|
IME.write(true);
|
||||||
|
|
||||||
//TIMER0_RELOAD.write((((16777216 / 1) / 360) as u16).wrapping_neg());
|
TIMER0_RELOAD.write((((16777216 / 256) / 6) as u16).wrapping_neg());
|
||||||
TIMER0_RELOAD.write((((280896 / 1) / 6) as u16).wrapping_neg());
|
|
||||||
TIMER0_CONTROL.write(
|
TIMER0_CONTROL.write(
|
||||||
TimerControl::new()
|
TimerControl::new()
|
||||||
.with_overflow_irq(true)
|
.with_overflow_irq(true)
|
||||||
.with_cascade(false)
|
.with_cascade(false)
|
||||||
.with_scale(TimerScale::_1)
|
.with_scale(TimerScale::_256)
|
||||||
.with_enabled(true),
|
.with_enabled(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue