编辑: 飞翔的荷兰人 | 2014-09-06 |
SUN'
s SUN JAVA'
,24H? ;
;
;
;
24H = $ ?MESSAGE db '
SUN:'
,'
$'
.stack 100H .code MAIN PROC FAR start: ??PUSH DS ??AND? AX,0 ??PUSH AX ?? ??MOV? AX,@data ??MOV? DS,AX ??MOV? AX,0H ??MOV? SI,1H subSI1: ??SUB? SI,1H subSI2: ??SUB? SI,1H compareS: ??ADD? SI,1H ??MOV? DL,ENG[SI] ??CMP? DL,24H ??JE?? print ??CMP? DL,53H ??JNE? compareS compareU: ??ADD? SI,1H ??MOV? DL,ENG[SI] ??CMP? DL,55H ??JNE? subSI2 compareN: ??ADD? SI,1H ??MOV? DL,ENG[SI] ??CMP? DL,4EH ??JNE? subSI1 ??INC? AX ??JMP? compares print: ??LEA? DX,MESSAGE ??PUSH AX ??MOV? AH,09H ??INT? 21H ??POP? AX ??call showNumber exit: ??ret MAIN ENDP 注意,ShowNumber这个子过程有问题,请自行修改;
showNumber PROC NEAR covernum: ??DAA ??MOV? dx,ax ??MOV? cl,4H show: ??ROL? dx,4H ??push dx ??AND? dx,0fH ??ADD? dx,30H ??MOV? ah,02H ??int? 21H ??pop? dx ??loop show ??ret showNumber ENDP END start? 5.11从键盘输入一系列以$为结束副的字符串,然后对其中的非数字字符计数,并显示出计数结果. .model small .386 .code MAIN PROC FAR start: ??push ds ??mov? ax,0 ??push ax ?? ??mov? cx,0 input: ??mov? ah,1H ??int? 21H compare: ??cmp? al,24H ??je?? print ??cmp? al,30H ??jl?? addCount ??cmp? al,39H ??jg?? addCount addCount: ??add? ax,1H ??jmp? input print: ??call showNumber exit:?ret MAIN ENDP 注意,ShowNumber这个子过程有问题,请自行修改;
showNumber PROC NEAR covernum: ??DAA ??MOV? dx,ax ??MOV? cl,2H show: ??ROL? dl,4H ??push dx ??AND? dl,0fH ??ADD? dl,30H ??MOV? ah,02H ??int? 21H ??pop? dx ??loop show ??ret showNumber ENDP END start 5.12 有一个首地址为MEM的100D字数组,试编制程序删除数组中所有为零的项,并将后续项向前压缩,最后将数组的剩余部分补上零. .model small .386 .stack 100H .data mem dw 12,0,0,0,0,0,1,2,3,6,4,7,8,2,1,0,0,54,5,0,2,4,7,8,0,5,6,2,1,4,8,5,1,45,7,5,1,2,0,2,4,0,2,54,0,12,0,0,0,0,0,1,2,3,6,4,7,8,2,1,0,0,54,5,0,2,4,7,8,0,5,6,2,1,4,8,5,1,45,7,5,1,2,0,2,4,0,2,54,0,45,7,5,1,2,0,2,4,0,2 .code MAIN PROC FAR start: ??push ds ??and? ax,0 ??push ax ?? ??mov? ax,@data ??mov? ds,ax ??mov? ax,0H ??mov? bx,64H ??mov? cx,64H ??mov? si,0FFFEH repeat: ??ADD? si,2H ??cmp? MEM[si],0H ??JE?? calls ??loop repeat calls: ??INC? ax ??call sort ??cmp? ax,1H ??JE?? lastValue ??DEC? cx ??jmp? repeat exit : ??ret lastValue: ??mov? mem[bx],0H ??DEC? cx ??jmp? repeat ?? MAIN ENDP sort PROC NEAR ?push cx ?push si ?sub? si,2H s: ?add? si,2H ?mov? dx,mem[si] ?mov? mem[si+2],dx ?loop s return: ?pop si ?pop cx ?ret sort ENDP END start ........