Read memory from VB

This commit is contained in:
Simon Gellis 2024-10-01 21:27:40 -04:00
parent 294324fe28
commit 42396701e0
1 changed files with 2 additions and 11 deletions

13
main.c
View File

@ -259,16 +259,6 @@ int handle_command(RdbClient *client, char *cmd, size_t cmdlen, VB *sim) {
rdb_client_write_str(client, ";");
return rdb_client_send_packet(client);
}
if (!strncmp(cmd, "m7000000,100", cmdlen)) {
// hard-coded fake memory region
const char *fake = "80bc000784a0e002a0bc0005a5a00000c0bc0005c6a0000000a81000";
size_t fakelen = strlen(fake) / 2;
rdb_client_write_str(client, fake);
for (size_t i = fakelen; i < 256; ++i) {
rdb_client_write_str(client, "00");
}
return rdb_client_send_packet(client);
}
if (*cmd == 'm') {
// all other memory is 0
int commapos = -1;
@ -290,7 +280,8 @@ int handle_command(RdbClient *client, char *cmd, size_t cmdlen, VB *sim) {
}
printf("read %d bytes from %d\n", len, address);
for (int i = 0; i < len; ++i) {
rdb_client_write_str(client, "00");
uint8_t byte = vbRead(sim, address + i, VB_U8);
rdb_client_write_i8_hex(client, byte);
}
return rdb_client_send_packet(client);
}