9 static const char VICE_MAGIC[] =
"VICE Snapshot File\032";
10 #define VICE_MAGIC_LEN sizeof(VICE_MAGIC) - 1
23 {
"C64",
"Commodore 64",
rz_offsetof(
struct vsf_c64mem, ram), 64 * 1024 },
24 {
"C128",
"Commodore 128",
rz_offsetof(
struct vsf_c128mem, ram), 128 * 1024 },
73 eprintf(
"Unsupported machine type\n");
78 offset =
sizeof(
struct vsf_hdr);
88 #define CMP_MODULE(x) memcmp(module.module_name, x, sizeof(x) - 1)
104 eprintf(
"Malformed VSF module with length 0\n");
166 ptr->
size = 1024 * 8;
168 ptr->
vsize = 1024 * 8;
178 ptr->
size = 1024 * 8;
180 ptr->
vsize = 1024 * 8;
193 ptr->
size = 1024 * 28;
195 ptr->
vsize = 1024 * 28;
206 ptr->
size = 1024 * 4;
208 ptr->
vsize = 1024 * 4;
218 ptr->
size = 1024 * 4;
220 ptr->
vsize = 1024 * 4;
230 ptr->
size = 1024 * 8;
232 ptr->
vsize = 1024 * 8;
260 int size = 1024 * 64;
299 memset(&hdr, 0,
sizeof(hdr));
301 if (
read !=
sizeof(hdr)) {
334 static const struct {
336 const char *symbol_name;
345 { 0xd000,
"VIC_SPR0_X" },
346 { 0xd001,
"VIC_SPR0_Y" },
347 { 0xd002,
"VIC_SPR1_X" },
348 { 0xd003,
"VIC_SPR1_Y" },
349 { 0xd004,
"VIC_SPR2_X" },
350 { 0xd005,
"VIC_SPR2_Y" },
351 { 0xd006,
"VIC_SPR3_X" },
352 { 0xd007,
"VIC_SPR3_Y" },
353 { 0xd008,
"VIC_SPR4_X" },
354 { 0xd009,
"VIC_SPR4_Y" },
355 { 0xd00a,
"VIC_SPR5_X" },
356 { 0xd00b,
"VIC_SPR5_Y" },
357 { 0xd00c,
"VIC_SPR6_X" },
358 { 0xd00d,
"VIC_SPR6_Y" },
359 { 0xd00e,
"VIC_SPR7_X" },
360 { 0xd00f,
"VIC_SPR7_Y" },
361 { 0xd010,
"VIC_SPR_HI_X" },
362 { 0xd015,
"VIC_SPR_ENA" },
363 { 0xd017,
"VIC_SPR_EXP_Y" },
364 { 0xd01d,
"VIC_SPR_EXP_X" },
365 { 0xd01c,
"VIC_SPR_MCOLOR" },
366 { 0xd01b,
"VIC_SPR_BG_PRzIO" },
368 { 0xd025,
"VIC_SPR_MCOLOR0" },
369 { 0xd026,
"VIC_SPR_MCOLOR1" },
371 { 0xd027,
"VIC_SPR0_COLOR" },
372 { 0xd028,
"VIC_SPR1_COLOR" },
373 { 0xd029,
"VIC_SPR2_COLOR" },
374 { 0xd02A,
"VIC_SPR3_COLOR" },
375 { 0xd02B,
"VIC_SPR4_COLOR" },
376 { 0xd02C,
"VIC_SPR5_COLOR" },
377 { 0xd02D,
"VIC_SPR6_COLOR" },
378 { 0xd02E,
"VIC_SPR7_COLOR" },
380 { 0xd011,
"VIC_CTRL1" },
381 { 0xd016,
"VIC_CTRL2" },
383 { 0xd012,
"VIC_HLINE" },
385 { 0xd013,
"VIC_LPEN_X" },
386 { 0xd014,
"VIC_LPEN_Y" },
388 { 0xd018,
"VIC_VIDEO_ADR" },
390 { 0xd019,
"VIC_IRR" },
391 { 0xd01a,
"VIC_IMR" },
393 { 0xd020,
"VIC_BORDERCOLOR" },
394 { 0xd021,
"VIC_BG_COLOR0" },
395 { 0xd022,
"VIC_BG_COLOR1" },
396 { 0xd023,
"VIC_BG_COLOR2" },
397 { 0xd024,
"VIC_BG_COLOR3" },
400 { 0xd02F,
"VIC_KBD_128" },
401 { 0xd030,
"VIC_CLK_128" },
404 { 0xD400,
"SID_S1Lo" },
405 { 0xD401,
"SID_S1Hi" },
406 { 0xD402,
"SID_PB1Lo" },
407 { 0xD403,
"SID_PB1Hi" },
408 { 0xD404,
"SID_Ctl1" },
409 { 0xD405,
"SID_AD1" },
410 { 0xD406,
"SID_SUR1" },
412 { 0xD407,
"SID_S2Lo" },
413 { 0xD408,
"SID_S2Hi" },
414 { 0xD409,
"SID_PB2Lo" },
415 { 0xD40A,
"SID_PB2Hi" },
416 { 0xD40B,
"SID_Ctl2" },
417 { 0xD40C,
"SID_AD2" },
418 { 0xD40D,
"SID_SUR2" },
420 { 0xD40E,
"SID_S3Lo" },
421 { 0xD40F,
"SID_S3Hi" },
422 { 0xD410,
"SID_PB3Lo" },
423 { 0xD411,
"SID_PB3Hi" },
424 { 0xD412,
"SID_Ctl3" },
425 { 0xD413,
"SID_AD3" },
426 { 0xD414,
"SID_SUR3" },
428 { 0xD415,
"SID_FltLo" },
429 { 0xD416,
"SID_FltHi" },
430 { 0xD417,
"SID_FltCtl" },
431 { 0xD418,
"SID_Amp" },
432 { 0xD419,
"SID_ADConv1" },
433 { 0xD41A,
"SID_ADConv2" },
434 { 0xD41B,
"SID_Noise" },
435 { 0xD41C,
"SID_Read3" },
438 { 0xd600,
"VDC_INDEX" },
439 { 0xd601,
"VDC_DATA" },
442 { 0xDC00,
"CIA1_PRA" },
443 { 0xDC01,
"CIA1_PRB" },
444 { 0xDC02,
"CIA1_DDRA" },
445 { 0xDC03,
"CIA1_DDRB" },
446 { 0xDC08,
"CIA1_TOD10" },
447 { 0xDC09,
"CIA1_TODSEC" },
448 { 0xDC0A,
"CIA1_TODMIN" },
449 { 0xDC0B,
"CIA1_TODHR" },
450 { 0xDC0D,
"CIA1_ICR" },
451 { 0xDC0E,
"CIA1_CRA" },
452 { 0xDC0F,
"CIA1_CRB" },
454 { 0xDD00,
"CIA2_PRA" },
455 { 0xDD01,
"CIA2_PRB" },
456 { 0xDD02,
"CIA2_DDRA" },
457 { 0xDD03,
"CIA2_DDRB" },
458 { 0xDD08,
"CIA2_TOD10" },
459 { 0xDD09,
"CIA2_TODSEC" },
460 { 0xDD0A,
"CIA2_TODMIN" },
461 { 0xDD0B,
"CIA2_TODHR" },
462 { 0xDD0D,
"CIA2_ICR" },
463 { 0xDD0E,
"CIA2_CRA" },
464 { 0xDD0F,
"CIA2_CRB" },
466 static const int SYMBOLS_MAX =
sizeof(_symbols) /
sizeof(_symbols[0]);
480 for (
i = 0;
i < SYMBOLS_MAX;
i++) {
488 ptr->
vaddr = _symbols[
i].address;
537 .desc =
"VICE Snapshot File",
551 #ifndef RZ_PLUGIN_INCORE
RZ_API void rz_bin_symbol_free(RzBinSymbol *sym)
RZ_API RZ_OWN RzList * rz_bin_maps_of_file_sections(RZ_NONNULL RzBinFile *binfile)
Create a list of RzBinMap from RzBinSections queried from the given file.
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *b, Sdb *sdb)
RzBinPlugin rz_bin_plugin_vsf
static RzList * mem(RzBinFile *bf)
static Sdb * get_sdb(RzBinFile *bf)
static RzList * symbols(RzBinFile *bf)
static const int MACHINES_MAX
static const char VICE_C64MEM[]
static const char VICE_MAGIC[]
static const char VICE_MAINCPU[]
static void destroy(RzBinFile *bf)
RZ_API RzLibStruct rizin_plugin
static const char VICE_C128MEM[]
static bool check_buffer(RzBuffer *b)
static const struct @207 _machines[]
static RzBinInfo * info(RzBinFile *bf)
static const char VICE_C64ROM[]
static RzList * entries(RzBinFile *bf)
static const char VICE_C128ROM[]
static RzList * sections(RzBinFile *bf)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * calloc(size_t number, size_t size)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API int sdb_ns_set(Sdb *s, const char *name, Sdb *r)
RZ_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas)
#define rz_return_val_if_fail(expr, val)
#define RZ_BIN_SIZEOF_STRINGS
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
RZ_API st64 rz_buf_fread_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL ut8 *buf, RZ_NONNULL const char *fmt, int n)
...
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
void(* RzListFree)(void *ptr)
RZ_API int rz_str_rwx(const char *str)
#define rz_offsetof(type, member)
RZ_API Sdb * sdb_new0(void)
XX curplugin == o->plugin.
struct vsf_maincpu * maincpu
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
int read(izstream &zs, T *x, Items items)