流浪南中国 发表于 2012-2-20 23:57:23

习题P6.1的答案,自己做的不知道对不对,请大家指导下



自己做的习题P6.1 ,DEBUG测试没有问题,结果也对,但是自己不敢确定到底对不对,希望鱼友帮助我下,指导下,多谢
P6.1A
assume cs:codesg
   
codesg segment
      dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
start: mov ax,0
       mov ds,ax
       mov bx,0
   
       mov cx,8
   s:mov ax,
    mov cs:,ax
       add bx,2
      loop s
      mov ax,4c00H
      int 21h
   
codesg ends
end start


习题P6.1B

assume cs:codesg
   
codesg segment
      dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
   dw 0,0,0,0,0,0,0,0,0,0
start: mov ax,0
       mov ss,ax
       mov sp,32
   
    mov ax,0
    mov ds,ax
    mov bx,0
       mov cx,8
   s:push
    pop cs:
       add bx,2
      loop s
      mov ax,4c00H
      int 21h
   
codesg ends
end start


流浪南中国 发表于 2012-2-21 10:08:49

自己顶自己

莫名其妙 发表于 2012-2-24 20:49:09

mov sp,32 这里是368个字形+10个字形 是0-35 sp的值要在加1才是栈顶地址

菜鸟学汇编 发表于 2012-3-6 11:31:23

楼上说的是第二题栈顶地址应该是32.
你的第二个程序数据段地址和栈的段地址是一样的,这样程序不能运行,第一个空应该填写为cs。
页: [1]
查看完整版本: 习题P6.1的答案,自己做的不知道对不对,请大家指导下