void Kss_Emu::Core::cpu_write_( addr_t addr, int data ) { // TODO: SCC+ support data &= 0xFF; switch ( addr ) { case 0x9000: set_bank( 0, data ); return; case 0xB000: set_bank( 1, data ); return; case 0xBFFE: // selects between mapping areas (we just always enable both) if ( data == 0 || data == 0x20 ) return; } int scc_addr = (addr & 0xDFFF) - 0x9800; if ( (unsigned) scc_addr < 0xB0 && msx.scc ) { scc_accessed = true; //if ( (unsigned) (scc_addr - 0x90) < 0x10 ) // scc_addr -= 0x10; // 0x90-0x9F mirrors to 0x80-0x8F if ( scc_addr < Scc_Apu::reg_count ) msx.scc->write( cpu.time(), addr, data ); return; } dprintf( "LD ($%04X),$%02X\n", addr, data ); }
static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) { unsigned long (*set_bank)(unsigned long) = (unsigned long(*)(unsigned long))map->map_priv_2; return (set_bank ? set_bank(ofs) : ofs); }
void detect_images(efmenu_entry_t* kernal_menu) { char found; efmenu_entry_t* entry; image_fingerprint_t* fp; entry = kernal_menu; while (entry->key) { set_bank(entry->bank); fp = kernal_signatures; found = 0; while (fp->offset != 0xffff) { if (memcmp(ROML + fp->offset, fp->signature, IMAGE_SIGNATURE_LEN) == 0) { entry->name = fp->name; found = 1; break; } ++fp; } if (!found && ((ROML[0x1ffc] != 0xff) || (ROML[0x1ffd] != 0xff))) { entry->name = "Unknown KERNAL"; } ++entry; } }
void Kss_Emu::Core::cpu_out( time_t time, addr_t addr, int data ) { data &= 0xFF; switch ( addr & 0xFF ) { case 0xA0: if ( msx.psg ) msx.psg->write_addr( data ); return; case 0xA1: if ( msx.psg ) msx.psg->write_data( time, data ); return; case 0x06: if ( sms.psg && (header().device_flags & 0x04) ) { sms.psg->write_ggstereo( time, data ); return; } break; case 0x7E: case 0x7F: if ( sms.psg ) { sms.psg->write_data( time, data ); return; } break; #define OPL_WRITE_HANDLER( base, opl )\ case base : if ( opl ) { opl->write_addr( data ); return; } break;\ case base+1: if ( opl ) { opl->write_data( time, data ); return; } break; OPL_WRITE_HANDLER( 0x7C, msx.music ) OPL_WRITE_HANDLER( 0xC0, msx.audio ) OPL_WRITE_HANDLER( 0xF0, sms.fm ) case 0xFE: set_bank( 0, data ); return; #ifndef NDEBUG case 0xA8: // PPI return; #endif } Kss_Core::cpu_out( time, addr, data ); }
void MEMORY::reset() { // clear memory memset(vram, 0, sizeof(vram)); for(int i = 0x1000; i < 0x1200; i += 32) { static uint8 tmp[32] = { 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff }; memcpy(vram + i, tmp, 32); } memset(wreg, 0, sizeof(wreg)); // initialize memory bank set_bank(0); }
void dump_data(uint16_t iobase, int bank) { uint16_t i; printf("Bank %d:\n", bank); printf(" "); for (i = 0; i < 16; i++) printf("%02x ", i); set_bank(iobase, bank); for (i = 0; i < 256; i++) { if (i % 16 == 0) printf("\n%02x: ", i / 16); printf("%02x ", datareg(iobase, i)); } printf("\n"); }
void MEMORY::initialize() { memset(bios, 0xff, sizeof(bios)); memset(cart, 0xff, sizeof(cart)); memset(sram, 0xff, sizeof(sram)); memset(rdmy, 0xff, sizeof(rdmy)); // load bios FILEIO* fio = new FILEIO(); if(fio->Fopen(emu->bios_path(_T("BIOS.ROM")), FILEIO_READ_BINARY)) { fio->Fread(bios, 0x1000, 1); fio->Fclose(); } delete fio; set_bank(0); // cart is not opened memset(&header, 0, sizeof(header_t)); }
void Gbs_Core::write_mem( addr_t addr, int data ) { (void) LOG_MEM( addr, "<", data ); int offset = addr - ram_addr; if ( (unsigned) offset < 0x10000 - ram_addr ) { ram [offset] = data; offset -= 0xE000 - ram_addr; if ( (unsigned) offset < 0x1F80 ) write_io_inline( offset, data, 0xE000 ); } else if ( (unsigned) (offset - (0x2000 - ram_addr)) < 0x2000 ) { set_bank( data & 0xFF ); } #ifndef NDEBUG else if ( unsigned (addr - 0x8000) < 0x2000 || unsigned (addr - 0xE000) < 0x1F00 ) { dprintf( "Unmapped write $%04X\n", (unsigned) addr ); } #endif }
void display() { n++; // animation angle ++ if(n == 360) n=0; // avoid infinity changeView(); GLfloat ebene[4][3]={ // Grundflaeche {-30.0f, 0.0f,-15.0f}, { 30.0f,0.0f,-15.0f}, { -30.0f, 0.0f,15.0f},{ 30.0f,0.0f, 15.0f}}; GLfloat light_position1[]={ -20.0f, 20.0f, -20.0f, 0.0}; glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); float angle; glLightfv(GL_LIGHT0, GL_POSITION, light_position1); glDisable(GL_LIGHTING); // Skybox, Kugel ueber die aktuelle Szene, hellblau glPushMatrix(); // bewegt sich mit der kamera glTranslatef(swipe_left_right, swipe_up_down, swipe_through_back); glColor4ub(15,170,255,100); glutSolidSphere(25,30,30); glPopMatrix(); glPushMatrix(); // Bodenflaeche glTranslatef(0.0f, -3.0f, 0.0f); // nach unten verschoben glColor4ub(143, 163, 112, 255); glBegin(GL_QUAD_STRIP); glVertex3fv(ebene[0]); glVertex3fv(ebene[1]); glVertex3fv(ebene[2]); glVertex3fv(ebene[3]); glEnd(); // Licht glEnable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Teapot glPushMatrix(); set_mat3(); glTranslated(-2.5, 0.5, 3); glRotated(n,0,1,0); glutSolidTeapot(0.5); glPopMatrix(); // Bank ausgeben // Bank2 ausgeben, Drehwinkel: ITMZ: 190 -> 910 % 360 = 190 ... glPushMatrix(); glRotated(190, 0.0f, 1.0f, 0.0f); set_bank(); glPopMatrix(); glPushMatrix(); glTranslated(3.0, 0.0, 0.0); // (laengs, hoch, tief) = (x, y, z) glRotated(190, 0.0f, 1.0f, 0.0f); // (winkel, x, y, z) set_bank(); glPopMatrix(); // Bank2 ausgeben glPushMatrix(); glTranslated(-3.0, 0.0, 0.0); // (laengs, hoch, tief) glRotated(190, 0.0f, 1.0f, 0.0f); set_bank(); glPopMatrix(); // Lampe glPushMatrix(); glTranslated(-5,0,2); glRotated(45, 0,1,0); set_lamp(); glPopMatrix(); // *********** bewegliche Teile ****************** glDisable(GL_LIGHTING); glPushMatrix(); glRotated(90, 1.0, 0.0, 0.0); angle = glutGet(GLUT_ELAPSED_TIME)/1000.0f *15; glRotated(angle, 0.0, 0.0, 1.0); /* Hier Drohe zusammensetzen und Parameter auswerten*/ glTranslatef(0, -4, - drone_y_positon); set_drone(); glPopMatrix(); // Time glPopMatrix(); // Gesamtszene glutSwapBuffers(); glutPostRedisplay(); }