Download presentation
Presentation is loading. Please wait.
1
Irvine, Kip R. Assembly Language For Intel-Based Computers XADD Instruction.code mov ax,1000h mov bx,2000h ; AX = 1000h, BX = 2000h xadd ax,bx ; AX = 3000h, BX = 1000h XADD op-left, op-right Adds operands and stores sum in op-left. Saves the starting value of op-left and stores it in op-right.
2
Irvine, Kip R. Assembly Language For Intel-Based Computers Using a Link Library IRVINE.LIB is supplied with the book's sample programs –Complete list of procedures is in Appendix E EXTRN directive –notifies the assembler that a procedure, constant, or variable is located outside the current program module –EXTRN name:type
3
Irvine, Kip R. Assembly Language For Intel-Based Computers Data Types for the EXTRN Directive
4
Irvine, Kip R. Assembly Language For Intel-Based Computers Selected Procedures in the Link Library
5
Irvine, Kip R. Assembly Language For Intel-Based Computers Selected Procedures in the Link Library
6
Irvine, Kip R. Assembly Language For Intel-Based Computers Title Link Library Demo Program (lnkdemo.asm) ; This program calls various I/O procedures ; in the link library..model small.stack 100h WhiteOnBlue = 1Fh GreetingLoc = 0400h.data greeting db "Link Library Demo Program" db 0dh,0ah,0dh,0ah db "What is your name? ",0 numberPrompt db 0dh,0ah db "Please enter a 16–bit integer: ",0 userName db 50 dup(0) pressAnyKey db 0dh,0ah,0dh,0ah db "Press any key...",0.code extrn Clrscr:proc, Crlf:proc, Gotoxy:proc, \ Readint:proc, Readstring:proc, Scroll:proc, \ Readkey:proc, Writeint:proc, Writestring:proc Link Library Demo Program
7
Irvine, Kip R. Assembly Language For Intel-Based Computers main proc mov ax,@data mov ds,ax ; Clear the screen, scroll a blue window. call Clrscr mov cx,0400h ; upper–left corner mov dx,0B28h ; lower–right corner mov bh,WhiteOnBlue call Scroll ; Display a greeting and ask for the ; user’s name. mov dx,GreetingLoc call Gotoxy mov dx,offset greeting call Writestring mov dx,offset userName call Readstring Link Library Demo, continued
8
Irvine, Kip R. Assembly Language For Intel-Based Computers ; Ask the user to enter a signed decimal integer. ; Redisplay the number in hexadecimal and binary. mov dx,offset numberPrompt call Writestring call Readint; input an integer call Crlf mov bx,16; display in hexadecimal call Writeint call Crlf mov bx,2; display in binary call Writeint mov dx,offset pressAnyKey call Writestring call Readkey call Clrscr mov ax,4c00h; end program int 21h main endp end main Link Library Demo, continued
9
Irvine, Kip R. Assembly Language For Intel-Based Computers.code extrn Randomize:proc, Random_range:proc extrn WriteInt:proc, Crlf:proc call Randomize mov cx,20 L1: mov eax,1000 call Random_range ; EAX = random integer mov bx,10 ; decimal radix call WriteInt call Crlf Loop L1 Generating Random Integers Generate 20 random integers between 0 and 999.
10
Irvine, Kip R. Assembly Language For Intel-Based Computers extrn Seconds_today:proc Delay_seconds proc pusha mov ecx,eax ; delay, in seconds call Seconds_today mov ebx,eax ; save start time DLY1: call Seconds_today ; get the time sub eax,ebx ; subtract from start cmp eax,ecx ; delay finished yet? jb DLY1 ; if not, continue loop popa ret Delay_seconds endp Delay_seconds Procedure Pause for a specified number of seconds.
11
Irvine, Kip R. Assembly Language For Intel-Based Computers.code title text
12
Irvine, Kip R. Assembly Language For Intel-Based Computers.code title text
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.