2016-07-07 00:35:40 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2021-04-22 16:42:21 +00:00
|
|
|
enum Colors : uint8_t
|
2016-07-07 00:35:40 +00:00
|
|
|
{
|
|
|
|
WHITE=0x01
|
|
|
|
};
|
|
|
|
|
2021-04-23 00:52:50 +00:00
|
|
|
static volatile uint8_t &memory_loc(const uint16_t loc)
|
2016-07-07 00:35:40 +00:00
|
|
|
{
|
|
|
|
return *reinterpret_cast<volatile uint8_t *>(loc);
|
|
|
|
}
|
|
|
|
|
2021-04-23 00:52:50 +00:00
|
|
|
static void decrement_border_color()
|
2016-07-07 00:35:40 +00:00
|
|
|
{
|
|
|
|
--memory_loc(0xd020);
|
|
|
|
}
|
|
|
|
|
2021-04-23 00:52:50 +00:00
|
|
|
static void increment_border_color()
|
2016-07-07 00:35:40 +00:00
|
|
|
{
|
|
|
|
++memory_loc(0xd020);
|
|
|
|
}
|
|
|
|
|
2021-04-23 00:52:50 +00:00
|
|
|
static bool joystick_down()
|
2016-07-07 00:35:40 +00:00
|
|
|
{
|
|
|
|
uint8_t joystick_state = memory_loc(0xDC00);
|
|
|
|
return (joystick_state & 0x2) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
const auto background_color = [](Colors col) {
|
|
|
|
memory_loc(0xd021) = static_cast<uint8_t>(col);
|
|
|
|
};
|
|
|
|
|
|
|
|
background_color(Colors::WHITE);
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
if (joystick_down()) {
|
2021-04-23 00:52:50 +00:00
|
|
|
// increment_border_color();
|
2016-07-07 00:35:40 +00:00
|
|
|
} else {
|
|
|
|
decrement_border_color();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|