汇编程序题(汇编高手速进)

来源:百度知道 编辑:UC知道 时间:2024/07/07 01:04:20
我们老师留了两道题,我学的不好,希望高手能帮我把程序编写出来。
1。用十进制数输出一个按键的ASCII码值。(必须是十进制数显示)
2。在数据段中有如下数据区,统计该数据区中正数,0,负数的个数,
var db 2, -3,0,5,-7,0,0,8,6,-9.
需要完整程序段,最好有讲解,方便我看懂,最好程序方法比较简单。运行无错。

以下代码均经emu8086仿真软件运行无错。
第一题:
data segment
num db 48,49,50,51,52,53,54,55,56,57
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov bx,offset num
mov ah,01h
int 21h
mov dl,al
mov dh,al
mov cl,4
shr dh,cl
mov al,dh
mov cl,16
mul cl
and dl,0fh
add al,dl
mov cl,100
div cl
push ax
mov ah,0
mov di,ax
mov dl,[bx+di]
push dx
mov dl,20h
mov ah,02h
int 21h
pop dx