Use the comment in the code to write instructions to the ROM PROGRAMMING INSTRUCTIONS: Click ¨See Inside¨ you will find a comment with all the commands You can directly edit the list by clicking the plus sign or clicking on an already existing spot on the list. Programs can NOT be longer than 16 instructions! DOCUMENTATION: ROM COMMANDS [4-bit]: bin:0000 hex:0x00 IN Reads an input and stores it in A. bin:0001 hex:0x01 OUT Displays A in Output variable. bin:0010 hex:0x02 MOV xx Sets A to a number. bin:0011 hex:0x03 SWP Swaps values of the registers. bin:0100 hex:0x04 ADD Adds B to A, result is saved in A. bin:0101 hex:0x05 SUB Subtracts B from A, result is saved in A. bin:0110 hex:0x06 AND AND on A and B, result is saved in A. bin:0111 hex:0x07 OR OR on A and B, result is saved in A. bin:1000 hex:0x08 XOR XOR on A and B, result is saved in A. bin:1001 hex:0x09 NOT NOT on A, result is saved in A. bin:1010 hex:0x0A JMP xx Jumps to adress. bin:1011 hex:0x0B JZ xx Jumps to adress if zero flag is set. bin:1100 hex:0x0B CLR Displays color from A bin:1101 hex:0x0C EQL If A and B are the same value, set the ZF to 1 bin:1110 hex:0x0D SNG Plays a song from the sound chip's ROM bin:1111 hex:0x0E END Kills the program UI GUIDE: Binary Out: Shows the current CPU output in 4-bit binary Decimal Out: Shows the current CPU output in decimal SC OUT: Shows the current Sound Chip command in 4-bit binary ROM: Shows the current CPU ROM SC ROM: Shows the current Sound Chip ROM Center Square: Shows the current color output A: 4-bit register used as primary value storage. Can be directly manipulated by the program. B: 4-bit register used as primary value storage. Can be directly manipulated by the program. C: 4-bit register used for binary to dec conversions. D: Temporary storage used for logical operations and swapping the registers E: Temp storage used for logic ZF: Zero Flag. Switches to 1 if a logical operation results in 0000 CONV: Internal register used by the CPU for dec to bin operations. PC: Program counter, used to index through the ROM SC PC: Current Sound Chip instruction in SC ROM SCCONV: Converted number for the Sound Chip ENDF: End Prgm Flag. Switches to 1 if the END instruction [1111] is read in ROM. Automatically kills the program. SCROM Overflow: Switches to 1 if SC ROM is over 16 entries, then halts the reading of sound data. ROM Overflow: Switches to 1 if CPU ROM is over 16 entries. Kills the program. SC A: Storage for converting binary and decimal in the sound chip
based on https://simulator.io/board/AWZpw7Fy3I modified it to have some more instructions Currently has a 4-bit CPU with 4-bit ROM and a basic 4-bit sound chip with its own 4-bit ROM for storing short songs. Memory is read only. For sotrage while a program is running you have 2 4-bit registers A and B. Clock speed is set to 1Hz [1 Operation per second] so you can watch what it is doing. To make it go faster look for the wait block in the CPU main loop and change the wait duration.