- [游客] 如果不加ds:就是相当于一下的语句 mov al,16 mov al,17 mov al,18 10/31 00:12
- [chinatree] 编译器不错,支持@@了。当然程序也不错。 10/15 01:48
- [hitlerdsaf] 中间跳转的时候二级跳了,提示jump out of range ,我晕倒。二级跳显得非常不好看。唉 10/12 18:40
- [chinatree] 作业类型有编辑文章的功能,你可以修改下。 09/30 20:15
- [hitlerdsaf] 6、1 1 2 2 4 7、512 256 第6、7题答案更正 09/30 17:28
- [hitlerdsaf] MOV AL 02H ADD AL, AL ADD AL, AL ADD AL, AL 09/29 15:26
- [chinatree] 全对。 09/29 15:23
[2011-10-14 10:29] 实验十一
assume cs:codesg, ds:datasg
datasg segment
db "Beginner's All-purpose Symbolic Instruction Code.",0
datasg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov ax, 0B800h
mov es, ax
mov si,0
mov dh, 4
mov dl, 0
mov ch, 0
mov cl, 00000100B
call show_str
call letterc
mov si,0
mov dh, 5
mov dl, 0
mov ch, 0
mov cl, 00000100B
call show_str
mov ax,4c00h
int 21h
letterc:
push si
push cx
dec si
@@:inc si
mov cl, ds:[si]
mov ch,0
jcxz @F
cmp cl,'a'
jb @B
cmp cl,'z'
ja @B
and cl, 11011111B
mov ds:[si],cl
jmp @B
@@:pop cx
pop si
ret
;;function : show a string with 0 ended at certain position and color
;;dh--line no. dl--column no.
;;cl--color ds:si--the beginning of the string
;;return none
show_str:
push bx
push di
push ax
push si
push cx
;;calculate the first address of the string in video memory
mov al, dh
mov bl, 160
mul bl
mov bx, ax
mov ah, 0
mov al, dl
add bx, ax
add bx, ax
@@:
mov cl, ds:[si]
mov ch, 0
jcxz @F
mov es:[bx], cl
pop cx
mov es:[bx+1], cl
push cx
inc si
inc bx
inc bx
jmp @B
@@: pop cx
pop si
pop ax
pop di
pop bx
ret
codesg ends
end start
datasg segment
db "Beginner's All-purpose Symbolic Instruction Code.",0
datasg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov ax, 0B800h
mov es, ax
mov si,0
mov dh, 4
mov dl, 0
mov ch, 0
mov cl, 00000100B
call show_str
call letterc
mov si,0
mov dh, 5
mov dl, 0
mov ch, 0
mov cl, 00000100B
call show_str
mov ax,4c00h
int 21h
letterc:
push si
push cx
dec si
@@:inc si
mov cl, ds:[si]
mov ch,0
jcxz @F
cmp cl,'a'
jb @B
cmp cl,'z'
ja @B
and cl, 11011111B
mov ds:[si],cl
jmp @B
@@:pop cx
pop si
ret
;;function : show a string with 0 ended at certain position and color
;;dh--line no. dl--column no.
;;cl--color ds:si--the beginning of the string
;;return none
show_str:
push bx
push di
push ax
push si
push cx
;;calculate the first address of the string in video memory
mov al, dh
mov bl, 160
mul bl
mov bx, ax
mov ah, 0
mov al, dl
add bx, ax
add bx, ax
@@:
mov cl, ds:[si]
mov ch, 0
jcxz @F
mov es:[bx], cl
pop cx
mov es:[bx+1], cl
push cx
inc si
inc bx
inc bx
jmp @B
@@: pop cx
pop si
pop ax
pop di
pop bx
ret
codesg ends
end start
评论次数(0) |
浏览次数(312) |
类型(汇编作业) |
收藏此文 |