1、汇编语言编写金牌榜程序使用汇编语言编写金牌榜程序(具体要求见书上) data segment string db 1 chushihua ,0ah,0dh, 2 input and procedue data,0ah,0dh, 3 sort ,0ah,0dh, 4 output,0ah,0dh, 5 exit to dos,0ah,0dh, $ SCst1 db country name gold silver copper HJ ,0ah,0dh,$ SRst2 db country name gold silver copper ,0ah,0dh,$ xzzifu db qingxuanz
2、e(1-5): $ err db sum of count error ,0ah,0dh,$ country_name db 160 dup (20h) array dw 64 dup (0) ls_name db 40 dup(20h) ls_shu dw 12 dup(0) jin dw 0ffffh yin dw 0 tong dw 0 sum dw 0 FLAG DW 0 data ends code segment main proc far assume cs:code,ds:data start: push ds xor ax,ax push ax mov ax,data mov
3、 ds,ax ma: CALL CRLF CALL CRLF lea dx,string mov ah,9 int 21h CALL CRLF lea dx,xzzifu mov ah,9 int 21h mov ah,1 int 21h cmp al,31h jz csh cmp al,32h jz shuru cmp al,33h jz paixu cmp al,34h jz shuchu cmp al,35h jz exit CALL CRLF jmp ma csh: mov cx,15 mov dl,30h mov al,30h lea bx,country_name csh1: mo
4、v byte ptrbx,41h mov bx+1,al mov bx+2,dl add bx,10 inc dl cmp dl,3Ah jnz csh2 inc al mov dl,30h csh2: loop csh1 mov byte ptr bx,Z mov byte ptr bx+1,H mov byte ptr bx+2,J mov cx,64 mov bx,0 csh3: mov arraybx,0 add bx,2 loop csh3 jmp ma shuru:CALL CRLF lea dx,SRst2 mov ah,9 int 21h mov cx,4 lea si,ls_
5、name lea di,ls_shu CALL CREE1 next: mov ah,1 int 21h mov si,al int 21h mov si+1,al int 21h mov si+2,al CALL CREE18 call jieshoushuju mov di,bx CALL CREE30 call jieshoushuju mov di+2,bx CALL CREE42 call jieshoushuju mov di+4,bx add si,10 add di,6 call crlf loop next MOV SUM,0 LEA SI,LS_NAME ;CHAXUN m
6、ov cx,4zjxcha: push cx push si lea di,country_name mov cx,15jxcha: mov al,si cmp al,K JZ BUDENG cmp al,di jz cha1 jxc: ADD DI,10 LOOP jxcha jmp ma cha1: MOV AL,SI+1 CMP AL,DI+1 JNZ jxc MOV AL,SI+2 CMP AL,di+2 JNZ jxc ADD DI,2 MOV AX,DI ;XIANG DENG LEIJIA JIN YING TONG LEA di,country_name sub ax,di m
7、ov dx,0 mov cx,10 div cx mov cl,3 sal ax,cl LEA BX,ARRAY add bx,ax lea si,ls_shu ADD SI,SUM ADD SUM,6 mov ax,si add bx,ax mov ax,si+2 add bx+2,ax mov ax,si+4 add bx+4,ax budeng: pop si pop cx add si,10 loop zjxcha lea si,array mov cx,15 xor ax,ax xor bx,bx xor dx,dx TJ: xor di,di add di,si add di,si
8、+2 add di,si+4 mov si+6,di add ax,si add bx,si+2 add dx,si+4 add si,8 LOOP TJ mov si,ax mov si+2,bx mov si+4,dx add ax,bx add ax,dx mov si+6,ax mov sum,ax lea si,array mov cx,15 xor ax,ax ZTJ: ADD AX,SI+6 add si,8 LOOP ZTJ CMP ax,sum jz jma LEA DX,ERR mov ah,9 int 21h mov ah,1 int 21h jma: CALL CRLF
9、 CALL CRLF JMP MA paixu:mov di,14 lp1: mov cx,di mov bx,0 mov si,0 lp2: mov ax,arraybx cmp ax,arraybx+8 jg cont jz lp3 call jh4 jmp cont lp3: mov ax,arraybx+2 cmp ax,arraybx+10 jg cont jz lp4 call jh4 jmp cont lp4: mov ax,arraybx+4 cmp ax,arraybx+12 jge cont call jh4 cont: add bx,8 add si,10 loop lp
10、2 dec di jnz lp1 jmp ma jh4 proc near push cx push si mov cx,10 nextzf:mov dl,country_namesi xchg country_namesi+10,dl mov country_namesi,dl inc si loop nextzf mov si,bx mov cx,4 nextsj:mov dx,arraysi xchg dx,arraysi+8 mov arraysi,dx add si,2 loop nextsj pop si pop cx retjh4 endpshuchu: CALL CRLF le
11、a dx,SCst1 mov ah,9 int 21h mov cx,11 mov si,-10 push si mov di,0 next3: pop si add si,10 push si push cx CMP CX,1 jnz jxnext mov si,150 mov di,120jxnext: cmp arraydi+6,0 JZ SJJS mov cx,10 ;10ge guojiaming next2: mov dl,country_namesi cmp dl,20h jz jj mov ah,2 int 21h jj1: inc si loop next2 jj: call
12、 cree18 mov bx,arraydi CMP BX,0 JG SCSJ1 CALL KG0 JMP SJ2 SCSJ1: call btod call lx SJ2: mov bx,arraydi+2 CMP BX,0 JG SCSJ2 CALL KG0 JMP SJ3 LSGD: JMP NEXT3 SCSJ2: call btod call lx SJ3: mov bx,arraydi+4 CMP BX,0 JG SCSJ3 CALL KG0 JMP SJ4 SCSJ3: call btod call lx SJ4: mov bx,arraydi+6 CMP BX,0 JG SCS
13、J4 CALL KG0 JMP SJJS SCSJ4: call btod SJJS: call crlf add di,8 pop cx loop LSGD pop si call crlf call crlf MOV AH,1 INT 21H jmp ma exit: ret CREE1 PROC NEAR PUSH DX MOV DH,24 MOV DL,0 MOV BH,0 MOV AH,2 INT 10H POP DX RET CREE1 ENDP CREE18 PROC NEAR PUSH DX MOV DH,24 MOV DL,18 MOV BH,0 MOV AH,2 INT 10H POP DX RET CREE18 ENDP CREE30 PROC NEAR PUSH DX MOV DH,24 MOV DL,30 MOV BH,0 MOV AH,2 INT 10H POP DX RET CREE30 ENDP CREE42 PROC NEAR PUSH DX MOV DH,24 MOV DL,42 MOV BH,0 MOV AH,2 INT 10H POP DX RET CREE42 ENDP jieshoushuju proc near mov
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1