diff --git a/src/vm.cpp b/src/vm.cpp index 9b8b10f..5644d1d 100644 --- a/src/vm.cpp +++ b/src/vm.cpp @@ -58,6 +58,14 @@ void UART::write_mem_u8(uint8_t* src, size_t addr) { } } +void UART::write_mem_u32(uint32_t* src, size_t addr) { + uint8_t* s = (uint8_t*)src; + + for (size_t i = 0; i < 4; i++) { + write_mem_u8(s + i, addr + i); + } +} + void Timer::update() { using Clock = std::chrono::high_resolution_clock; constexpr auto den = Clock::period::den; diff --git a/src/vm.hpp b/src/vm.hpp index 0e5f0b8..478f8a7 100644 --- a/src/vm.hpp +++ b/src/vm.hpp @@ -75,6 +75,7 @@ class UART final : public Device { UART() : Device(UART_ADDR, 8) {} virtual void write_mem_u8(uint8_t *src, size_t addr); + virtual void write_mem_u32(uint32_t *src, size_t addr); virtual void read_mem_u8(uint8_t *dst, size_t addr);