1、要求程序从键盘获取一个字符,并判断这个字符的类型是:大写字母、小写字母、数字或其他符号并显示出来,当输入符号$时程序结束
程序如下:
dseg segment
msglf db 0ah, 0dh, '$'
msgup db 'a big character.', 0ah, 0dh, '$'
msglo db 'a small character.', 0ah, 0dh, '$'
msgnum db 'a digit characgter.', 0ah, 0dh, '$'
msgot db 'other character.', 0ah, 0dh, '$'
dseg ends
2、cseg segment
assume ds:dseg, cs:cseg
begin:
mov ax, dseg
mov ds, ax
mov ah, 1
int 21h
mov bl, al
lea dx, msglf
mov ah, 9
int 21h
mov al, bl
cmp al, '0'
jl OtherC
cmp al, '9'
jg NotNum
lea dx, msgnum
jmp Output
NotNum:
cmp al, 'A'
jl OtherC
cmp al, 'Z'
jg NotUp
lea dx, msgup
j
3、mp Output
NotUp:
cmp al, 'a'
jl OtherC
cmp al, 'z'
jg OtherC
lea dx, msglo
jmp Output
OtherC:
lea dx, msgot
Output:
mov ah, 9
int 21h
mov ah, 4ch
int 21h
cseg ends
end begin
2、用汇编,编写程序计算1+2+3+4+........+100并将结果显示在屏幕上
code segment
assume cs:code
start:
mov ax,code
mov ds,ax
4、
lea dx,mes
mov ah,9
int 21h
xor ax,ax
mov cx,100
add ax,cx
loop $-2;当前地址减去2就是上一条指令
xor cx,cx
mov bx,10
Q0:
xor dx,dx
div bx
or dx,0e30h
inc cx
push dx
cmp ax,0
jnz Q0
Q1:pop ax
int 10h
loop Q1
mov ah,1
int 21h
mov ah,4ch
int 21h
mes db '1+2+3+4+...+100=$'
code ends
end start