编译:
INKEY宏NN
MOV啊,1H
中断21h
子人,30H
MOV BL,NN
MUL BL
ENDM
数据段
总和DW 0 />str1的DW 0
str2的DW 0
STR3 DW 0
BUFF1 DB 0
BU2 DB“1 2 3 4 5 6 7 8 9 A”,0DH,0AH“ “
数据结束
堆栈段段堆栈
DB 100 DUP(?)
堆栈结束
代码段
假设CS,DS代码: ES:数据,数据,SS:堆栈
SUB1 PROC远远开始推DS
MOV AX,0
的PUSH AX
MOV AX,数据
MOV DS,斧头
MOV ES,斧头
INKEY 100,输入的第一个号码
INKEY 10
INKEY
MOV AX,总和
>MOV str1的斧头
MOV总和,0
MOV DL,“
MOV啊,2H
中断21h
INKEY 100进入第一两个数字
INKEY 10
INKEY 1,总和
MOV str2的AX
MOV总和,0
MOV DL“,”乐章啊,2H
中断21h
INKEY 100输入数量
INKEY 10
INKEY 1
MOV AX,总和
>MOV STR3,斧头
MOV DL,0DH
乐章啊,2H
21H
MOV DL,0AH
乐章啊,2H
>INT 21H
MOV AX,str1的三个数字大小
CMP斧头,STR2
JAE A7。的
JMP A8
A7:MOV BX,STR2
MOV STR2,斧头
MOV str1中,BX
A8:MOV AX,STR2
CMP斧头,STR3
宰A9
JMP A11
A9:MOV BX,STR3
MOV STR3,斧头
MOV STR2,BX
MOV AX,str1的
CMP斧头,STR2
宰A10
JMP A11
A10:MOV BX,BX,STR2
MOV STR2,斧头
MOV str1的
A11:MOV AX,STR1
MOV AL,啊
调用SUB3
MOV AX,STR1
调用SUB3
MOV DL,“H” />乐章啊,2H
中断21h
MOV DL,“
MOV啊,2H
INT 21H
XOR啊,啊
MOV AX,STR2
MOV AL,啊
呼叫SUB3
MOV AX,STR2
调用SUB3
MOV DL,“H”
>乐章啊,2H
21H
MOV DL,“”
MOV啊,2H
21H
异啊,啊
MOV AX,STR3
MOV AL,啊
调用SUB3
MOV AX,STR3
通话SUB3
MOV DL,“H”
MOV啊,2H 21H
RET
SUB1 ENDP
SUB2 PROC
CMP AL,9
JA G1
添加人,“0”
JMP G2
G1:加AL,37H
G2:MOV DL,人
乐章啊,2
21H
RET
SUB2 ENDP
SUB3 PROC
MOV BUFF1人
SHR人,1
SHR人,1
SHR人,1 BR />SHR人,1
CALL SUB2
MOV AL,BUFF1
人,0FH
CALL SUB2
RET SUB3 ENDP 代码结束
年底开始
(C语言):
#包括中
无效的main()
{
吨
INT A,B,C
的printf(“请输入三个整数:\ N”)
scanf函数(“%D%D%D” ,&B,&C)
倘(a>B)
{
T = A
= B
B =吨BR />} / / A,B交换
(>C)
{
T = A
= C
C =吨BR />} / / A,C交换
(B>C)
{
T = B
B = C
C =吨BR />} / / B,C交换
的printf(“从小到大输出数:%d,%D,%D \ N”,A,B,C)
}
data_segsegmentcardb 2
db 40h,0bh,0,0
db 02ah,0bh,0,1
jeep db 2
db 40h,0bh,0,0
db 02ah,0bh,0,-1
star db 2
db 40h,0bh,0,0
db 02ah,0,0,1
star1 db 2
db 40h,0bh,0,0
db 02ah,0,0,-1
star2 db 26
db 40h,0bh,0,0
db 02ah,0bh,0,1
db 40h,0bh,-1,-3
db 02ah,0bh,0,1
db 40h,0bh,2,-1
db 02ah,0bh,0,1
db 40h,0bh,1,-3
db 02ah,0bh,0,1
db 40h,0bh,-4,-1
db 02ah,0bh,0,1
db 40h,0bh,-1,-3
db 02ah,0bh,0,1
db 40h,0bh,6,-1
db 02ah,0bh,0,1
db 40h,0bh,1,-3
db 02ah,0bh,0,1
db 40h,0bh,-8,-1
db 02ah,0bh,0,1
db 40h,0bh,-1,-3
db 02ah,0bh,0,1
db 40h,0bh,10,-1
db 02ah,0bh,0,1
db 40h,0bh,1,-3
db 02ah,0bh,0,1
db 40h,0bh,-12,-1
db 02ah,0bh,0,1
star3 db 26
db 40h,0bh,0,0
db 02ah,0bh,0,-1
db 40h,0bh,-1,3
db 02ah,0bh,0,-1
db 40h,0bh,2,1
db 02ah,0bh,0,-1
db 40h,0bh,1,3
db 02ah,0bh,0,-1
db 40h,0bh,-4,1
db 02ah,0bh,0,-1
db 40h,0bh,-1,3
db 02ah,0bh,0,-1
db 40h,0bh,6,1
db 02ah,0bh,0,-1
db 40h,0bh,1,3
db 02ah,0bh,0,-1
db 40h,0bh,-8,1
db 02ah,0bh,0,-1
db 40h,0bh,-1,3
db 02ah,0bh,0,-1
db 40h,0bh,10,1
db 02ah,0bh,0,-1
db 40h,0bh,1,3
db 02ah,0bh,0,-1
db 40h,0bh,-12,1
db 02ah,0bh,0,-1
char_cnt1 dw ?
pointer1dw ?
line_on1db ?
col_on1 db ?
char_cnt2 dw ?
pointer2dw ?
line_on2db ?
col_on2 db ?
chardw ?
col db ?
col0db ?
col00 db ?
col01 db ?
count db ?
count0 db ?
count1 db ?
count2 db ?
char0 db ?
char1 db ?
char01 db ?
char2 db ?
line1 db ?
col1db ?
pot1dw ?
line2 db ?
col2db ?
pot2dw ?
count_cxdb ?
data_segends
---------------------------------------
code_segsegment
assume cs:code_seg,ds:data_seg
mainproc far
push ds
sub ax,ax
sub cx,cx
push ax
push cx
mov ax,data_seg
mov ds,ax
mov col,2
mov col0,2
mov col01,2
mov char0,2
mov char01,2
mov count,5
mov char1,76
mov char2,2
mov count0,4
mov count1,2
mov count_cx,2
again:
lea di,star
mov dh,3
mov dl,2
call move_shape
dec count0
lea di,star1
mov dh,17
mov dl,76
call move_shape
dec count0
lea di,jeep
mov dh,4
mov dl,2
call move_shape
dec count0
lea di,car
mov dh,16
mov dl,76
call move_shape
------------------------------
mov count0,13
again1:
mov col,2
mov col0,2
mov col01,2
mov char0,2
mov char01,2
mov count,5
mov char1,76
mov char2,2
mov count1,2
mov count_cx,2
lea di,star2
mov dh,10
mov dl,40
call move_shape1
lea di,star3
mov dh,10
mov dl,38
call move_shape2
call must_2
dec count0
jne again1
pop cx
ret
mainendp
----------------------------
clear_screen proc near
push ax
push bx
push cx
push dx
movah,6
moval,0
movch,0
movcl,0
movdh,24
movdl,79
movbh,7
int10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
-------------------------------------
move_shape proc near
push ax
push bx
push cx
push dx
push di
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov char_cnt1,cx
mov pointer1,di
mov line_on1,dh
mov col_on1,dl
plot_next:
add dh,[di+2]
add dl,[di+3]
cmp count0,3
je exit2
cmp count0,2
je exit9
cmp count0,1
je exit10
cmp dl,78
jb mov_crsr
jmp exit1
exit2: cmp dl,1
jnb mov_crsr
jmp exit1
exit9: cmp dh,17
jb mov_crsr
jmp exit1
exit10: cmp dh,3
ja mov_crsr
exit1: pop di
pop dx
pop cx
pop bx
pop ax
ret
mov_crsr:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,09
int 10h
pop cx
add di,4
loop plot_next
exit4: dec count
je exit3
call dly_qrtr
jmp exit4
exit3: call erase
mov count,5
jmp short plot_next
move_shape endp
----------------------------------------
-------------------------------------
move_shape1proc near
push ax
push bx
push cx
push dx
push di
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov char_cnt1,cx
mov pointer1,di
mov line_on1,dh
mov col_on1,dl
mov char,cx
pop di
pop dx
pop cx
pop bx
pop ax
ret
move_shape1endp
----------------------------
move_shape2proc near
push ax
push bx
push cx
push dx
push di
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov char_cnt2,cx
mov pointer2,di
mov line_on2,dh
mov col_on2,dl
mov char,cx
pop di
pop dx
pop cx
pop bx
pop ax
ret
move_shape2endp
-----------------------------------------
must_2 proc near
push ax
push bx
push cx
push dx
push di
mov ah,0fh
int 10h
exit41: sub cx,cx
movcol,2
movcol01,2
movchar0,2
movchar01,2
movcx,char_cnt1
movdi,pointer1
movdh,line_on1
movdl,col_on1
movchar,cx
jmpplot_next1
exit31: sub cx,cx
movcx,char_cnt2
movdi,pointer2
movdh,line_on2
movdl,col_on2
movchar,cx
jmpplot_next1
------------------------------------------
exit61: call dly_qrtr
movchar0,2
movchar01,2
movcol01,2
movcol,2
movdl,col_on2
cmpdl,38
je exit71
cmpdl,32
je exit71
cmpdl,26
je exit71
cmpdl,20
je exit71
cmpdl,14
je exit71
cmpdl,8
je exit71
cmpdl,2
je exit72
call dly_qrtr
call dly_qrtr
call dly_qrtr
call dly_qrtr
call erase1
cmpcol0,26
je exit81
addcol0,4
exit81: jmpexit41
exit71: addcol_on1,2
subcol_on2,2
cmpcol0,26
je exit81
addcol0,4
jmpexit41
exit02: jmpexit61
exit72: jmpexit21
exit01: mov line2,dh
mov col2,dl
add di,4
mov pot2,di
mov dl,col01
cmp col0,dl
je exit02
add col01,4
mov col,4
mov char01,2
dec char01
jmp exit410
exit21:pop di
pop dx
pop cx
pop bx
pop ax
ret
exit410:movdh,line1
movdi,pot1
movdl,col1
jmpplot_next1
exit310:movdh,line2
movdi,pot2
movdl,col2
jmpplot_next1
exit03: jmp exit01
----------------------------------------
plot_next1: add dh,[di+2]
add dl,[di+3]
mov ah,2
int 10h
mov ah,8
int 10h
cmp dl,3
jb exitx0
cmp dl,76
jae exitx0
cmp ah,0bh
je exitx
cmp ah,0dh
je exitx2
cmp ah,0ah
je exitx3
cmp ah,0eh
je exitx4
exitx0: mov al,[di]
mov bl,[di+1]
jmp exitx1
exitx: mov bl,0dh
jmp exitx1
exitx2: mov bl,0ah
jmp exitx1
exitx3: mov bl,0eh
jmp exitx1
exitx4: mov bl,0ch
exitx1: push cx
mov cx,1
mov ah,09
int 10h
pop cx
dec col
je exit51
add di,4
jmp plot_next1
exit51: cmp char01,0
je exit03 -------------
cmp char01,1
je exit12
cmp char0,1
je exit03 --------------------
mov line1,dh
mov col1,dl
add di,4
mov pot1,di
mov col,2
dec char0
jmp exit31
exit12: mov line1,dh
mov col1,dl
add di,4
mov pot1,di
dec char01
mov col,4
jmp exit310
must_2 endp
--------------------------------------------
erase proc near
cmpcount0,4
jneexit6
addcol_on1,2
jmpexit
exit6: cmpcount0,3
jneexit7
subcol_on1,2
jmpexit
exit7: cmpcount0,2
jneexit8
incline_on1
jmpexit
exit8: cmpcount0,1
jneexit
decline_on1
exit: movdh,line_on1
movdl,col_on1
movcx,char_cnt1
movdi,pointer1
ret
erase endp
-----------------------------------------
erase1 proc near
sub cx,cx
movcx,char_cnt1
movdi,pointer1
movdh,line_on1
movdl,col_on1
movchar,cx
jmperase_next1
exit62: sub cx,cx
movcx,char_cnt2
movdi,pointer2
movdh,line_on2
movdl,col_on2
movchar,cx
jmperase_next1
exit011:mov line2,dh
mov col2,dl
add di,4
mov pot2,di
mov dl,col01
cmp col0,dl
je exit021
add col01,4
mov col,4
mov char01,2
dec char01
jmp exit4101
exit4101: movdh,line1
movdi,pot1
movdl,col1
jmperase_next1
exit3101: movdh,line2
movdi,pot2
movdl,col2
jmperase_next1
exit012:jmp exit011
exit021:jmp left
erase_next1:
adddh,[di+2]
adddl,[di+3]
movah,2
int10h
moval,'*'
movbl,0
push cx
movcx,1
movah,9
int10h
popcx
-------------------------------------
deccol
je exit0
adddi,4
jmperase_next1
exit0: cmp char01,0
je exit012 -------------
cmp char01,1
je exit121
cmp char0,1
je exit012 --------------------
mov line1,dh
mov col1,dl
add di,4
mov pot1,di
mov col,2
dec char0
jmp exit62
exit121:mov line1,dh
mov col1,dl
add di,4
mov pot1,di
dec char01
mov col,4
jmp exit3101
left: addcol_on1,2
subcol_on2,2
ret
erase1 endp
------------------------------------------
dly_qrtrproc near
push cx
push dx
movdx,25
dll:movcx,65530
dl2:loop dl2
decdx
jnzdll
popdx
popcx
ret
dly_qrtrendp
---------------------------------------
code_segends
endmain
---------------------------------
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)