初学汇编,各位进来看看~!
本人看王爽的汇编语言一书学习汇编的,做到第七章一个练习时,出现问题。编程:将data段中每个单词的前四个字母改为大写字母
assume cs:code,ds:data,ss:stack
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
data segment
db '1. display '
db '2. brows '
db '3. replays '
data ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,16
mov ax,data
mov ds,ax
mov cx,3
mov bx,0
s1: push cx
mov cx,4
mov si,4
s2: mov al,[bx+si]
and al,11011111b
mov [bx+si],al
inc si
loop s2
add bx,16
pop cx
loop s1
mov ax,4c00h
int 21h
code ends
end start
而我觉得栈太大了,浪费了,就将栈改小了,DEBUG却出错了
assume cs:code,ds:data,ss:stack
stack segment
dw 0,0 //原来是dw 0,0,0,0,0,0,0,0
stack ends
data segment
db '1.display'
db '2.brows'
db '3.replays'
data ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,4 //原来是16
mov ax,data
mov ds,ax
mov cx,3
mov bx,0
s1: push cx
mov cx,4
mov si,4
s2: mov al,[bx+si]
and al,11011111b
mov [bx+si],al
inc si
loop s2
add bx,16
pop cx
loop s1
mov ax,4c00h
int 21h
code ends
end start
还请高手指点迷津
[[it] 本帖最后由 限量版猪头 于 2008-5-7 12:38 编辑 [/it]]