Closed SergioLuis closed 6 years ago
This depends on Implement general application structure.
Package structure proposal:
es.chipeit.lib.interfaces
: interfaces for internal use only. The purpose of the interfaces is to reduce class coupling, making it easier to implement tests.es.chipeit.lib.io
: interfaces and classes for other applications to implement input / output. For example, a class to issue key strokes to the emulator, or the interfaces or abstract classes to implement / extend by the application to receive graphics and sound commands.es.chipeit.lib.emulator
: classes to interact with the emulation process. Load ROMs, load snapshots, start and stop the emulation, and connecting the I/O.es.chipeit.lib.core
: the private part of the library. The software implementation of the hardware being emulated.Initial class and methods proposal by package:
interfaces:
- ICpu
- IMemory
- IClock
- IRegisters
- ITimer
io:
+ ISoundPlayer
+ startPlaying() : void
+ stopPlaying() : void
+ IGraphicsRenderer
+ render(graphicMemory : byte[]) : void
+ KeyEnum : flags { 0, 1, 2, 3, 4, (...) E, F }
+ Keyboard
+ keyPressed(key : KeyEnum) : void
+ keyReleased(key : KeyEnum) : void
emulator:
+ Chipeit
+ keys : Keys (get)
+ Chipeit(soundPlayer : ISoundPlayer, gr : IGraphicsRenderer) : ctor
+ loadRom(rom : byte[]) : void
+ startEmulation() : void
+ stopEmulation() : void
+ getSnapshot() : SnapshotData
+ loadSnapshot(data : SnapshotData)
+ SnapshotData
+ <<static>> loadFrom(buffer : byte[]) : SnapshotData
+ writeTo(buffer : byte[]) : int
+ EmulationParameters
+ backgroundColor : int (get / set)
+ foregroundColor : int (get / set)
+ clockSpeed : short (get / set)
+ enableLog : boolean (get / set)
core:
- Cpu : ICpu
- Memory : IMemory
- Clock : IClock
- Registers : IRegisters
- SoundTimer : ITimer
- DelayTimer : ITimer
- <<static>> InstructionSet
PR #20 implements this.
Developers: @sergioluis @mikelcaz Reviewers: @ugedo @jhvargas3112
Implement a high-level backend (emulator) structure so the work on it can be divided. Bear in mind the following guidelines:
Take this suggestion:
IMemory
andIRegisters
interfaces!ÌClock
interface!ICpu
interface, but the CPU class will likely have a constructor that depends onIRegisters
,IMemory
andIClock
.