int program[] = {
PSH, 15,
PSH, 3,
DIV,
HLT,
//the stack pointer must pointing to value 5
};Note the program is array so dont forget to put , after every instructions
| Operation | Description |
|---|---|
| PSH | pushes the value to the top of the stack |
| POP | pops the value , now the stack pointer points to the previous value |
| ADD | Adds the the top two values and pushes them |
| SUB | substracts the the second value from the previous |
| MUL | multiples top two values on the stack |
| Div | divides the top value by the first second top value |
| AND | does the binary AND operation and on the top two value |
| OR | does the binary OR operation and on the top two value |
| HLT | Marks the end of the program |