+ -
当前位置:首页 → 问答吧 → 求教一个声明初始化数据的问题,望个位大大解答

求教一个声明初始化数据的问题,望个位大大解答

时间:2011-02-02

来源:互联网

在SECTION .bss中 
INBUFF resb 100 ; keep the input char
base ; keep the input base
INBASE resb 1 ; keep the original base
OUTBASE resb 1 ; keep the output base
并未对base声明存储空间
但是代码里面,如下
convN:
  lodsb ;load buffer to al
  cmp al, 'q' ;if input is Q or q, end the program
  je endProg
  cmp al, 'Q'
  je endProg
  cmp al, 48 ;compare al with '0'
  jl input_err ;if al<0 throw to input error
  cmp al, 57 ;compare al with '9'
  jg input_err ;if al>9 throw to input error
  sub al, 48 ;subtrac al by 48, ascii->bin
  mov bl, al ;move input base in bl
  mov al, 10 ;mutiple [base] with 10 and add input number
  mul byte [base]
  add al, bl
  mov byte [base], al
  loop convN ;loop back to convN

base依旧可以存储数据,且运行的时候可以得出正确结果
请问各位大大,为什么base在这种情况下依旧可以正常???

作者: demonstar61   发布时间: 2011-02-02

这样的话,会不会讲数据十几储存在 INBASE里面?

作者: demonstar61   发布时间: 2011-02-02

上面说错了,不在INBASE里面,
 
前面有一个
 mov bl, byte [base]
 mov byte [INBASE], bl

但是程序运行的确正常,不知道为什么

作者: demonstar61   发布时间: 2011-02-02