1
0
mirror of https://github.com/specht/champ.git synced 2024-11-26 01:49:20 +00:00
This commit is contained in:
Michael Specht 2018-02-11 22:44:43 +01:00
parent 0688777f00
commit a795946457

18
champ.c
View File

@ -175,22 +175,22 @@ void refresh_watches(uint16_t address)
{ {
if ((WATCH_ADDRESSES[i] == address) || if ((WATCH_ADDRESSES[i] == address) ||
((WATCH_TYPES[i] == WATCH_U16 || WATCH_TYPES[i] == WATCH_S16) && ((WATCH_TYPES[i] == WATCH_U16 || WATCH_TYPES[i] == WATCH_S16) &&
(WATCH_ADDRESSES[i] == address + 1))) (WATCH_ADDRESSES[i] == address - 1)))
{ {
int32_t value = 0; int32_t value = 0;
switch (WATCH_TYPES[i]) switch (WATCH_TYPES[i])
{ {
case WATCH_U8: case WATCH_U8:
value = (uint8_t)read8(address); value = (uint8_t)read8(WATCH_ADDRESSES[i]);
break; break;
case WATCH_S8: case WATCH_S8:
value = (int8_t)read8(address); value = (int8_t)read8(WATCH_ADDRESSES[i]);
break; break;
case WATCH_U16: case WATCH_U16:
value = (uint16_t)read16(address); value = (uint16_t)read16(WATCH_ADDRESSES[i]);
break; break;
case WATCH_S16: case WATCH_S16:
value = (int16_t)read16(address); value = (int16_t)read16(WATCH_ADDRESSES[i]);
break; break;
} }
fprintf(watches_file, "0x%04x %s %d\n", cpu.ip, WATCH_LABELS[i], value); fprintf(watches_file, "0x%04x %s %d\n", cpu.ip, WATCH_LABELS[i], value);
@ -205,14 +205,6 @@ void write8(uint16_t address, uint8_t value)
refresh_watches(address); refresh_watches(address);
} }
void write16(uint16_t address, uint16_t value)
{
ram[address] = value & 0xff;
ram[address + 1] = (value >> 8) & 0xff;
if (watches_file)
refresh_watches(address);
}
void push(uint8_t value) void push(uint8_t value)
{ {
if (cpu.sp == 0) if (cpu.sp == 0)