當前位置:編程學習大全網 - 編程語言 - 匯編語言實現DOS環境下指法練習中輸入輸出程序

匯編語言實現DOS環境下指法練習中輸入輸出程序

mov dh,5

mov dl,0

mov ah,2

int 10h

lea dx,leter

mov ah,09h

int 21h

lea dx,string

mov ah,0Ah

int 21h

mov cl,0h

mov bx,-1h

mov al,[string+1]

sub al,1h

mov ah,0h

bb2: inc bx

mov dh,string1[bx+2]

mov ch,leter[bx]

cmp ch,dh

jz county

cmp bx,ax

jz out2

jmp bb2

county: inc count1

cmp bx,ax

jz out2

jmp bb2

out2: lea dx,enter1

mov ah,09h

int 21h

pop1

;----------------------------sjm---------------------------

;-----------time end-----------

MOV AH,2Ch

INT 21h

SUB CL,min

MOV min,CL

CMP DH,second

JB fen2

JMP gettime2

fen2: DEC min

ADD DH,60

gettime2: SUB DH,second

MOV second,DH

;-----------time endedns----------

; -------------out time -----------

MOV BH,0

MOV DH,1

MOV DL,60

MOV AH,2

INT 10h

LEA DX,ut

MOV AH,09h

INT 21h

MOV BH,0

MOV DH,3

MOV DL,67

MOV AH,2

INT 10h

LEA DX,mas7

MOV AH,09h

INT 21h

MOV DL, min

MOV BL, 10

MOV AX, 00h

MOV AL, DL

DIV BL

MOV CH, AH

ADD AL, 30h

MOV BH,0

MOV DH,3

MOV DL,65

MOV AH,2

INT 10h

MOV DL, AL

MOV AH, 02h

INT 21h

ADD CH, 30h

MOV DL, CH

MOV AH, 02h

INT 21h

MOV DL, second

MOV BL, 10

MOV AX, 00h

MOV AL, DL

DIV BL

MOV CH, AH

ADD AL, 30h

MOV BH,0

MOV DH,3

MOV DL,72

MOV AH,2

INT 10h

MOV DL, AL

MOV AH, 02h

INT 21h

ADD CH, 30h

MOV DL, CH

MOV AH, 02h

INT 21h

MOV BH,0

MOV DH,3

MOV DL,72

MOV AH,2

INT 10h

;--------out time end----------

endm

hards macro letter,leter,string1

push1

;time--------------------------

MOV AH,2Ch

INT 21h

MOV min,CL

MOV second,DH

;--------------------------------

mov bh,0h

mov dh,1

mov dl,23

mov ah,2

int 10h

lea dx,msg3

mov ah,09h

int 21h

mov bh,0h

mov dh,3

mov dl,10

mov ah,2

int 10h

lea dx,letter

mov ah,09h

int 21h

;----------------------------------sjm---------------------------------

mov bh,0h

mov dh,5

mov dl,0

mov ah,2

int 10h

lea dx,leter

mov ah,09h

int 21h

lea dx,string

mov ah,0Ah

int 21h

mov cl,0h

mov bx,-1h

mov al,[string+1]

sub al,1h

mov ah,0h

bb3: inc bx

mov dh,string1[bx+2]

mov ch,leter[bx]

cmp ch,dh

jz countz

cmp bx,ax

jz out3

jmp bb3

countz: inc count1

cmp bx,ax

jz out3

jmp bb3

out3: lea dx,enter1

mov ah,09h

int 21h

pop1

;------------------------------------------sjm--------------------------

;-----------time end-----------

MOV AH,2Ch

INT 21h

SUB CL,min

MOV min,CL

CMP DH,second

JB fen3

JMP gettime3

fen3: DEC min

ADD DH,60

gettime3: SUB DH,second

MOV second,DH

;-----------time endedns----------

; -------------out time -----------

MOV BH,0

MOV DH,1

MOV DL,60

MOV AH,2

INT 10h

LEA DX,ut

MOV AH,09h

INT 21h

MOV BH,0

MOV DH,3

MOV DL,67

MOV AH,2

INT 10h

LEA DX,mas7

MOV AH,09h

INT 21h

MOV DL, min

MOV BL, 10

MOV AX, 00h

MOV AL, DL

DIV BL

MOV CH, AH

ADD AL, 30h

MOV BH,0

MOV DH,3

MOV DL,65

MOV AH,2

INT 10h

MOV DL, AL

MOV AH, 02h

INT 21h

ADD CH, 30h

MOV DL, CH

MOV AH, 02h

INT 21h

MOV DL, second

MOV BL, 10

MOV AX, 00h

MOV AL, DL

DIV BL

MOV CH, AH

ADD AL, 30h

MOV BH,0

MOV DH,3

MOV DL,72

MOV AH,2

INT 10h

MOV DL, AL

MOV AH, 02h

INT 21h

ADD CH, 30h

MOV DL, CH

MOV AH, 02h

INT 21h

MOV BH,0

MOV DH,3

MOV DL,72

MOV AH,2

INT 10h

;--------out time end----------

endm

;---------------------------------------------------------------------

mao_hao_p macro

push1

mov dl,':'

mov ah,02h

int 21h

pop1

endm

;------------------------------------

div_10_p macro num

push1

mov al,num

cbw

mov cl,10

div cl

mov bl,ah

mov dl,al

add dl,30h

mov ah,02h

int 21h

mov dl,bl

add dl,30h

mov ah,02h

int 21h

pop1

endm

;----------------------------------------------------------------------

;---------------------------------------------------------------

chuan macro scr,dst,table2,table3

push1

mov cx,10

mov bx,0

again2:

mov al,table2[scr+bx]

