def __init__(self, app): self.app = app self.display = display() self.keyboard = keyboard() self.mem = memmap() self.io = io(self.display, self.keyboard) self.cpu = z80.cpu(self.mem, self.io) self.mon = monitor.monitor(self.cpu) self.menu_root = ( ('..', 'return to main menu', util.cr, self.parent_menu, None), ('da', 'disassemble memory', monitor._help_disassemble, self.mon.cli_disassemble, None), ('exit', 'exit the application', util.cr, self.exit, None), ('help', 'display general help', util.cr, app.general_help, None), ('memory', 'memory functions', None, None, self.mon.menu_memory), ('regs', 'display cpu registers', util.cr, self.mon.cli_registers, None), ('run', 'run the emulation', util.cr, self.cli_run, None), ('step', 'single step the emulation', util.cr, self.cli_step, None), ) # setup the video window pygame.init() self.screen = pygame.display.set_mode((_screen_x, _screen_y)) pygame.display.set_caption('Talking Electronics Computer TEC 1') self.display.refresh(self.screen) app.cli.set_poll(pygame.event.pump) app.cli.set_root(self.menu_root) self.app.cli.set_prompt('\ntec1> ')
def test_regs(self): mem = memory.ram(4) cpu = z80.cpu(mem, None) cpu.set_af(0x0123) cpu.set_bc(0x4567) cpu.set_de(0x89ab) cpu.set_hl(0xcdef) self.assertEqual(cpu.a, 0x01) self.assertEqual(cpu.f.get(), 0x23) self.assertEqual(cpu.b, 0x45) self.assertEqual(cpu.c, 0x67) self.assertEqual(cpu.d, 0x89) self.assertEqual(cpu.e, 0xab) self.assertEqual(cpu.h, 0xcd) self.assertEqual(cpu.l, 0xef)
def __init__(self, app): self.app = app self.video = video() self.keyboard = keyboard() self.mem = memmap() self.io = io() self.cpu = z80.cpu(self.mem, self.io) self.mon = monitor.monitor(self.cpu) self.menu_root = ( ('..', 'return to main menu', util.cr, self.parent_menu, None), ('char', 'display the character memory', util.cr, self.cli_char, None), ('da', 'disassemble memory', monitor._help_disassemble, self.mon.cli_disassemble, None), ('exit', 'exit the application', util.cr, self.exit, None), ('help', 'display general help', util.cr, app.general_help, None), ('memory', 'memory functions', None, None, self.mon.menu_memory), ('regs', 'display cpu registers', util.cr, self.mon.cli_registers, None), ('run', 'run the emulation', util.cr, self.cli_run, None), ('step', 'single step the emulation', util.cr, self.cli_step, None), ) # create the hooks between video and memory self.mem.char.wr_notify = self.video.char_wr self.mem.video.wr_notify = self.video.video_wr self.video.mem = self.mem self.video.cmem = self.mem.char.rd # create the hooks between io and keyboard self.io.keyboard = self.keyboard.rd # setup the video window pygame.init() self.screen = pygame.display.set_mode((_screen_x, _screen_y)) pygame.display.set_caption('Jupiter ACE') self.video.refresh(self.screen) app.cli.set_poll(pygame.event.pump) app.cli.set_root(self.menu_root) self.app.cli.set_prompt('\njace> ')