dreamcast/gdrom/command_packet_format_byte_order.hpp
Zack Buhman 10d17d3c98 example: add gdrom_iso9660
This combines my iso9660 parsing code, with all of the prior gdrom packet
interface / command code.

The example, on real Dreamcast hardware, displays the first 2048 bytes [1] of every
file in the root directory on the serial console.

[1] or the size of the file, whichever is smaller
2024-02-27 00:28:39 +08:00

22 lines
468 B
C++

#include <cstdint>
namespace gdrom_command_packet_format {
template <int N>
constexpr void byte_order(uint8_t * buf, const uint32_t n);
template <>
constexpr void byte_order<2>(uint8_t * buf, const uint32_t n)
{
buf[0] = (n >> 8) & 0xff;
buf[1] = (n >> 0) & 0xff;
}
template <>
constexpr void byte_order<3>(uint8_t * buf, const uint32_t n)
{
buf[0] = (n >> 16) & 0xff;
buf[1] = (n >> 8) & 0xff;
buf[2] = (n >> 0) & 0xff;
}
}