mov table3[dst+bx],al

inc bx

loop again2

pop1

endm

;---------------------------------------------------------------

pai_xu macro count,table,table1,table2,table3

push1

mov cx,count

again13:

push cx

mov bx,-1

mov dl,0

again33:

inc bx

cmp bx,count

jz out13

cmp dl,table[bx]

jge again33

mov dl,table[bx]

mov si,bx

jmp again33

out13:

mov table1[di],dl

mov table[si],0

push di

push si

mov cl,3

mov bx,si

mov ax,di

shl si,cl

shl di,cl

shl bx,1

shl ax,1

add si,bx

add di,ax

chuan si,di,table2,table3

pop si

pop di

inc di

pop cx

loop again13

pop1

endm

;---------------------------------------------------------------

space macro num,again

push cx

push ax

mov cx,num

again:

mov ah,02h

mov dl,20h

int 21h

loop again

pop ax

pop cx

endm

;---------------------------------------------------------------

xian macro lab,tab3,cou

push1

mov bh,0h

mov dh,0

mov dl,0

mov ah,2

int 10h

lea dx,lab

mov ah,09h

int 21h

mov al,31h

mov bx,0

mov cx,cou

again10:

space 2,a1

mov dl,al

push ax

mov ah,02h

int 21h

space 5,a2

lea dx, tab3[bx]

mov ah,09h

int 21h

div_10_p d1[si]

mov ah,02h

mov dl,10

int 21h

mov ah,02h

mov dl,13

int 21h

pop ax

inc al

inc si

add bx,10

loop again10

pop1

endm

;---------------------------------------------------------------

name_r macro cout1,cout2,cout3

push1

mov di,cout1

mov si,cout2

lea dx,na

mov ah,09h

int 21h

mov bx,0

ag:

mov ah,01h

int 21h

cmp al,13

jz out111

mov tab2[bx+di],al

inc bx

jmp ag

out111:

mov al,cout3

mov d4[si], al

pop1

endm

;---------------------------------------------------------------

menu macro

MOV AX,data

MOV DS,AX

clean

MOV AH, 09

MOV AL, 20h

MOV BH, 0

MOV BL, 0bh;colour

MOV CX, 01; count

INT 10h

MOV DH,6

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m1

MOV AH,09h

INT 21h

MOV DH,8

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m2

MOV AH,09h

INT 21h

MOV DH,10

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m3

MOV AH,09h

INT 21h

MOV DH,12

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m4

MOV AH,09h

INT 21h

MOV DH,14

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m5

MOV AH,09h

INT 21h

MOV DH,16

MOV BH,0

MOV DL,17

MOV AH,2

INT 10h

LEA DX,m6

MOV AH,09h

INT 21h

;-----------Up------------

MOV DH, 2

MOV DL, 14;左側開始列

MOV BH, 0

MOV AH, 2

INT 10h

MOV AH, 09

MOV AL, 40h

MOV BH, 0

MOV BL, 0dh

MOV CX, 53

INT 10h

;--------------Down--------------

MOV DH, 19

MOV DL, 14

MOV BH, 0

MOV AH, 2

INT 10h

MOV AH, 09

MOV AL, 40h

MOV BH, 0

MOV BL, 0dh

MOV CX, 54

INT 10h

;-----------left-----------

MOV DL, 14

MOV DH, 1

le_L:

INC DH

CMP DH, 19;左側位置

JZ r_L

MOV BH, 0

MOV AH, 2

INT 10h

MOV AH, 09

MOV AL, 40h

MOV BH, 0

MOV BL, 0dh

MOV CX, 01

INT 10h

JMP le_L

r_L:

MOV DL, 67

MOV DH, 1

r_p:

INC DH

CMP DH, 19

JZ abc

MOV BH, 0

MOV AH, 2

INT 10h

MOV AH, 09

MOV AL, 40h

MOV BH, 0

MOV BL, 0dh

MOV CX, 01

INT 10h

JMP r_p

endm

againn: menu

abc: mov flag,1

mov ah,01h

int 21h

cmp al,'1'

jz L1

jmp abc2

L1: clean

random1

easy letter,stringx,string

jmp aa

abc2: cmp al,'2'

jz L2

jmp abc3

L2: clean

random2

middle letter,stringx,string

jmp aa

abc3: cmp al,'3'

jz L3

jmp abc4

L3: clean

random3

hards letter,stringx,string

jmp aa

abc4: cmp al,'4'

jz L4

jmp abc

L4: clean

jmp last

----------------------------sjm--------------------

aa: MOV BH,0

MOV DH,20

MOV DL,0

MOV AH,2

INT 10h

lea dx,result

mov ah,09h

int 21h

mov al,count1

add count2,al

div_10_p count2

------------------------sjm------------------------

againn1: cmp flag,1

jz againn2

jmp againn

againn2: name_r count12,count11,count2

mov count2,0

mov count1,0

lea dx,zz

mov ah,09h

int 21h

f2: mov ah,1

int 16h

jnz f1

;------------------

mov bx,30000

wait1: mov cx,20000

delay: loop delay

dec bx

jnz wait1

;---------------------

jmp f2

f1: mov ah,01h

int 21h

cmp al,'y'

jz outb

jmp outa

outb: add count12,10

inc count11

inc c

mov flag,0

jmp againn1

outa: clean

pai_xu c,d4,d1,tab2,tab3

xian lab1,tab3,c

mov ah,01h

int 21h

;---------------------------------------------------------------

last: mov ah,4ch

int 21h

code ends

end start

  • 上一篇:電子點焊機的設備原理
  • 下一篇:音樂可視化的理論闡述
  • copyright 2024編程學習大全網