Microprocessor Manual
Microprocessor Manual
UJIRE-574 240
-?
-g 0100 0106
-t single step
-a [starting address]
-a 0220
-u 0220
-e 0200 56 45 56
-d 0200 0202
-d 0203 0210
-f fill command
-d 0110 0120
-p proceed
1. startrun(type)cmd(click)OK
4.(Type) edit
5.(Type the program and save it.)FileSaveadd1.asm (You can choose any file name
to save it)
6.Fileexit
7.(Type) masm add1.asm; press enter(put semicolon or press enter key until you get
prompt)
Check that program is error free.If there is severe error or warning error ,it must be
corrected using (Type) editadd1.asm(please don’t give semicolon here)
data segment
a db 13h
b db 24h
c db 2 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,a
add al,b
mov c,al
mov bl,00h
adc bl,00h
mov c+1,bl
int 3h
code ends
end start
data segment
a db 10 dup(99h)
c db 2 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cl,9
lea si,a
mov bl,00h
mov al,[si]
up:add al,[si+1]
daa
adc bl,00h
inc si
loop up
mov c,al
mov c+1,bl
int 3h
code ends
end start
data segment
dst db 5 dup(?)
src db 13h,14h,15h,26h,0ffh
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cl,5
lea si,src
lea di,dst
up:mov al,[si]
mov [di],al
inc si
inc di
loop up
int 3h
code ends
end start
data segment
src db 11h,12h,13h,14h,15h
len equ $-src
dst db len dup(0)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cx,len
lea si,src
lea di,dst+len-1
up:mov al,[si]
mov [di],al
inc si
dec di
loop up
int 3h
code ends
end start
data segment
n1 dw 000Fh
n2 dw 0005h
lcm dw 2 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov dx,0000h
mov ax,n1
mov bx,n2
back:push ax
push dx
div bx
cmp dx,0000h
je exit
pop dx
pop ax
add ax,n1
jnc next
inc dx
next:jmp back
exit:pop lcm+2
pop lcm
int 3h
code ends
end start
data segment
n1 dw 21
n2 dw 5
gcd dw ?
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ax,n1
mov bx,n2
back:mov dx,0000h
div bx
cmp dx,0000h
je exit
mov ax,bx
mov bx,dx
jmp back
exit:mov gcd,bx
int 3h
code ends
end start
data segment
src db 0a0h,14h,90h,26h,0fh
len equ $-src
large db ?
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov cx,len-1
lea si,src
mov al,[si]
up:cmp al,[si+1]
jnc skip
mov al,[si+1]
skip:inc si
loop up
mov large,al
int 3h
code ends
end start
data segment
a dd 0ffffffffh
b dd 0ffffffffh
c dd 2 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ax,word ptr[a]
mul word ptr[b]
mov word ptr[c],ax
mov word ptr[c+2],dx
data segment
a dw 0ffffh
c dw 3 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ax,a
mul a
mov bx,ax
mov cx,dx
mul a
mov c,ax
mov c+2,dx
mov ax,cx
mul a
add c+2,ax
adc c+4,dx
int 3h
code ends
end start
data segment
pa equ 0de00h
pb equ 0de01h
pc equ 0de02h
ctr equ 0de03h
fire db 86h,0afh,0f9h,8eh
help db 8ch,0c7h,86h,89h
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,80h
mov dx,ctr
out dx,al
mov cx,05h
next:lea si,fire
call flash
call delay
call delay
lea si,help
call flash
call delay
call delay
loop next
int 03h
code ends
end start
data segment
msg1 db 10,13,'Enter first number : $'
msg2 db 10,13,'Enter second number : $'
msg3 db 10,13,'Addition of 2 numbers : $'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
lea dx,msg1
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bl,al
lea dx,msg2
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ah,00h
add al,bl
aaa
add ax,3030h
mov bx,ax
lea dx,msg3
mov ah,09h
int 21h
mov dl,bh
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
int 3h
code ends
end start
data segment
src db 'sdmit'
cnt equ $-src
msg1 db 'Found at location:$'
msg2 db 'Not found$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov es,ax
mov al,'m'
mov cx,cnt
cld
repne scasb -- Two conditions for exit (ZF=1 or CX=0)
jz found -- ZF = 1
disp msg2 -- CX=0 & ZF =0
jmp last
found:disp msg1
mov al,cnt
sub al,cl
aam
add ax,3030h
mov bx,ax
mov dl,bh
display
mov dl,bl
display
last:int 3h
code ends
end start
data segment
src db 13h,34h,12h,0ffh,80h,0a0h
cnt equ $-src
positive db 0h
negative db 0h
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
lea si,src
mov cx,cnt
up: mov al,[si]
rol al,1
jc jneg
inc [positive]
jmp down
jneg:inc [negative]
down:inc si
loop up
int 3h
code ends
end start
data segment
src db 13h,14h,15h,26h,0ffh
cnt equ $-src
element db 14h
msg1 db 10,13,'Element found$'
msg2 db 10,13,'Element not found$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cl,cnt
lea si,src
mov al,element
up:cmp al,[si]
jz found
inc si
loop up
found:lea dx,msg1
jmp last
nofound:lea dx,msg2
last:mov ah,09h
int 21h
int 3h
code ends
end start
data segment
msg db 'Current time is$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
lea dx,msg
mov ah,09h
int 21h
mov ah,2ch
int 21h
mov al,ch
call disp
mov dl,':'
mov ah,02h
int 21h
mov al,cl
call disp
int 3h
disp proc near
aam
add ax,3030h
mov bx,ax
mov dl,bh
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
ret
disp endp
code ends
end start
disp macro
mov ah,02h
int 21h
endm
data segment
msg1 db 10,13,'Enter dividend : $'
msg2 db 10,13,'Enter divisor : $'
msg3 db 10,13,'Quotient : $'
msg4 db 10,13,'Remainder:$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
display msg1
key
sub al,30h
mov bh,al
key
sub al,30h
mov bl,al
display msg2
key
sub al,30h
mov cl,al
mov ax,bx
aad
div cl
add ax,3030h
mov bx,ax
display msg3
mov dl,bl
disp
display msg4
mov dl,bh
disp
int 3h
code ends
end start
data segment
N db 13h
ones db 0h
zeros db 0h
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cx,08h
mov al,N
up:rol al,1
jc jone
inc [zeros]
jmp down
jone:inc [ones]
down:inc si
loop up
int 3h
code ends
end start
data segment
N db 98h
msg1 db 10,13,'Entered number is even$'
msg2 db 10,13,'Entered number is odd$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,N
ror al,1
jc jodd
mov dx,offset msg1
jmp last
jodd:mov dx,offset msg2
last:mov ah,09h
int 21h
int 3h
code ends
end start
data segment
N db 98h
msg1 db 10,13,'Entered number is positive$'
msg2 db 10,13,'Entered number is negative$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,N
rol al,1
jc jneg
mov dx,offset msg1
jmp last
jneg:mov dx,offset msg2
last:mov ah,09h
int 21h
int 3h
code ends
end start
data segment
a dw 0ffffh
b dw 0067h
c dw 2 dup(?)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ax,a
mul b
mov c,ax
mov c+2,dx
int 3h
code ends
end start
code ends
end start
data segment
res db ?
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov cx,03h
mov dl,10
mov bl,00h
up:mov ah,01h
int 21h
sub al,30h
push ax
mov al,bl
mul dl
mov bl,al
pop ax
add bl,al
loop up
mov res,bl
int 3h
code ends
end start
data segment
pa equ 0de00h
pb equ 0de01h
pc equ 0de02h
ctr equ 0de03h
key db 10,13,'Entered key is:$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,90h
mov dx,ctr
out dx,al
begin:mov al,80h
mov ch,0
mov bl,3
nxtrow:rol al,1
mov bh,al
mov dx,pc
out dx,al
mov cl,8
mov dx,pa
in al,dx
nxtcol:ror al,1
jc display
inc ch
dec cl
jnz nxtcol
mov al,bh
dec bl
jnz nxtrow
jmp begin
display:disp key
mov dl,ch
cmp dl,0ah
jc digit
add dl,07h
digit:add dl,30h
mov ah,02h
int 21h
int 03h
code ends
end start
code ends
end start
aam
add ax,3030h
mov bx,ax
mov dl,bh
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
mov dl,10
mov ah,02h
int 21h
mov dl,13
mov ah,02h
int 21h
pop dx
pop cx
pop bx
pop ax
ret
disp endp
code ends
end start
mov bl,08h
l2:rol al,1
mov dx,pb
out dx,al
push ax
mov dx,pc
mov al,0ffh
out dx,al
mov al,00h
out dx,al
pop ax
dec bl
jnz l2
pop bx
pop cx
ret
flash endp
code segment
assume cs:code
start:mov dx,0de03h
mov al,80h
out dx,al
mov cx,0100h
mov dx,0de02h
mov al,88h
l1:out dx,al
call delay
ror al,1
loop l1
int 3h
delay proc near
push cx
mov cx,0fffh
l2:mov bx,7777h
l3:dec bx
jnz l3
loop l2
pop cx
ret
delay endp
code ends
end start
and al,0fh
add bl,30h
add al,30h
lea dx,inp
mov ah,09h
int 21h
mov dl,al
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
int 3h
code ends
end start
mov cl,04h
ror al,cl
or al,bl
mov res,al
int 3h
ashx proc near
cmp al,3Ah
jc sub30
sub al,07h
sub30:sub al,30h
ret
ashx endp
code ends
end start
Subfunction zero initializes a serial port. This call lets you set the baud
rate, select parity modes, select the number of stop bits, and the number
of bits transmitted over the serial line. These parameters are all
specified by the value in the al register using the following bit
encodings:
Bits Function
5..7 Select baud rate
000- 110 baud
001- 150
010- 300
011- 600
100- 1200
101- 2400
110- 4800
111- 9600
2 Stop bits
0-One stop bit
1-Two stop bits
0..1 Character Size
10- 7 bits
11- 8 bits
Although the standard PC serial port hardware supports 19,200 baud, some
BIOSes may not support this speed.
Example: Initialize COM1: to 2400 baud, no parity, eight bit data, and two
stop bits-
mov ah, 0 ;Initialize opcode
mov al, 10100111b ;Parameter data.
mov dx, 0 ;COM1: port.
int 14h
After the call to the initialization code, the serial port status is
returned in ax (see Serial Port Status, ah=3, below).
This function transmits the character in the al register through the serial
port specified in the dx register. On return, if ah contains zero, then the
character was transmitted properly. If bit 7 of ah contains one, upon
return, then some sort of error occurred. The remaining seven bits contain
Subfunction two is used to read a character from the serial port. On entry,
dx contains the serial port number. On exit, al contains the character read
from the serial port and bit seven of ah contains the error status. When
this routine is called, it does not return to the caller until a character
is received at the serial port.
This call returns status information about the serial port including
whether or not an error has occurred, if a character has been received in
the receive buffer, if the transmit buffer is empty, and other pieces of
useful information. On entry into this routine, the dx register contains
the serial port number. On exit, the ax register contains the following
values:
AX: Bit Meaning
15 Time out error
14 Transmitter shift register empty
13 Transmitter holding register empty
12 Break detection error
11 Framing error
10 Parity error
9 Overrun error
8 Data available
7 Receive line signal detect
6 Ring indicator
5 Data set ready (DSR)
4 Clear to send (CTS)
3 Delta receive line signal detect
2 Trailing edge ring detector
1 Delta data set ready
0 Delta clear to send
There are a couple of useful bits, not pertaining to errors, returned in
this status information. If the data available bit is set (bit #8), then
the serial port has received data and you should read it from the serial
data segment
str db 'SDMIT$'
len equ $-str
disp1 db 'Data transmited successfully$'
disp2 db 'Error occured$'
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
lea si,str
mov cx,len
mov ah,00h; initializaton
mov al,0e3h
mov dx,00h
int 14h
and ah,20h
cmp ah,20h
jne l1
mov al,[si]
inc si
;mov al,'a'
mov ah,01h ;transmit
mov dx,00h
int 14h
loop l1
test ah, 80h ;Check for error
jnz SerialError
mov dx,offset disp1
jmp last
serialerror:mov dx,offset disp2
last:mov ah,09h
int 21h
int 3h
code ends
end start
RECEIVER PROGRAM
data segment
data ends
code segment
assume cs:code,ds:data
start:mov ax,ds
mov ds,ax
mov ah,00h; initializaton
mov al,0e3h
mov dx,00h
int 14h
exit: int 3h
code ends
end start
data segment
no db 99
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ah,00h
mov al,02h
call disp
mov ax,0003h
up:mov ah,00h
mov cl,al
shr cl,01h
mov bl,02h
mov dx,ax
up1: mov ax,dx
div bl
cmp ah,00h
jz skip
inc bl
loop up1
mov ax,dx
call disp
skip:mov al,dl
add al,02h
cmp al,no
jc up
int 3h
aam
mov dl,13
mov ah,02h
int 21h
pop dx
pop cx
pop bx
pop ax
ret
disp endp
code ends
end start
code ends
end start
and al,0fh
add bl,30h
add al,30h
lea dx,inp
mov ah,09h
int 21h
mov dl,al
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
int 3h
code ends
end start