注册 登录
编程论坛 汇编论坛

栈顶到底该是多少?

aikongfu 发布于 2012-09-09 13:12, 462 次点击
程序代码:

assume cs:codesg
codesg segment
    dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
    dw 0,0,0,0,0,0,0,0
   
    start:    mov ax,cs
        mov ss,ax
        mov sp,32  ;为什么栈顶便宜地址为32,不是应该为20h吗?
        mov bx,0
        mov cx,8
    s:    push cs:[bx]
        add bx,2
        loop s
        mov bx,0
        mov cx,8
    s0:    pop cs:[bx]
        add bx,2
        loop s0
        
        mov ax,4c00h
        int 21h        
codesg ends
end start

代码如上,是王爽《汇编语言》第六章6.2节的代码,编写的时候不是应该为16进制吗?16进制的32应该为(20h)吧,书上源代码应该是错误的吧?
3 回复
#2
zklhp2012-09-09 13:13
masm默认的进制是10进制 如果不说 就认为是10进制 当然有个伪指令可以改
#3
有容就大2012-09-09 13:20
结尾没h, b, o什么的就默认是d 十进制数 32 也就是 20h 啊
#4
aikongfu2012-09-09 13:23
原来是这样啊,谢谢
1