Skip to content

Commit 2b8bf28

Browse files
committed
emu.c: info from cert: display isPython.
1 parent 375e585 commit 2b8bf28

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

core/asic.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ typedef enum {
1616
TI82AEP = 2
1717
} emu_device_t;
1818

19+
typedef enum {
20+
TIMODEL_8384CE = 0x13,
21+
TIMODEL_82AEP = 0x15
22+
} ti_model_t;
23+
1924
typedef enum {
2025
ASIC_REV_AUTO = 0, /* Used only with set_asic_revision() */
2126
ASIC_REV_PRE_A = 1,

core/emu.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ emu_state_t emu_load(emu_data_t type, const char *path) {
100100
const uint8_t *data;
101101
uint32_t outer_field_size;
102102
uint32_t data_field_size;
103+
ti_model_t model_id = TIMODEL_8384CE;
103104
emu_device_t device_type = TI84PCE;
104105
uint32_t offset;
105106
size_t size;
@@ -139,8 +140,8 @@ emu_state_t emu_load(emu_data_t type, const char *path) {
139140

140141
/* Inner 0x801(0) field: calculator model */
141142
if (cert_field_get(outer, outer_field_size, &field_type, &data, &data_field_size)) break;
142-
if (field_type != 0x8012 || (data[0] != 0x13 && data[0] != 0x15)) break;
143-
const enum { MODEL_8384CE=0x13, MODEL_82AEP=0x15 } model_id = data[0];
143+
if (field_type != 0x8012 || (data[0] != TIMODEL_8384CE && data[0] != TIMODEL_82AEP)) break;
144+
model_id = (ti_model_t)data[0];
144145

145146
/* Inner 0x802(0) field: skip. */
146147
data_field_size = outer_field_size - (data + data_field_size - outer);
@@ -177,23 +178,28 @@ emu_state_t emu_load(emu_data_t type, const char *path) {
177178
if (data[1] != 0 && data[1] != 1) break;
178179
const enum { DEVICE_84PCE=0, DEVICE_83PCE=1 } device_id = data[1];
179180

180-
gui_console_printf("[CEmu] Info from cert: Device type = 0x%02X (%s). Model = 0x%02X (%s).\n",
181-
device_id, (device_id == DEVICE_84PCE) ? "84+CE-like" : "83PCE-like",
182-
model_id, (model_id == MODEL_8384CE) ? "CE" : "82AEP");
183-
184-
if (model_id == MODEL_82AEP && device_id == DEVICE_83PCE) {
181+
if (model_id == TIMODEL_82AEP && device_id == DEVICE_83PCE) {
185182
device_type = TI82AEP;
186183
gotType = true;
187-
} else if (model_id == MODEL_8384CE && device_id == DEVICE_84PCE) {
184+
} else if (model_id == TIMODEL_8384CE && device_id == DEVICE_84PCE) {
188185
device_type = TI84PCE;
189186
gotType = true;
190-
} else if (model_id == MODEL_8384CE && device_id == DEVICE_83PCE) {
187+
} else if (model_id == TIMODEL_8384CE && device_id == DEVICE_83PCE) {
191188
device_type = TI83PCE;
192189
gotType = true;
193190
} else {
194191
gui_console_err_printf("[CEmu] Got model<->device discrepency!?\n");
195192
}
196193

194+
{
195+
static const uint16_t python_path[] = { 0x0330, 0x0430 };
196+
bool isPython = !cert_field_find_path(mem.flash.block + 0x3B0001, SIZE_FLASH_SECTOR_64K, python_path, 2, NULL, NULL);
197+
gui_console_printf("[CEmu] Info from cert: Device type = 0x%02X (%s). Model = 0x%02X (%s). Is Python? %s.\n",
198+
device_id, (device_id == DEVICE_84PCE) ? "84+CE-like" : "83PCE-like",
199+
model_id, (model_id == TIMODEL_8384CE) ? "CE" : "82AEP",
200+
isPython ? "Yes" : "No");
201+
}
202+
197203
gui_console_printf("[CEmu] Loaded ROM Image.\n");
198204
break;
199205
}

0 commit comments

Comments
 (0)