16 bit Assembly
ADC - Add with Carry
ADD - Add
AND - Bitwise AND
CALL - Call Routine
CLC - Clear Carry Flag
CLD - Clear Direction
CLI - Clear Interupt Flag
CMPS - Compare
CMP - Compare
DEC - Decrement
DIV - Divide
HLT - Halt
IDIV - Divide Signed
IMUL - Multiply Signed
INC - Increment
INS - Input
INT - Interupt
IN - Input
IRET - Interupt Return
JMP - Jump
J - Jump Conditional
LAHF - Load Flags
LDS - Load Far Pointer
LEA - Store Address
LES - Load Far Pointer
LFS - Load Far Pointer
LGS - Load Far Pointer
LODSB - LODSW - Load
LODS - Load
LOOP - Loop
LSS - Load Far Pointer
MOVSB - Move Far
MOVSW - Move Far
MOVS - Move
MOV - Move
MUL - Multiply
NEG - Negate
NOP - No Operation
NOT - Bitwise NOT
OR - Bitwise OR
OUTS - Output
OUT - Output
POP - Stack Retrieval
PUSH - Stack Store
RCL - Roll Left
RCR - Roll Right
REP - Repeat
RET - Return
ROL - Roll Left
ROR - Roll Right
SAHF - Save Flags
SAL - Shift Left
SAR - Shift Right
SBB - Subtract with Borrow
SCAS - Compare
SET - Set Condition
SHL - Shift Left
SHR - Shift Right
STC - Set Carry Flag
STD - Set Direction
STI - Set Interupt Flag
STOSB - STOSW - Store
STOS - Store
SUB - Subtract
TEST - Compare
XADD - Exchange and And
XCHG - Swap
XOR - Bitwise XOR
The REP instruction is used to repeat repetative tasks.
It is important to set up the Source, Destination abd Counter before calling this instruction.
There are warnings that the speed may exceed the capabilities of any external devices it is writing too.
The following sample codes shows how to use REP and an alternative method using LOOP.
You should use the BYTE and WORD alternatives to these CMPS, INS, LODS, MOVS, STOS and SCAS.
This command has 2 parts, Instruction, and the task to be repeated.
Sample using
REP MOVSB16 bit Machine
CodeMOV SI, DataString2 ; Assign the Source BE 26 01 MOV DI, DataStringReturn ; Assign the Destination BF E9 01 MOV CX, 0x0030 ; Set the counter B9 30 00 REP MOVSB ; Start REP instruction F7 A4 MOV SI, DataStringReturn ; Assign the Source B9 30 00 CALL SubPrintString ; Display the result
Sample using LOOP 16 bit Machine
CodeMOV SI, DataString2 ; Assign the Source BE 26 01 MOV DI, DataStringReturn ; Assign the Destination BF E9 01 MOV CX, 0x0030 ; Set the counter B9 30 00 MOVSB ; Move one byte from SI to DI A4 LOOP 0XFD ; LOOP repeats task
; decrementing CX until CX = 0E2 FD MOV SI, DataStringReturn ; Assign the Source BE E9 01 CALL SubPrintString ; Display the result
REP Calls Description 16 bit Machine
CodeREP INSB ; 8 bit version inputs BYTES from Port
; DX into DIF3 6C REP INSW ; 16 bit version inputs WORDS from Port
; DX into DIF3 6D REP LODSB ; 8 bit version loads BYTES from SI to AL F3 AC REP LODSW ; 16 bit version loads WORDS from SI to AX F3 AD REP MOVSB ; 8 bit version moves BYTES from SI to DI F3 A4 REP MOVSW ; 16 bit version moves WORDS from SI to DI F3 A5 REP OUTSB ; 8 bit version outputs BYTES from SI to
; Port DXF3 6E REP OUTSW ; 16 bit version outputs WORDS from SI to
; Port DXF3 6F REP STOSB ; 8 bit version stores BYTES at DI F3 AA REP STOSW ; 16 bit version stores WORDS at DI F3 AB REPE CMPSB ; 8 bit version compares and find non-matching
; BYTES in SI and DIF3 A6 REPE CMPSW ; 16 bit version compares and find non-matching
; WORDS in SI and DIF3 A7 REPE SCASB ; 8 bit version finds a character NOT matching
; the value of ALF3 AE REPE SCASW ; 16 bit version finds a character NOT matching
; value of AXF3 AF REPNE CMPSB ; 8 bit version compares and finds non-matching
; BYTES in SI and DIF3 A6 REPNE CMPSW ; 16 bit version compares and finds non-matching
; WORDS in SI and DIF3 A7 REPNE SCASB ; 8 bit version finds a character that matches
; the value of ALF3 AE REPNE SCASW ; 16 bit version finds a character that matches
; the value of AXF3 AF