Open andrewrothman opened 9 years ago
Mathematical operators are a must. Setting and getting to/from registers and memory is also important.
I'd like to have a couple of instructions for use in making actual programs... maybe:
PUT
GET
DISPLAY 00
is encountered to the console
BEEP - plays a beep sound or displays the text "beep" in the console
Maybe some graphics display out of memory-mapped io? This would be interesting. Also we could have the keyboard and mouse under mmio.
Yes to memory mapped io. Map a graphics display, a cursor, and a keyboard.
Also have space for additional Mina official memory mapped io, and after the blank space for compatibility, allow additional memory mapped io features that each individual implementation may provide and that may be unofficial (some vms might want a higher resolution, or a joystick, or something else.
Start memory at an offset after the blank space. Set a standard memory size available on all official implementations, and allow the user to configure the space provided.
Also deal with register addressing. If we're thinking of a 32 bit machine, then we need an equivalent of EAX, AX, AH, and AL for each register.
If 16 bit, only AX, AH, and AL are needed.
Maybe use an addressing scheme such as 1 (EAX), 1:1 (AX), 1:1:1 (AL), 1:1:2 (AH).
Clearly separate which registers can be used by applications, which can be used by kernels, and which can be used by compilers or runtimes.
Yes to memory mapped graphics. Also have memory mapped audio (very simple chiptune-like) and persistent storage (some small data file that gets saved on disk and reloaded when a program is run again).
Also remove the BEEP command. It can become confusing with mm-audio.
mm-random number generator.
Maybe have sprites? Whatever is needed to display good graphics and games and stuff.
Also maybe use a.higher.lower
and a.higher
for register addressing.
Two's complement will be used to represent signed numbers.
If possible try to use a single opcode per instruction for both signed and unsigned numbers. Again, this might not be possible.
CMP
instruction to compare two constant, register, or memory values. Sets the flags
register with appropriate result.
JMP
and conditional JMP
instructions that point to memory location of next instruction. Sets current_instruction
register with new instruction address. Conditionals read in flags
register.
INC
and DEC
instructions.
AND
, OR
, XOR
, NOT
.
Don't include NOR
. It's not necessary.
Look into hardware/software interrupts.
Maybe send interrupts instead of using memory-mapped io for certain functionality? I'm not sure about this.
Target 16 bit. Also allow addressing of 8 bits.
I want 20 general purpose registers, along with flags
, current_instruction
, and other special registers.
Right and left shift support.
NOP
instruction
No interrupts for now. All I/O can be accomplished by memory-mapped addresses, and there is no real asynchronous I/O that is critical enough that this concept needs to be added.
Machine code should allow program name, version, author name, and website url. See GB 2.5.4 ^^.
See GB command index.
Bisqwit's NES emulator in C++ tutorial video series:
https://www.youtube.com/watch?v=y71lli8MS8s https://www.youtube.com/watch?v=XZWw745wPXY
Base design off of simple ARM architecture.
Leave out most sugar instructions. Try to keep the opcodes down to a minimum.
32-bit is the goal. 16-bit if possible. 8-bit if absolutely necessary.