Previously, I have shared the computer with an assembler, but I didn’t include the instruction for how to do programming. Hence, the post is specific to talk about how to program the VOXCOM 1610.
Tools:
– SunVox
– The VOXCOM 1610 Project
– VOXCOM1610_Assembler.jar
– Windows PC (Due to some key mapping, linux is not support yet. Perhaps in future version.)
– Java (If you can run Minecraft java edition, you should already have it.)
– notepad (better if you have notepad++, Sublime Text, vs code, etc)
To create a new program, all you needed is to create a .txt file.
Before writing your first program, Let’s show you a list of Supported Operation:
(Due to a design flaw, commas are optional. It is fine to write “MOV AB, R1, R2”)
— ALU Operation, processing data from A and B resiger and stored into S register:
NAND A B -> Bitwise nand for two input registers.
LS A -> Left shift from A register
LSW A -> Left shift with wrapping from A register
RS A -> Right shift from A register
RSW A -> Right shift with wrapping from A register
ADD A B -> Add A and B registers
ADD A 1023 -> Add A with constant (0-1023)
ADDC A B -> Add A and B registers with carry
ADDC A 1023 -> Add A with carry and constant (0-1023)
TCOM A -> Two’s complement of A. (Invert the sign of A)
BSWP A -> Byte swap of A, swapping high and low byte
— Data movement, move data from place to place
MOV AB R0 R1 -> Copy two data from two general purpose registers into A and B registers
MOV R7 S -> Copy the solution from ALU into general purpose register
MOV R7 L255 -> Clear high byte of a register and assign a new low byte
MOV R7 H255 -> Retain data in lowbyte and assign a high byte to a register
MOV @255 R7 -> Immediate paging mode, copying register data into an relative address of a specific page
MOV R7 @255 -> Immediate paging mode, copying data from relative address of a specific page into a register
MOV @R0 R7 -> Register indirect mode, copying data from a register into RAM with address based on the value of another register
MOV R0 @R7 -> Register indirect mode, copying data in RAM with address based on the value of a register into another register
STPG 255 -> Set the page of the RAM
ROMA R7 -> Copy current program counter address into a register, used for function call.
PORT 255 R7 -> Copy a register data into one of the I/O ports. (port 0 – 255, but you mostly use up to 11)
PORT R7 255 -> Take the current value in the I/O port and store into a register
— Jumps
JMP 1023 -> Direct jump (-1023 – +1023)
JMP LABEL -> Direct jump to the location of a label (must not more or less than 1023 lines)
JMPR R7 -> Direct jump based on the address stored in a register
JCR 127 -> Jump if carry from the last addition (-127 – +127)
JOV 127 -> Jump if overflow from the last addition (-127 – +127)
JEVN 127 -> Jump if even from the last addition (-127 – +127)
JLZ 127 -> Jump if less than 0 in register S (-127 – +127)
JEZ 127 -> Jump if equal to 0 in register S (-127 – +127)
JGZ 127 -> Jump if greater than 0 in register S (-127 – +127)
JLEZ 127 -> Jump if no more than 0 in register S (-127 – +127)
JGEZ 127 -> Jump if no less than 0 in register S (-127 – +127)
JNZ 127 -> Jump if NOT equal to 0 in register S (-127 – +127)
— Others
NOP -> Skip to next instruction
END -> Halt a program, the program counter will stop counting upwards.
NOTEY -> Same as NOP (If you don’t get the joke, think it as “NOT End Yet”)
RAMPAGE 255 -> Same as STPG (There is a rampage to set the page of the RAM)
To start to write a program, it is recommended start with a comment, followed by a start label.
In this Assembler, you can use “#” for comment like so:
# Hello world, this is a comment
# You need multiple of them,
# To do multiple line comment.
START:
After the start label, you would normally need to do a restart sequence, to clear the data from the previous calculation, like so:
# Reset Display
MOV R0 L255 # Set low byte to 255, the clean signal (for a specific character, choose between 0 and 50)
MOV R0 H255 # Set high byte to 255, for a print command
PORT 1 R0 # Send the Constructed data to the Display
MOV R0 L31 # Set a pointer pointing the ram address at 31 (or the largest RAM address you would use)
MOV R1 L1 # Set a constant 1 for condition loop
MOV AB R1 R1 # Put data of R1 into ALU
TCOM R1 # Negate the number
MOV S R1 # set R1 to -1 to act like i–
RESET_LOOP: # The destination of a jump
MOV R2 L0 # Generate 0 for cleaning
MOV @R0 R2 # Reset the current RAM cell
MOV AB R0 R1 # j–, process next digit
ADD A B
MOV S R0
JGEZ RESET_LOOP # Jump to RESET_LOOP, as long as R0 is positive
After that, feel free to write whatever you want, don’t forget to use “END” to halt the program.
Once you have a program, you can use the assembler now, to use the program, you need to open a CMD (Command Prompt) first.
Once you have opened a CMD, type the following command, to access the location of the java program:
Command:
cd <path of the assembler>
Example: If the file is stored inside the folder C:\Users\user\Desktop\VOXCOM 1610 Compiler
cd C:\Users\user\Desktop\VOXCOM 1610 Compiler
CMD will point to the specified folder. To run the assembler, type the following command:
Command:
java -jar VOXCOM1610_Assembler.jar
By using this command, you will access the title of VOXCOM 1610 Assembler.
All you need is to provide the complete file path of your txt file.
If your file is located in C:\Users\user\Desktop while the name of your program is “TEST001”.
The file path of your assembly is like shown:
C:\Users\user\Desktop\TEST001
If the program is free of error, the assembler will show “Success:”; otherwise, it will show a list of code line with errors.
After a success compile, the program will request a name for the file of the compiled machine code.
If you leave it with an enter, the assembler will skip the file generation; otherwise, a file will be generated according to your specified name and will be stored at where the assembler located.
You can let the assembler to write code into SunVox for you! The program asks a question that either you want to write the code into SunVox or not. If you entered Y, it will ask you need an instruction or not. Assumes that you have chosen N, before enter the opeion, you need to do the following to make sure the program work properly:
1. Minimized all windows.
2. Only open back the CMD and SunVox with the ROM exposed. (Edit one of the ROM)
3. Cursor pointing to the first column on the top line of the pattern.
Once you have ready, press enter. The program will write the machine code into SunVox. Make sure the keyboard and the mouse is not disturbed that this moment, or you will mess up the whole writing process.
If the current ROM is full, the assembler will show “[PLEASE SWITCH ROM]” message. After playing the project inside the ROM, All you need is to open a new ROM, on top of the current ROM, for another group of machine code.
If all the code has been witten into ROM, the program will show “[DONE]”. At this point, you can safely close the program, and you need to play the project of the ROM to write the machine code from pattern into the MultiSynths.
If everything you have done right, you can quit the ROM and back to the computer. Switch on the RESET module and the Clock for resetting the ROM address. After that, you can switch off the RESET module and have fun to your new program!