当前位置:文档之家› 中南民族大学 微机原理实验答案

中南民族大学 微机原理实验答案

中南民族大学微机原理实验答案
实验一
第二题在debug中实现在屏幕上显示“0123456789”
A 100
0100:mov cx,0a
Mov dl,30
Mov ah,2
0106: int 21h
Inc dl
Loop 0106
Int 20h
第三题用int 21h 中的2号功能在屏幕上显示“122333444455555666666777777788888888999999999”
a 100
0100: mov cx,9
mov dl,31h
0104: push cx
xor cx,cx
mov cl,dl
sub cl,30h
010c: mov ah,2
int 21h
loop 010c
inc dl
pop cx
loop 0100
mov ax,4c00h
int 21h
int 20h
第四题用九号功能在屏幕上显示‘9876543210’
A 100
0100: db ‘9876543210’
0106: Mov dx,0100
mov ah,9h
int 21h
Int 20h
实验二
第三题修改程序,在第一行连续显示4个“Hello,World!”每个以空格分开。

name hello
sseg segment stack
db 64 dup(0)
sseg ends
dseg segment
mess db 'hello World!',' ','$'
dseg ends
cseg segment
assume cs:cseg,ds:dseg,ss:sseg,es:dseg main proc far
begin:mov ax,dseg
mov ds,ax
mov es,ax
mov ah,9
mov cx,4
s1: mov dx,offset mess
int 21h
loop s1
mov ax,4c00h
int 21h
main endp
cseg ends
end begin
第四题
name hello
sseg segment stack
db 64 dup(0)
sseg ends
dseg segment
mess db 'hello World!','0ah,0dh,'$'
dseg ends
cseg segment
assume cs:cseg,ds:dseg,ss:sseg,es:dseg main proc far
begin:mov ax,dseg
mov ds,ax
mov es,ax
mov ah,9
mov cx,20
s1: mov dx,offset mess
int 21h
loop s1
mov ax,4c00h
int 21h
main endp
cseg ends
end begin
第二题
code segment assume cs:code
con8255 equ 0ff2bh pb8255 equ 0ff29h pa8255 equ 0ff28h pc8255 equ 0ff2ah
org 4200h
start:
mov al,88h
mov dx,con8255 out dx,al
mov dx,pc8255
L0: in al,dx
mov cl,4
rol al,cl
out dx,al
Jmp L0
code ends
end start
code segment assume cs:code
con8255 equ 0ff2bh pb8255 equ 0ff29h pa8255 equ 0ff28h
org 4100h
start:
mov dx,con8255 mov al,80h
out dx,al
mov dx,pa8255
L0: mov al,0h out dx,al
call delay
mov al,0ffh
out dx,al
call delay
jmp L0
hlt
delay: push cx
mov cx,005h
L3: mov bx,8000h L2: dec bx
jnz L2
loop L3
pop cx
ret
code ends
end start
第四题
code segment assume cs:code
con8255 equ 0ff2bh pb8255 equ 0ff29h pa8255 equ 0ff28h
org 4200h
start:
mov al,80h
mov dx,con8255 out dx,al
mov dx,pb8255
L0: mov al,0ffh mov cx,08h
L1: clc
rcl al,1
out dx,al
call delay
loop L1
mov cx,08h
L2: stc
rcr al,1
out dx,al
call delay
loop L2
jmp L0
delay: push cx
mov cx,005h
L3: mov bx,8000h
L4: dec bx
jnz L4
loop L3
pop cx
ret
code ends
end start
实验四
3
code segment assume cs:code
con8255 equ 0ff2bh pb8255 equ 0ff29h pa8255 equ 0ff28h p8259com0 equ 0ff80h p8259com1 equ 0ff81h intq3 equ interrupt3
org 4400h
start:mov al,80h
mov dx,con8255
out dx,al
mov ax,offset interrupt mov ds:[002ch],ax mov ax,0000h
mov ds:[002eh],ax
mov al,13h
mov dx,p8259com0 out dx,al
mov al,08h
mov dx,p8259com1 out dx,al
mov al,09h
out dx,al
mov al,11110111B out dx,al
mov dx,pa8255 mov al,7fh
out dx,al
mov ah,7fh
mov cx,0008h
L1:cmp cx,0000h jnz L0
mov dx,p8259com1 mov al,0ffh
out dx,al
sti
hlt
L0:sti
jmp L1
interrupt :stc
rcr ah,1
mov al,ah
mov dx,pa8255
out dx,al
dec cx
mov dx,p8259com0 mov al,20h
out dx,al
iret
code ends
end start。

相关主题