News

New Instruction: UNJMP

This instruction jumps just after the location of the last call to JMP. The program uses a hidden register to remember this location. This register starts at 0.


New Instruction: ACSET Z


This instruction enables direct setting of the accumulator.


New Instruction: REGSET M, Z

This instruction enables direct setting of the memory address register.

ERROR!!!

Slow-mo:
Slow-mo delay (ms):

program counter (PC):
instruction register (I):
accumulator (AC):
memory address register (M):
data register (Z):

sound channels:

registers:

rom space ( to ):

choose rom file or enter code to start...


What Is NesNoise?

NesNoise is a 16-bit bytecode-based (meaning it is not an accurate emulator of anything) music machine, designed to sound somewhat like the Nintendo Entertainment System.

You enter instructions in binary, and the instructions play a part in making different sounds.


It is internally based on HTML5/JS. Nothing you enter is stored anywhere, as the whole project runs entirely in the browser.

The computer-like interface has no RAM, but it has 16 registers, and a memory adress register intended to read values from ROM.

It has 4 sound channels - Square A (SQA), Square B (SQB), Triangle (TRI), and White Noise (FUZ), which has a variable sample rate.

All values in the uploaded ROMs are little-endian, but are converted to a normal JavaScript integer, and the textbox input is big-endian, to conform with JavaScript integers.

What are these instructions you speak of?

These instructions are 8-bit, meaning the upper byte is completely ignored.

Here is the official table of instructions, ommitting the upper byte:

0x1x2x3x4x5x6x7x8x9xAxBxCxDxExFx
x0NOPACSET REG0REGSET 0, ZREGSET 0, ACACSET MEMJMPEQ AC, Z, MEMADD AC, ZADD AC, MEMSQAFREQ AC
x1ACSET REG1REGSET 1, ZREGSET 1, ACJMPNEQ AC, Z, MEMSUB AC, ZSUB AC, MEMSQAVOL AC
x2ACSET REG2REGSET 2, ZREGSET 2, ACJMPLT AC, Z, MEM
x3ACSET REG3REGSET 3, ZREGSET 3, ACJMPLTE AC, Z, MEM
x4ACSET REG4REGSET 4, ZREGSET 4, ACJMPGT AC, Z, MEMRSHIFT AC, ZRSHIFT AC, MEMSQBFREQ AC
x5ACSET REG5REGSET 5, ZREGSET 5, ACJMPGTE AC, Z, MEMLSHIFT AC, ZLSHIFT AC, MEMSQBVOL AC
x6ACSET REG6REGSET 6, ZREGSET 6, AC
x7ACSET REG7REGSET 7, ZREGSET 7, AC
x8UNJMPACSET REG8REGSET 8, ZREGSET 8, ACREGSET M, ACAND AC, ZAND AC, MEMTRIFREQ AC
x9ACSET REG9REGSET 9, ZREGSET 9, ACOR AC, ZOR AC, MEMTRIVOL AC
xAACSET REGAREGSET A, ZREGSET A, ACXOR AC, ZXOR AC, MEM
xBACSET REGBREGSET B, ZREGSET B, AC
xCACSET REGCREGSET C, ZREGSET C, ACNOT ACFUZFREQ AC
xDACSET REGDREGSET D, ZREGSET D, ACFUZVOL AC
xEACSET REGEREGSET E, ZREGSET E, AC
xFJMP MEMACSET REGFREGSET F, ZREGSET F, AC
What is that weird text box?

The text box is designed for input that doesn't require a hex editor. It enables comments, and parses values as JavaScript integers.

This does NOT mean you can enter other JavaScript syntaxes; you can only enter numbers (decimal, '0x' hex values, '0b' binary values, '0o' octal values...).


To add a comment, use a semicolon. This is used like a JavaScript or C++ comment (i.e. '//').

The comma is used to separate values, and extra whitespace and comments are ignored. A comment ends at the end of a line.

For example, you can write "0x0000, ; Update the sound outputs".

Things that may need explaining...
To see things work, the browser needs to breathe.

The NOP instruction does not simply do nothing, as you may think. It updates all of the sound outputs if they have changed, and only then does it wait for 1 frame.

It should run at 60fps, but your mileage may vary.

RAM? Where we're going, we don't need RAM.

There are 16 registers general-purpose registers. Each register can be set to AC (the accumulator) or Z (the data register). You can also set AC to one of the registers.

They have hexadecimal names, 0-9 and A-F, for convenience.

When any instruction requests a Z value, that value comes from the word after the current instruction. When this Z value is required, the program counter jumps 2 steps to accommodate the double-word instruction.

These registers are the only way to store data, as the machine probably does not need much storage for its sole purpose, and registers are often reused anyway.

Other registers

There are other registers in the system. These are the accumulator (AC), the program counter (PC), the memory adress register (M), and the data register (Z), and the instruction register (I).


The accumulator is the first value for any calculations. It is also the register that is compared to data for conditional jumps.

The program counter by default increases by 1 when an instruction is executed. However, if the instruction has a data value, it jumps by 2, and if the instruction itself is a jump, the program counter jumps there and does not jump ahead so it can execute the instruction at the new adress.

The memory adress register does not have anything to do with RAM. Instead, its sole purpose is interacting with ROM. It enables jumping, as well as performing calculations on values in the ROM.

The data register is the Z register because there is already a general-purpose D register. This is only used when an instruction requires it, and in this case, it is overwritten, and is completely ignored otherwise.

The instruction register is the register that holds the current instruction. It is not accessible by the instructions themselves.


More help on its way (maybe)...

Nintendo Entertainment System Copyright © Nintendo
I am not affiliated with Nintendo.

Musicinator