WIMP Help Top > WIMP Assembly Language Set API

WIMP Assembly Language Set API
In this section:
-Operation Codes
-Register Specifiers
-Immediate Operands
-Addressing Modes
-Condition Codes
-Examples
Operation Codes
Below is the complete listing of the WIMP assembly language operation codes.
"Condition Codes" specifies the operation's effect on the 4 condition codes.
[Register]: You must use the register specifiers.
[Data]: You must specify an operand either by immediate operand or any of the 3 addressing modes.
[Address]: You must use one of the 3 addressing modes.
Op.ExplanationSyntaxCondition Codes
LOALoad data in memory to registerLOA [Register] [Data]Z,N: Depends
STOStore data in register to memorySTO [Register] [Address]Z,N: Depends
ADDAdd data to registerADD [Register] [Data]All: Depends
ADCAdd data+carry bit to registerADC [Register] [Data]All: Depends
SUBSubtract data from registerSUB [Register] [Data]All: Depends
SBCSubtract (data+carry bit) from registerSBC [Register] [Data]All: Depends
ANDAND data with registerAND [Register] [Data]Z,N: Depends C,V:0
ORROR data with registerORR [Register] [Data]Z,N: Depends C,V:0
NEQXOR data with registerXOR [Register] [Data]Z,N: Depends C,V:0
CMPCompare register with data (return 0 if equal)CMP [Register] [Data]All: Depends
MOVMove data from register 1 to register 2MOV [Register1] [Register2]Z,N: Depends
CLRClear registerCLR [Register]Z:1 N,C,V:0
INCIncrement registerINC [Register]All: Depends
DECDecrement registerDEC [Register]All: Depends
RORRotate register right 1 bit via carryROR [Register]All: Depends
ROLRotate register left 1 bit via carryROL [Register]All: Depends
ASRArithmetic shift right 1 bitASR [Register]All: Depends
ASLArithmetic shift left 1 bitASL [Register]All: Depends
COMComplement registerCOM [Register]All: Depends
NEGNOT registerNEG [Register]Z,N: Depends C,V:0
PSHPush register onto stackPSH [Register]Z,N,C: Depends
POPPop top of stack to registerPOP [Register]Z,N: Depends
JSRJump to subprogram, stack return address
You will lose the value of the accumulator in doing this
JSR [Address]-
RTSReturn from subprogram (unstack return add.)RTS-
BRNUnconditional branch to addressBRN [Address]-
BZEBranch if non-zero (Z=0)BZE [Address]-
BNEBranch if zero (Z=1)BNE [Address]-
BGEBranch if >= 0 (Z=1 or N=0)BGE [Address]-
BGTBranch if >0 (Z=0 and N=0)BGT [Address]-
BLEBranch if <=0 (Z=1 or N=1)BLE [Address]-
BLTBranch if <0 (N=1 and Z=0)BLT [Address]-
BCCBranch if carry clear (C=0)BCC [Address]-
BCSBranch if carry set (C=1)BCS [Address]-
BVCBranch if overflow clear (V=0)BVC [Address]-
BVSBranch if overflow set (V=1)BVS [Address]-
OUTOutput registerOUT [Register]-
STCSet carry bitSTCC:1
CLCClear carry bitCLCC:0
EXTTerminateEXT-
Register Specifiers
Registers can be specified inside the code using register specifiers:
A Accumulator
X Index Register
S Stack Pointer
R1~R4 General Purpose Registers (1~4)
Immediate Operands
Immediate operands can be expressed in-code using automatic data converters:
An integer can be expressed as a signed decimal number.
A character can be written inside the symbols //.
See the examples for more detail.
Addressing Modes
There are 3 types of addressing modes. All addresses take the syntax "[Addressing Mode Specifer] [Address]".
N: Absolute Addressing- This means that the address after the "N" is where the operand required is stored.
I: Indirect Addressing- This means that the location of the address after the "I" contains an address which points to the required operand.
D: Indexed Addressing- This means that the required operand is stored in an address which is the sum of the specified address and the value of the Index Register.
See the examples for more detail.
Condition Codes
There are 4 condition codes:
V: Set to 1 if current operation results in overflow
Z: Set to 1 if current operation results in 0
C: Set to 1 if current operation has a carry out
N: Set to 1 if current operation result in negative value
Examples
LOA A N 150
Load the value in location 150 into Accumulator.

ADD A I 160
Add the value in the memory pointed to by the address in location 160 to the value in the Accumulator.

INC X
Increment the value of the Index Register

MOV R1 A
Move the value in the register R1 to the Accumulator.

BRN N 160
Branch to location 160.
WIMP Help Top > WIMP Assembly Language Set API