1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2025-07-26 12:24:46 +00:00

Fix use of address 1 to literal 1 for skip instructions

Thank you to the viewers who pointed out the issue at the
end of the stream.

At this point, simple code works, but the conditional
from the joystick input does not seem to work yet.

 * also add location header for linker
 * also filter errors and directives better
This commit is contained in:
Jason Turner
2021-04-22 18:52:50 -06:00
parent 5591249f2a
commit 24012c1ff7
2 changed files with 15 additions and 14 deletions

View File

@@ -5,22 +5,22 @@ enum Colors : uint8_t
WHITE=0x01
};
volatile uint8_t &memory_loc(const uint16_t loc)
static volatile uint8_t &memory_loc(const uint16_t loc)
{
return *reinterpret_cast<volatile uint8_t *>(loc);
}
void decrement_border_color()
static void decrement_border_color()
{
--memory_loc(0xd020);
}
void increment_border_color()
static void increment_border_color()
{
++memory_loc(0xd020);
}
bool joystick_down()
static bool joystick_down()
{
uint8_t joystick_state = memory_loc(0xDC00);
return (joystick_state & 0x2) == 0;
@@ -36,7 +36,7 @@ int main()
while(true) {
if (joystick_down()) {
increment_border_color();
// increment_border_color();
} else {
decrement_border_color();
}