Skip to content

Commit 11f6318

Browse files
committed
[ria] API call logging
1 parent e18bdcd commit 11f6318

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ext/firmware

src/systems/x65.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ void _x65_api_call(uint8_t data, void* user_data) {
647647
case API_OP_ZXSTACK: {
648648
xstack_ptr = XSTACK_SIZE;
649649
api_return_ax(0);
650+
LOG_INFO("RIA API: XSTACK emptied");
650651
} break;
651652
case API_OP_PHI2: {
652-
const uint16_t phi2 = CPU_PHI2_DEFAULT;
653-
api_push_uint16(&phi2);
654-
api_return_ax(0);
653+
api_return_ax(CPU_PHI2_DEFAULT);
654+
LOG_INFO("RIA API: PHI2 got: %d", CPU_PHI2_DEFAULT);
655655
} break;
656656
case API_OP_OEM_GET_CHARGEN: {
657657
uint16_t chargen_cp;
@@ -661,16 +661,19 @@ void _x65_api_call(uint8_t data, void* user_data) {
661661
api_return_errno(API_EINVAL);
662662
else {
663663
// blit chargen to memory
664-
for (size_t i = 0; i < 256 * 8; ++i) {
664+
for (uint16_t i = 0; i < 256 * 8; ++i) {
665665
mem_ram_write(sys, chargen_addr++, font_get_byte(i, chargen_cp));
666666
}
667-
api_return_ax((chargen_cp == 0xFFFF || font_8hi(chargen_cp)) ? chargen_cp : 0);
667+
const uint16_t loaded_cp = (chargen_cp == 0xFFFF || font_8hi(chargen_cp)) ? chargen_cp : 0;
668+
api_return_ax(loaded_cp);
669+
LOG_INFO("RIA API: OEM_GET_CHARGEN loaded CP%03d to $%06X", loaded_cp, chargen_addr);
668670
}
669671
} break;
670672
case API_OP_HALT: // STOP CPU
671673
sys->running = false;
674+
LOG_INFO("RIA API: HALT CPU");
672675
break;
673-
default: fprintf(stderr, "Unhandled RIA API call: %02x\n", data);
676+
default: LOG_WARNING("Unhandled RIA API call: %02x", data);
674677
}
675678

676679
// sync RIA regs back

0 commit comments

Comments
 (0)