dreamcast/imask.h
Zack Buhman 25fef821b0 maple: read controller input on real hardware
There were two notable bugs:

- the maple transfer/data sizes were not being set correctly

- align_32byte always realigned the address of `_scene`, and not the
  `mem` parameter as expected. This had the effect of the maple-DMA
  send and receive buffers being the same buffer. On real hardware,
  this causes unpredicable behavior.
2023-12-10 00:44:33 +08:00

21 lines
231 B
C++

#pragma once
#include <cstdint>
inline void set_imask(uint32_t imask)
{
uint32_t sr;
asm volatile ("stc sr,%0"
: "=r" (sr)
:
);
sr = (sr & ~0xf0) | (imask << 4);
asm volatile ("ldc %0,sr"
:
: "r" (sr)
);
}