Systems Design & Programming 80x86 Assembly III CMPE 3101 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Systems Design & Programming 80x86 Assembly III CMPE 3102 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Stack InstructionsSystems Design & Programming 80x86 Assembly III CMPE 3103 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Stack InstructionsStack Segpush eax0 7 F EAHALesp = esp-4is performedbefore thePUSH000007FA isnew value0 0 1 0+SegBasePagingTrans.FFFF6AB36 A B 3F F F F0 0 0 0Systems Design & Programming 80x86 Assembly III CMPE 3104 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Address Loading Instructionslds edi, LIST ;Loads edi and ds.lea eax,[ebx+ecx*4+100] ;Loads eax with computed address.lfs esi, DATA1 ;Loads esi and fs.Systems Design & Programming 80x86 Assembly III CMPE 3105 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Address Loading Instructionsmov ebx, edi;Move the contents of edi into ebx.lea ebx, [edi];Load the contents of edi into ebx.mov ebx, [edi];Load the value at edi into ebx.Systems Design & Programming 80x86 Assembly III CMPE 3106 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6String OperationsSystems Design & Programming 80x86 Assembly III CMPE 3107 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6String Operationslodsb;al=ds:[esi]; esi=esi+/-1lodsd;eax=ds:[esi]; esi=esi+/-4es lodsb DATA1;Override ds.stosb;es:[edi]=al; edi=edi+/-1stosd;es:[edi]=eax; edi=edi+/-4Systems Design & Programming 80x86 Assembly III CMPE 3108 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6String OperationslodswData Seg1 0 0 0A032A 0 3 2+/-20 0 1 0+SegBasePagingTrans.0 0 0 0Systems Design & Programming 80x86 Assembly III CMPE 3109 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6String Operationsmov edi, 0;Offset 0.mov ecx, 25*80;Load count.mov eax, 0720H;Load value to write.rep stoswmovsb;es:[edi]=ds:[esi]; edi+/-=1; esi+/-=1movsd;es:[edi]=ds:[esi]; edi+/-=4; esi+/-=4Systems Design & Programming 80x86 Assembly III CMPE 31010 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6String Operationsinsw W1, W2;es:[edi]=[edx]; edi+/-=2; esi+/-=2insb;es:[edi]=[edx]; edi+/-=1insd;es:[edi]=[edx]; edi+/-=4outsb;[edx]=ds:[esi]; esi=esi+/-1xchg edx, esi;Exchange edx and esiSystems Design & Programming 80x86 Assembly III CMPE 31011 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6in al, p8;8-bits are saved to al from I/O port p8.out dx, eax;32-bits are written to port dx from eax.in al, 61Hor al, 3;Read port 61H (speaker).;Set rightmost two bits.out 61H, alloop L1;Time delay.in al, 61H;Read port 61H.and al, 0FCH;Clear rightmost two bits.out 61H, al;Speaker off.;Turn on the speaker.mov cx, 1000H;Delay count.L1:Systems Design & Programming 80x86 Assembly III CMPE 31012 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6movsx cx, bl;Sign-extends bl into cxmovzx eax, DATA2;Zero extends word at DATA2 in eax.bswap eax2 2 3 30 0 1 11 1 0 03 3 2 2cmovz eax, ebx;Move if Zero flag is set else do nothing.Systems Design & Programming 80x86 Assembly III CMPE 31013 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6es outsbes cmpsbsection .data;Define a data segment.section .text;Define a code segment.call procedure_name;Call the procedurepush args...;Push the arguments on stack.add esp, #;Restore the stack
View Full Document