Help For Emu8086 - Philadelphia University

1y ago
11 Views
2 Downloads
635.59 KB
191 Pages
Last View : 26d ago
Last Download : 3m ago
Upload by : Oscar Steel
Transcription

Help for Emu8086 Help Index Overview Tutorials Emu8086 reference Documentation for Emu8086 Where to start? Tutorials Emu8086 reference Complete 8086 instruction setfile:///D 006 12:15:54 Õ

Overview of Emu8086Emu8086 OverviewEverything for learning assembly language in one pack! Emu8086 combines anadvanced source editor, assembler, disassembler, software emulator (Virtual PC)with debugger, and step by step tutorials.This program is extremely helpful for those who just begin to study assemblylanguage. It compiles the source code and executes it on emulator step by step.Visual interface is very easy to work with. You can watch registers, flags andmemory while your program executes.Arithmetic & Logical Unit (ALU) shows the internal work of the central processorunit (CPU).Emulator runs programs on a Virtual PC, this completely blocks your programfrom accessing real hardware, such as hard-drives and memory, since yourassembly code runs on a virtual machine, this makes debugging much easier.8086 machine code is fully compatible with all next generations of Intel's microprocessors, including Pentium II and Pentium 4, I'm sure Pentium 5 will support8086 as well. This makes 8086 code very portable, since it runs both on ancientand on the modern computer systems. Another advantage of 8086 instruction set isthat it is much smaller, and thus easier to learn.Emu8086 has a much easier syntax than any of the major assemblers, but will stillgenerate a program that can be executed on any computer that runs 8086 machinecode; a great combination for beginners!Note: If you don't use Emu8086 to compile the code, you won't be able to stepthrough your actual source code while running it.Where to start?1. Start Emu8086 by selecting its icon from the start menu, or by runningEmu8086.exe.2. Select "Samples" from "File" menu.3. Click [Compile and Emulate] button (or press F5 hot key).4. Click [Single Step] button (or press F8 hot key), and watch how the codefile:///D /Heep/Assem/SW/Emu8086v3.07/Help/start unframed.html (1 of 2)01/05/2006 12:16:04 Õ

Overview of Emu8086is being executed.5. Try opening other samples, all samples are heavily commented, so it's agreat learning tool.6. This is the right time to see the tutorials.file:///D /Heep/Assem/SW/Emu8086v3.07/Help/start unframed.html (2 of 2)01/05/2006 12:16:04 Õ

TutorialsTutorials8086 Assembler Tutorials Numbering Systems Part 1: What is an assembly language? Part 2: Memory Access Part 3: Variables Part 4: Interrupts Part 5: Library of common functions - emu8086.inc Part 6: Arithmetic and Logic Instructions Part 7: Program Flow Control Part 8: Procedures Part 9: The Stack Part 10: Macros Part 11: Making your own Operating System Part 12: Controlling External Devices (Robot, StepperMotor.)file:///D 05/2006 12:16:08 Õ

Reference for Emu8086Emu8086 reference Source Code Editor Compiling Assembly Code Using the Emulator Complete 8086 instruction set List of supported interrupts Global Memory Table Custom Memory Map MASM / TASM compatibility I/O portsfile:///D 05/2006 12:16:14 Õ

8086 instructionsComplete 8086 instruction setQuick LATBXOROperand types:REG: AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP.SREG: DS, ES, SS, and only as second operand: CS.memory: [BX], [BX SI 7], variable, etc.(see Memory Access).immediate: 5, -24, 3Fh, 10001101b, etc.Notes: When two operands are required for an instruction they are separated bycomma. For example:REG, memoryfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (1 of 73)01/05/2006 12:16:29 Õ

8086 instructions When there are two operands, both operands must have the same size(except shift and rotate instructions). For example:AL, DLDX, AXm1 DB ?AL, m1m2 DW ?AX, m2 Some instructions allow several operand combinations. For example:memory, immediateREG, immediatememory, REGREG, SREG Some examples contain macros, so it is advisable to use Shift F8 hot keyto Step Over (to make macro code execute at maximum speed set stepdelay to zero), otherwise emulator will step through each instruction of amacro. Here is an example that uses PRINTN macro:#make COM#include 'emu8086.inc'ORG 100hMOV AL, 1MOV BL, 2PRINTN 'Hello World!' ; macro.MOV CL, 3PRINTN 'Welcome!'; macro.RETThese marks are used to show the state of the flags:1 - instruction sets this flag to 1.0 - instruction sets this flag to 0.r - flag value depends on result of the instruction.? - flag value is undefined (maybe 1 or 0).file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (2 of 73)01/05/2006 12:16:29 Õ

8086 instructionsSome instructions generate exactly the same machine code, so disassembler may have a problemdecoding to your original code. This is especially important for Conditional Jump instructions (see"Program Flow Control" in Tutorials for more information).Instructions in alphabetical order:InstructionOperandsDescriptionASCII Adjust after Addition.Corrects result in AH and AL after addition when workingwith BCD values.It works according to the following Algorithm:if low nibble of AL 9 or AF 1 then: AL AL 6AH AH 1AF 1CF 1elseAAANo operands AF 0CF 0in both cases:clear the high nibble of AL.Example:MOV AX, 15 ; AH 00, AL 0FhAAA; AH 01, AL 05RETfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (3 of 73)01/05/2006 12:16:29 Õ

8086 instructionsC Z S O P Ar ? ? ? ? rASCII Adjust before Division.Prepares two BCD values for division.Algorithm: AADNo operandsAL (AH * 10) ALAH 0Example:MOV AX, 0105h ; AH 01, AL 05AAD; AH 00, AL 0Fh (15)RETC Z S O P A? r r ? r ?ASCII Adjust after Multiplication.Corrects the result of multiplication of two BCD values.Algorithm: AAMNo operandsAH AL / 10AL remainderExample:MOV AL, 15 ; AL 0FhAAM; AH 01, AL 05RETC Z S O P Afile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (4 of 73)01/05/2006 12:16:29 Õ

8086 instructions? r r ? r ?ASCII Adjust after Subtraction.Corrects result in AH and AL after subtraction whenworking with BCD values.Algorithm:if low nibble of AL 9 or AF 1 then: AL AL - 6AH AH - 1AF 1CF 1elseAASNo operands AF 0CF 0in both cases:clear the high nibble of AL.Example:MOV AX, 02FFh ; AH 02, AL 0FFhAAS; AH 01, AL 09RETC Z S O P Ar ? ? ? ? rfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (5 of 73)01/05/2006 12:16:29 Õ

8086 instructionsAdd with Carry.Algorithm:operand1 operand1 operand2 CFADCREG, memorymemory, REGREG, REGmemory, immediateREG, immediateExample:STC; set CF 1MOV AL, 5 ; AL 5ADC AL, 1 ; AL 7RETC Z S O P Ar r r r r rAdd.Algorithm:operand1 operand1 operand2ADDREG, memorymemory, REGREG, REGmemory, immediateREG, immediateExample:MOV AL, 5 ; AL 5ADD AL, -3 ; AL 2RETC Z S O P Ar r r r r rfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (6 of 73)01/05/2006 12:16:29 Õ

8086 instructionsLogical AND between all bits of two operands. Result isstored in operand1.These rules apply:ANDREG, memorymemory, REGREG, REGmemory, immediateREG, immediate1 AND 1 11 AND 0 00 AND 1 00 AND 0 0Example:MOV AL, 'a'; AL 01100001bAND AL, 11011111b ; AL 01000001b ('A')RETC Z S O P0 r r 0 rTransfers control to procedure, return address is (IP) ispushed to stack. 4-byte address may be entered in this form:1234h:5678h, first value is a segment second value is anoffset (this is a far call, so CS is also pushed to stack).Example:#make COM#ORG 100h ; for COM file.CALLprocedure namelabel4-byte addressCALL p1ADD AX, 1RET; return to OS.p1 PROC ; procedure declaration.MOV AX, 1234hRET ; return to caller.p1 ENDPfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (7 of 73)01/05/2006 12:16:29 Õ

8086 instructionsC Z S O P AunchangedConvert byte into word.Algorithm:if high bit of AL 1 then: AH 255 (0FFh) AH 0elseCBWNo operandsExample:MOV AX, 0 ; AH 0, AL 0MOV AL, -5 ; AX 000FBh (251)CBW; AX 0FFFBh (-5)RETC Z S O P AunchangedClear Carry flag.Algorithm:CLCNo operandsCF 0C0file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (8 of 73)01/05/2006 12:16:29 Õ

8086 instructionsClear Direction flag. SI and DI will be incremented bychain instructions: CMPSB, CMPSW, LODSB, LODSW,MOVSB, MOVSW, STOSB, STOSW.Algorithm:CLDNo operandsDF 0D0Clear Interrupt enable flag. This disables hardwareinterrupts.Algorithm:CLINo operandsIF 0I0Complement Carry flag. Inverts value of CF.Algorithm:CMCNo operandsif CF 1 then CF 0if CF 0 then CF 1Crfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (9 of 73)01/05/2006 12:16:29 Õ

8086 instructionsCompare.Algorithm:operand1 - operand2result is not stored anywhere, flags are set (OF, SF, ZF, AF,PF, CF) according to result.CMPREG, memorymemory, REGREG, REGmemory, immediateREG, immediateExample:MOV AL, 5MOV BL, 5CMP AL, BL ; AL 5, ZF 1 (so equal!)RETC Z S O P Ar r r r r rCompare bytes: ES:[DI] from DS:[SI].Algorithm: CMPSBNo operandsDS:[SI] - ES:[DI]set flags according to result:OF, SF, ZF, AF, PF, CFif DF 0 then SI SI 1 DI DI 1else SI SI - 1 DI DI - 1Example:see cmpsb.asm in Samples.C Z S O P Ar r r r r rfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (10 of 73)01/05/2006 12:16:29 Õ

8086 instructionsCompare words: ES:[DI] from DS:[SI].Algorithm: CMPSWNo operandsDS:[SI] - ES:[DI]set flags according to result:OF, SF, ZF, AF, PF, CFif DF 0 then SI SI 2 DI DI 2else SI SI - 2 DI DI - 2Example:see cmpsw.asm in Samples.C Z S O P Ar r r r r rConvert Word to Double word.Algorithm:if high bit of AX 1 then: DX 65535 (0FFFFh) DX 0elseCWDNo operandsExample:MOV DX, 0 ; DX 0MOV AX, 0 ; AX 0MOV AX, -5 ; DX AX 00000h:0FFFBhCWD; DX AX 0FFFFh:0FFFBhfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (11 of 73)01/05/2006 12:16:29 Õ

8086 instructionsRETC Z S O P AunchangedDecimal adjust After Addition.Corrects the result of addition of two packed BCD values.Algorithm:if low nibble of AL 9 or AF 1 then: AL AL 6AF 1if AL 9Fh or CF 1 then:DAANo operands AL AL 60hCF 1Example:MOV AL, 0Fh ; AL 0Fh (15)DAA; AL 15hRETC Z S O P Ar r r r r rfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (12 of 73)01/05/2006 12:16:29 Õ

8086 instructionsDecimal adjust After Subtraction.Corrects the result of subtraction of two packed BCDvalues.Algorithm:if low nibble of AL 9 or AF 1 then: AL AL - 6AF 1if AL 9Fh or CF 1 then:DASNo operands AL AL - 60hCF 1Example:MOV AL, 0FFh ; AL 0FFh (-1)DAS; AL 99h, CF 1RETC Z S O P Ar r r r r rDecrement.Algorithm:operand operand - 1Example:DECREGmemoryMOV AL, 255 ; AL 0FFh (255 or -1)DEC AL; AL 0FEh (254 or -2)RETZ S O P Afile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (13 of 73)01/05/2006 12:16:29 Õ

8086 instructionsr r r r rCF - unchanged!Unsigned divide.Algorithm:when operand is a byte:AL AX / operandAH remainder (modulus)DIVREGmemorywhen operand is a word:AX (DX AX) / operandDX remainder (modulus)Example:MOV AX, 203 ; AX 00CBhMOV BL, 4DIV BL; AL 50 (32h), AH 3RETC Z S O P A? ? ? ? ? ?Halt the System.Example:HLTNo operandsMOV AX, 5HLTC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (14 of 73)01/05/2006 12:16:29 Õ

8086 instructionsSigned divide.Algorithm:when operand is a byte:AL AX / operandAH remainder (modulus)IDIVREGmemorywhen operand is a word:AX (DX AX) / operandDX remainder (modulus)Example:MOV AX, -203 ; AX 0FF35hMOV BL, 4IDIV BL; AL -50 (0CEh), AH -3 (0FDh)RETC Z S O P A? ? ? ? ? ?Signed multiply.Algorithm:when operand is a byte:AX AL * operand.when operand is a word:(DX AX) AX * operand.IMULREGmemoryExample:MOV AL, -2MOV BL, -4IMUL BL; AX 8RETfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (15 of 73)01/05/2006 12:16:29 Õ

8086 instructionsC Z S O P Ar ? ? r ? ?CF OF 0 when result fits into operand of IMUL.Input from port into AL or AX.Second operand is a port number. If required to access portnumber over 255 - DX register should be used.Example:INAL, im.byteAL, DXAX, im.byteAX, DXIN AX, 4 ; get status of traffic lights.IN AL, 7 ; get status of stepper-motor.C Z S O P AunchangedIncrement.Algorithm:operand operand 1Example:INCREGmemoryMOV AL, 4INC AL; AL 5RETZ S O P Ar r r r rCF - unchanged!file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (16 of 73)01/05/2006 12:16:29 Õ

8086 instructionsInterrupt numbered by immediate byte (0.255).Algorithm: INTPush to stack: flags register CS IPIF 0Transfer control to interrupt procedureimmediate byteExample:MOV AH, 0Eh ; teletype.MOV AL, 'A'INT 10h; BIOS interrupt.RETC Z S O P A Iunchanged0Interrupt 4 if Overflow flag is 1.Algorithm:if OF 1 then INT 4Example:INTONo operands; -5 - 127 -132 (not in -128.127); the result of SUB is wrong (124),; so OF 1 is set:MOV AL, -5SUB AL, 127 ; AL 7Ch (124)INTO; process error.RETfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (17 of 73)01/05/2006 12:16:29 Õ

8086 instructionsInterrupt Return.Algorithm:IRETNo operandsPop from stack: IP CS flags registerC Z S O P ApoppedShort Jump if first operand is Above second operand (as setby CMP instruction). Unsigned.Algorithm:if (CF 0) and (ZF 0) then jumpExample:JAlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 250CMP AL, 5JA label1PRINT 'AL is not above 5'JMP exitlabel1:PRINT 'AL is above 5'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (18 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if first operand is Above or Equal to secondoperand (as set by CMP instruction). Unsigned.Algorithm:if CF 0 then jumpExample:JAElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 5CMP AL, 5JAE label1PRINT 'AL is not above or equal to 5'JMP exitlabel1:PRINT 'AL is above or equal to 5'exit:RETC Z S O P AunchangedShort Jump if first operand is Below second operand (as setby CMP instruction). Unsigned.Algorithm:if CF 1 then jumpExample:JBlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 1CMP AL, 5file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (19 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJB label1PRINT 'AL is not below 5'JMP exitlabel1:PRINT 'AL is below 5'exit:RETC Z S O P AunchangedShort Jump if first operand is Below or Equal to secondoperand (as set by CMP instruction). Unsigned.Algorithm:if CF 1 or ZF 1 then jumpExample:JBElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 5CMP AL, 5JBE label1PRINT 'AL is not below or equal to 5'JMP exitlabel1:PRINT 'AL is below or equal to 5'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (20 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if Carry flag is set to 1.Algorithm:if CF 1 then jumpExample:JClabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 255ADD AL, 1JC label1PRINT 'no carry.'JMP exitlabel1:PRINT 'has carry.'exit:RETC Z S O P AunchangedShort Jump if CX register is 0.Algorithm:if CX 0 then jumpExample:JCXZlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV CX, 0JCXZ label1PRINT 'CX is not zero.'JMP exitfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (21 of 73)01/05/2006 12:16:29 Õ

8086 instructionslabel1:PRINT 'CX is zero.'exit:RETC Z S O P AunchangedShort Jump if first operand is Equal to second operand (asset by CMP instruction). Signed/Unsigned.Algorithm:if ZF 1 then jumpExample:JElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 5CMP AL, 5JE label1PRINT 'AL is not equal to 5.'JMP exitlabel1:PRINT 'AL is equal to 5.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (22 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if first operand is Greater then second operand(as set by CMP instruction). Signed.Algorithm:if (ZF 0) and (SF OF) then jumpExample:JGlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 5CMP AL, -5JG label1PRINT 'AL is not greater -5.'JMP exitlabel1:PRINT 'AL is greater -5.'exit:RETC Z S O P AunchangedShort Jump if first operand is Greater or Equal to secondoperand (as set by CMP instruction). Signed.Algorithm:if SF OF then jumpExample:JGElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, -5file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (23 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJGE label1PRINT 'AL -5'JMP exitlabel1:PRINT 'AL -5'exit:RETC Z S O P AunchangedShort Jump if first operand is Less then second operand (asset by CMP instruction). Signed.Algorithm:if SF OF then jumpExample:JLlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, -2CMP AL, 5JL label1PRINT 'AL 5.'JMP exitlabel1:PRINT 'AL 5.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (24 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if first operand is Less or Equal to secondoperand (as set by CMP instruction). Signed.Algorithm:if SF OF or ZF 1 then jumpExample:JLElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, -2CMP AL, 5JLE label1PRINT 'AL 5.'JMP exitlabel1:PRINT 'AL 5.'exit:RETC Z S O P AunchangedUnconditional Jump. Transfers control to another part of theprogram. 4-byte address may be entered in this form:1234h:5678h, first value is a segment second value is anoffset.Algorithm:always jumpExample:JMPlabel4-byte addressinclude 'emu8086.inc'#make COM#ORG 100hfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (25 of 73)01/05/2006 12:16:29 Õ

8086 instructionsMOV AL, 5JMP label1 ; jump over 2 lines!PRINT 'Not Jumped!'MOV AL, 0label1:PRINT 'Got Here!'RETC Z S O P AunchangedShort Jump if first operand is Not Above second operand(as set by CMP instruction). Unsigned.Algorithm:if CF 1 or ZF 1 then jumpExample:JNAlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, 5JNA label1PRINT 'AL is above 5.'JMP exitlabel1:PRINT 'AL is not above 5.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (26 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if first operand is Not Above and Not Equal tosecond operand (as set by CMP instruction). Unsigned.Algorithm:if CF 1 then jumpExample:JNAElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, 5JNAE label1PRINT 'AL 5.'JMP exitlabel1:PRINT 'AL 5.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Below second operand (asset by CMP instruction). Unsigned.Algorithm:if CF 0 then jumpExample:JNBlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 7CMP AL, 5file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (27 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJNB label1PRINT 'AL 5.'JMP exitlabel1:PRINT 'AL 5.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Below and Not Equal tosecond operand (as set by CMP instruction). Unsigned.Algorithm:if (CF 0) and (ZF 0) then jumpExample:JNBElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 7CMP AL, 5JNBE label1PRINT 'AL 5.'JMP exitlabel1:PRINT 'AL 5.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (28 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if Carry flag is set to 0.Algorithm:if CF 0 then jumpExample:JNClabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2ADD AL, 3JNC label1PRINT 'has carry.'JMP exitlabel1:PRINT 'no carry.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Equal to second operand(as set by CMP instruction). Signed/Unsigned.Algorithm:if ZF 0 then jumpExample:JNElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, 3JNE label1file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (29 of 73)01/05/2006 12:16:29 Õ

8086 instructionsPRINT 'AL 3.'JMP exitlabel1:PRINT 'Al 3.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Greater then secondoperand (as set by CMP instruction). Signed.Algorithm:if (ZF 1) and (SF OF) then jumpExample:JNGlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, 3JNG label1PRINT 'AL 3.'JMP exitlabel1:PRINT 'Al 3.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (30 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if first operand is Not Greater and Not Equal tosecond operand (as set by CMP instruction). Signed.Algorithm:if SF OF then jumpExample:JNGElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, 3JNGE label1PRINT 'AL 3.'JMP exitlabel1:PRINT 'Al 3.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Less then second operand(as set by CMP instruction). Signed.Algorithm:if SF OF then jumpExample:JNLlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, -3file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (31 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJNL label1PRINT 'AL -3.'JMP exitlabel1:PRINT 'Al -3.'exit:RETC Z S O P AunchangedShort Jump if first operand is Not Less and Not Equal tosecond operand (as set by CMP instruction). Signed.Algorithm:if (SF OF) and (ZF 0) then jumpExample:JNLElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 2CMP AL, -3JNLE label1PRINT 'AL -3.'JMP exitlabel1:PRINT 'Al -3.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (32 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if Not Overflow.Algorithm:if OF 0 then jumpExample:; -5 - 2 -7 (inside -128.127); the result of SUB is correct,; so OF 0:JNOlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, -5SUB AL, 2 ; AL 0F9h (-7)JNO label1PRINT 'overflow!'JMP exitlabel1:PRINT 'no overflow.'exit:RETC Z S O P AunchangedShort Jump if No Parity (odd). Only 8 low bits of result arechecked. Set by CMP, SUB, ADD, TEST, AND, OR, XORinstructions.Algorithm:if PF 0 then jumpExample:include 'emu8086.inc'file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (33 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJNPlabel#make COM#ORG 100hMOV AL, 00000111b ; AL 7OR AL, 0; just set flags.JNP label1PRINT 'parity even.'JMP exitlabel1:PRINT 'parity odd.'exit:RETC Z S O P AunchangedShort Jump if Not Signed (if positive). Set by CMP, SUB,ADD, TEST, AND, OR, XOR instructions.Algorithm:if SF 0 then jumpExample:JNSlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 00000111b ; AL 7OR AL, 0; just set flags.JNS label1PRINT 'signed.'JMP exitlabel1:PRINT 'not signed.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (34 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if Not Zero (not equal). Set by CMP, SUB,ADD, TEST, AND, OR, XOR instructions.Algorithm:if ZF 0 then jumpExample:JNZlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 00000111b ; AL 7OR AL, 0; just set flags.JNZ label1PRINT 'zero.'JMP exitlabel1:PRINT 'not zero.'exit:RETC Z S O P AunchangedShort Jump if Overflow.Algorithm:if OF 1 then jumpExample:; -5 - 127 -132 (not in -128.127); the result of SUB is wrong (124),; so OF 1 is set:include 'emu8086.inc'file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (35 of 73)01/05/2006 12:16:29 Õ

8086 instructionsJOlabel#make COM#org 100hMOV AL, -5SUB AL, 127 ; AL 7Ch (124)JO label1PRINT 'no overflow.'JMP exitlabel1:PRINT 'overflow!'exit:RETC Z S O P AunchangedShort Jump if Parity (even). Only 8 low bits of result arechecked. Set by CMP, SUB, ADD, TEST, AND, OR, XORinstructions.Algorithm:if PF 1 then jumpExample:JPlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 00000101b ; AL 5OR AL, 0; just set flags.JP label1PRINT 'parity odd.'JMP exitlabel1:PRINT 'parity even.'exit:RETC Z S O P Afile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (36 of 73)01/05/2006 12:16:29 Õ

8086 instructionsunchangedShort Jump if Parity Even. Only 8 low bits of result arechecked. Set by CMP, SUB, ADD, TEST, AND, OR, XORinstructions.Algorithm:if PF 1 then jumpExample:JPElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 00000101b ; AL 5OR AL, 0; just set flags.JPE label1PRINT 'parity odd.'JMP exitlabel1:PRINT 'parity even.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (37 of 73)01/05/2006 12:16:29 Õ

8086 instructionsShort Jump if Parity Odd. Only 8 low bits of result arechecked. Set by CMP, SUB, ADD, TEST, AND, OR, XORinstructions.Algorithm:if PF 0 then jumpExample:JPOlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 00000111b ; AL 7OR AL, 0; just set flags.JPO label1PRINT 'parity even.'JMP exitlabel1:PRINT 'parity odd.'exit:RETC Z S O P AunchangedShort Jump if Signed (if negative). Set by CMP, SUB,ADD, TEST, AND, OR, XOR instructions.Algorithm:if SF 1 then jumpExample:JSlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 10000000b ; AL -128file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (38 of 73)01/05/2006 12:16:29 Õ

8086 instructionsOR AL, 0; just set flags.JS label1PRINT 'not signed.'JMP exitlabel1:PRINT 'signed.'exit:RETC Z S O P AunchangedShort Jump if Zero (equal). Set by CMP, SUB, ADD,TEST, AND, OR, XOR instructions.Algorithm:if ZF 1 then jumpExample:JZlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV AL, 5CMP AL, 5JZ label1PRINT 'AL is not equal to 5.'JMP exitlabel1:PRINT 'AL is equal to 5.'exit:RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (39 of 73)01/05/2006 12:16:29 Õ

8086 instructionsLoad AH from 8 low bits of Flags register.Algorithm:AH flags registerLAHFNo operandsAH bit: 7 6 5 4 3 2 1 0[SF] [ZF] [0] [AF] [0] [PF] [1] [CF]bits 1, 3, 5 are reserved.C Z S O P AunchangedLoad memory double word into word register and DS.Algorithm: REG first wordDS second wordExample:#make COM#ORG 100hLDSREG, memoryLDS AX, mRETm DW 1234hDW 5678hENDAX is set to 1234h, DS is set to 5678h.file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (40 of 73)01/05/2006 12:16:29 Õ

8086 instructionsC Z S O P AunchangedLoad Effective Address.Algorithm: REG address of memory (offset)Generally this instruction is replaced by MOV whenassembling when possible.Example:#make COM#ORG 100hLEAREG, memoryLEA AX, mRETm DW 1234hENDAX is set to: 0104h.LEA instruction takes 3 bytes, RET takes 1 byte, we start at100h, so the address of 'm' is 104h.C Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (41 of 73)01/05/2006 12:16:29 Õ

8086 instructionsLoad memory double word into word register and ES.Algorithm: REG first wordES second wordExample:#make COM#ORG 100hLESREG, memoryLES AX, mRETm DW 1234hDW 5678hENDAX is set to 1234h, ES is set to 5678h.C Z S O P AunchangedLoad byte at DS:[SI] into AL. Update SI.Algorithm: AL DS:[SI]if DF 0 then SI SI 1else SI SI - 1Example:file:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (42 of 73)01/05/2006 12:16:29 Õ

8086 instructions#make COM#ORG 100hLODSBNo operandsLEA SI, a1MOV CX, 5MOV AH, 0Ehm: LODSBINT 10hLOOP mRETa1 DB 'H', 'e', 'l', 'l', 'o'C Z S O P AunchangedLoad word at DS:[SI] into AX. Update SI.Algorithm: AX DS:[SI]if DF 0 then SI SI 2else SI SI - 2Example:LODSWNo operands#make COM#ORG 100hLEA SI, a1MOV CX, 5REP LODSW ; finally there will be 555h in AX.RETfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (43 of 73)01/05/2006 12:16:29 Õ

8086 instructionsa1 dw 111h, 222h, 333h, 444h, 555hC Z S O P AunchangedDecrease CX, jump to label if CX not zero.Algorithm: CX CX - 1if CX 0 then jumpelse no jump, continueExample:LOOPlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV CX, 5label1:PRINTN 'loop!'LOOP label1RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (44 of 73)01/05/2006 12:16:29 Õ

8086 instructionsDecrease CX, jump to label if CX not zero and Equal (ZF 1).Algorithm: CX CX - 1if (CX 0) and (ZF 1) then jumpelse no jump, continueExample:LOOPElabel; Loop until result fits into AL alone,; or 5 times. The result will be over 255; on third loop (100 100 100),; so loop will exit.include 'emu8086.inc'#make COM#ORG 100hMOV AX, 0MOV CX, 5label1:PUTC '*'ADD AX, 100CMP AH, 0LOOPE label1RETC Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (45 of 73)01/05/2006 12:16:29 Õ

8086 instructionsDecrease CX, jump to label if CX not zero and Not Equal(ZF 0).Algorithm: CX CX - 1if (CX 0) and (ZF 0) then jumpelse no jump, continueExample:; Loop until '7' is found,; or 5 times.LOOPNElabelinclude 'emu8086.inc'#make COM#ORG 100hMOV SI, 0MOV CX, 5label1:PUTC '*'MOV AL, v1[SI]INC SI; next byte (SI SI 1).CMP AL, 7LOOPNE label1RETv1 db 9, 8, 7, 6, 5C Z S O P Aunchangedfile:///D /Heep/Assem/SW/Emu8086v3.07/Help/8086 instruction set.html (46 of 73)01/05/2006 12:16:29 Õ

8086 instructionsDecrease CX, jump to label if CX not zero and ZF 0.Algorithm: CX CX - 1if (CX 0) and (ZF 0) then jumpelse no jump, continueExample:; Loop until '7' is found,; or 5 times.LOOPNZlabelinclude 'emu8086.inc'#make COM#ORG 100hMOV SI, 0MOV CX, 5label1:PUTC '*'MOV AL, v1[SI]INC SI; next byte (SI SI 1).CMP AL, 7LOOPNZ

Tutorials Tutorials 8086 Assembler Tutorials Numbering Systems Part 1: What is an assembly language? Part 2: Memory Access Part 3: Variables Part 4: Interrupts Part 5: Library of common functions - emu8086.inc Part 6: Arithmetic and Logic Instructions Part 7: Program Flow Control Part 8: Procedures Part 9: The Stack Part 10: Macros

Related Documents:

Bruksanvisning för bilstereo . Bruksanvisning for bilstereo . Instrukcja obsługi samochodowego odtwarzacza stereo . Operating Instructions for Car Stereo . 610-104 . SV . Bruksanvisning i original

10 tips och tricks för att lyckas med ert sap-projekt 20 SAPSANYTT 2/2015 De flesta projektledare känner säkert till Cobb’s paradox. Martin Cobb verkade som CIO för sekretariatet för Treasury Board of Canada 1995 då han ställde frågan

service i Norge och Finland drivs inom ramen för ett enskilt företag (NRK. 1 och Yleisradio), fin ns det i Sverige tre: Ett för tv (Sveriges Television , SVT ), ett för radio (Sveriges Radio , SR ) och ett för utbildnings program (Sveriges Utbildningsradio, UR, vilket till följd av sin begränsade storlek inte återfinns bland de 25 största

Hotell För hotell anges de tre klasserna A/B, C och D. Det betyder att den "normala" standarden C är acceptabel men att motiven för en högre standard är starka. Ljudklass C motsvarar de tidigare normkraven för hotell, ljudklass A/B motsvarar kraven för moderna hotell med hög standard och ljudklass D kan användas vid

LÄS NOGGRANT FÖLJANDE VILLKOR FÖR APPLE DEVELOPER PROGRAM LICENCE . Apple Developer Program License Agreement Syfte Du vill använda Apple-mjukvara (enligt definitionen nedan) för att utveckla en eller flera Applikationer (enligt definitionen nedan) för Apple-märkta produkter. . Applikationer som utvecklas för iOS-produkter, Apple .

PHILADELPHIA FIRE CODE 2018 iii PREFACE Introduction The Philadelphia Fire Code is incorporated as Subcode “F” of the Philadelphia Building Construction and Occupancy Code (BCOC), which comprises most of Title 4 of the Philadelphia Code. The Philadelphia Fire Code is a member of a family of subcodes that together address all matters relating to the construction and occupancy of buildings .

We have audited the accompanying statements of condition of the Federal Reserve Bank of Philadelphia (“FRB Philadelphia”) as of December 31, 2020 and 2019, and the related statements of operations and changes in capital for the years then ended. We also have audited the FRB Philadelphia’s internal control over financialFile Size: 1MBPage Count: 47Explore furtherFederal Reserve Bank of Philadelphia - 2022 All You Need .www.tripadvisor.comContact Us - Philadelphia Fedwww.philadelphiafed.orgFederal Reserve Bank of Philadelphiawww.philadelphiafed.orgPhiladelphia Fed Manufacturing Index - economic indicator .www.mql5.comUnited States Philadelphia Fed Manufacturing Index - March .tradingeconomics.comRecommended to you b

phases attained more algae for future oil extraction (Day 32 was in growing phase). After ultrasonication, the lipids were extracted by the Folchs method. The lipid content was 8.6% by weight. 0 0.05 0.1 0.15 0.2 0.25 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 Algae Mass (grams) Time (days) Haematococcus Growth in Bolds Basal .