Ejemplo n.º 1
0
int sms_z80_init(void) {
    cpuz80 = (CrabZ80_t *)malloc(sizeof(CrabZ80_t));

    if(cpuz80 == NULL) {
#ifdef DEBUG
        fprintf(stderr, "Out of memory while initializing Z80\n");
#endif
        return -1;
    }

    CrabZ80_init(cpuz80, CRABZ80_CPU_Z80);
    CrabZ80_reset(cpuz80);

    CrabZ80_set_portwrite(cpuz80, sms_port_write);
    CrabZ80_set_portread(cpuz80, sms_port_read);

    return 0;
}
Ejemplo n.º 2
0
int sms_z80_init(void) {
    cpuz80 = (CrabZ80_t *)malloc(sizeof(CrabZ80_t));

    if(cpuz80 == NULL) {
        fprintf(stderr, "Out of memory while initializing Z80 in debug mode\n");
        return -1;
    }

    /* Initialize CrabZ80 */
    CrabZ80_init(cpuz80);
    CrabZ80_reset(cpuz80);

    CrabZ80_set_memwrite(cpuz80, sms_debug_memwrite);
    CrabZ80_set_memread(cpuz80, sms_debug_memread);
    CrabZ80_set_portwrite(cpuz80, sms_debug_portwrite);
    CrabZ80_set_portread(cpuz80, sms_debug_portread);

    z80_init();
    z80_reset();

    return 0;
}
Ejemplo n.º 3
0
void sms_z80_set_pwrite(void (*pwrite)(uint16, uint8)) {
    CrabZ80_set_portwrite(cpuz80, pwrite);
}