简体   繁体   English

DOS 16位ASM如何将数据保存在内存中?

[英]How data saved in memory DOS 16 bit ASM?

I am new to ASM.我是 ASM 的新手。 I have question regarding how data saved in memory.我有关于数据如何保存在内存中的问题。

Here is my ASM 16 bit code这是我的 ASM 16 位代码

;db.com
.model small
.code
org 100h
start:
jmp proses
A db '123'
B dw 0abcdh
proses:

int 20h
end start

Then I try to debug with -d command然后我尝试使用-d命令进行调试

在此处输入图片说明

The above picture shown that A variable in correct order in hexa value, but B variable in CD then AB .上图显示A变量在 hexa 值中的顺序正确,但B变量在CD然后是AB

My question is why data in A variable saved differently with B variable can you please explain me?我的问题是为什么A变量中的数据与B变量的保存方式不同,请解释一下?

x86 is using little endian, so word will be stored as low-byte, high-byte and dword as low-word, high-word x86 使用小端,因此word将存储为低字节、高字节dword作为低字、高字

0x1020 will be 0x20 0x10 in memory 0x1020在内存中将是0x20 0x10
and 0xabcd1234 will be 0x34 0x12 0xcd 0xab并且0xabcd1234将是0x34 0x12 0xcd 0xab

by defining db <string> you order the assembler to use the string as a sequence of bytes, and each byte is stored in the same order, one by one通过定义db <string>你命令汇编程序使用字符串作为字节序列,每个字节都以相同的顺序一个一个地存储

so eg所以例如
db '012345",13,0 will be 0x30 0x31 0x32 0x33 0x34 0x35 0x0D 0x00 db '012345",13,0将是0x30 0x31 0x32 0x33 0x34 0x35 0x0D 0x00

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM