A tiny asm-like language for playing around with integers
See examples for syntax examples
Every command takes one or two arguments.
- To access a register, use
A-H - To reference a location in RAM, use
&NwhereNis the address. Default address space is 0 - 1023 - To access a location in RAM who's address is stored in a register use
&A. ReplaceAwith any register name. - Line comments start with
; - Labels must be alpha characters and end with
:. They must be on their own line. - To reference a label, just use the label name (
jpandjnz)
Key:
reg: registeradr: addressloc: location namelit: integer literal
Commands:
- ld
adr1 adr2copy the int stored inadr2intoadr1 - ld
reg1 reg2copy the value stored inreg2intoreg1 - ld
adr litload the value oflitintoadr - ld
reg litload the value oflitintoreg - ld
reg adrcopy the int atadrintoreg - ld
® adrcopy the int stored atadrinto the address stored inreg - ld
®1 reg2copy the int stored atreg2into the address stored inreg1 - ld
reg1 ®2copy the value stored in RAM at the address stored in the location in registerreg2toreg1 - prt
regprint the value stored inregto the console - prtch
regconvert the value stored inregto an ASCII character and print the character to the console - jp
locjump to a label in the code - jnz
reg locif the value inregis not zero, jump to loc - add
reg1 reg2add the value stored inreg2to the value inreg1 - sub
reg1 reg2subtract the value stored inreg2from the value inreg1 - mul
reg1 reg2multiply the value stored inreg2with the value inreg1 - div
reg1 reg2divide the value stored inreg2from the value inreg1 - rem
reg1 reg2divide the value stored inreg2to the value inreg1and store the remainder inreg1 - and
reg1 reg2bitwise and the value stored inreg2with the value inreg1 - or
reg1 reg2bitwise or the value stored inreg2with the value inreg1 - inc
regincrement the value inreg - dec
regdecrement the value inreg - str
adrstring_litstore the string at the given address
The str command takes an address and a string literal as arguments. String literals begin with a " and end with a newline Strings are stored in memory as
addr addr+1 addr+2 ... addr+N
... | N | char1 | char2 | ... | charN | ...
For example,
ld A 100
str &A "ABC
would result in
addr: 100 101 102 103 ...
... | 3 | 65 | 66 | 67 | ...