Mercurial > repos > blastem
comparison m68k_core.c @ 1776:d5118d6f9c75 mame_interp
Hopefully fix 68K serialization/deserialization with Musashi
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 13 Mar 2019 19:13:46 -0700 |
parents | 75172d440900 |
children | 30b5952fd32e |
comparison
equal
deleted
inserted
replaced
1775:a9fc826c6a9d | 1776:d5118d6f9c75 |
---|---|
1300 } | 1300 } |
1301 for (int i = 0; i < 9; i++) | 1301 for (int i = 0; i < 9; i++) |
1302 { | 1302 { |
1303 save_int32(buf, context->aregs[i]); | 1303 save_int32(buf, context->aregs[i]); |
1304 } | 1304 } |
1305 #ifdef USE_NATIVE | |
1305 save_int32(buf, pc); | 1306 save_int32(buf, pc); |
1306 uint16_t sr = context->status << 3; | 1307 uint16_t sr = context->status << 3; |
1307 for (int flag = 4; flag >= 0; flag--) { | 1308 for (int flag = 4; flag >= 0; flag--) { |
1308 sr <<= 1; | 1309 sr <<= 1; |
1309 sr |= context->flags[flag] != 0; | 1310 sr |= context->flags[flag] != 0; |
1310 } | 1311 } |
1311 save_int16(buf, sr); | 1312 save_int16(buf, sr); |
1313 #else | |
1314 m68000_base_device *device = (m68000_base_device *)context; | |
1315 save_int32(buf, device->pc); | |
1316 save_int16(buf, m68ki_get_sr(device)); | |
1317 #endif | |
1312 save_int32(buf, context->current_cycle); | 1318 save_int32(buf, context->current_cycle); |
1313 save_int32(buf, context->int_cycle); | 1319 save_int32(buf, context->int_cycle); |
1314 save_int8(buf, context->int_num); | 1320 save_int8(buf, context->int_num); |
1315 save_int8(buf, context->int_pending); | 1321 save_int8(buf, context->int_pending); |
1316 save_int8(buf, context->trace_pending); | 1322 save_int8(buf, context->trace_pending); |
1325 } | 1331 } |
1326 for (int i = 0; i < 9; i++) | 1332 for (int i = 0; i < 9; i++) |
1327 { | 1333 { |
1328 context->aregs[i] = load_int32(buf); | 1334 context->aregs[i] = load_int32(buf); |
1329 } | 1335 } |
1336 #ifdef USE_NATIVE | |
1330 //hack until both PC and IR registers are represented properly | 1337 //hack until both PC and IR registers are represented properly |
1331 context->last_prefetch_address = load_int32(buf); | 1338 context->last_prefetch_address = load_int32(buf); |
1332 uint16_t sr = load_int16(buf); | 1339 uint16_t sr = load_int16(buf); |
1333 context->status = sr >> 8; | 1340 context->status = sr >> 8; |
1334 for (int flag = 0; flag < 5; flag++) | 1341 for (int flag = 0; flag < 5; flag++) |
1335 { | 1342 { |
1336 context->flags[flag] = sr & 1; | 1343 context->flags[flag] = sr & 1; |
1337 sr >>= 1; | 1344 sr >>= 1; |
1338 } | 1345 } |
1346 #else | |
1347 m68000_base_device *device = vcontext; | |
1348 device->pc = load_int32(buf); | |
1349 m68ki_set_sr_noint_nosp(device, load_int16(buf)); | |
1350 #endif | |
1339 context->current_cycle = load_int32(buf); | 1351 context->current_cycle = load_int32(buf); |
1340 context->int_cycle = load_int32(buf); | 1352 context->int_cycle = load_int32(buf); |
1341 context->int_num = load_int8(buf); | 1353 context->int_num = load_int8(buf); |
1342 context->int_pending = load_int8(buf); | 1354 context->int_pending = load_int8(buf); |
1343 context->trace_pending = load_int8(buf); | 1355 context->trace_pending = load_int8(buf); |