June 28th Thursday (六月 二十八日 木曜日)

本文详细介绍了ARM汇编语言中用于分配和初始化内存单元的各种伪指令,包括DCB、DCW、DCD等,并解释了如何使用这些指令来指定不同类型的数据。此外,还介绍了如何定义宏及一些有用的运算符。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

   In ARM pseudo-instruction, some can be used to allocalte and initialize a block of memory units.

  DCB     -  to allocate a block of "byte" type memory units and to initialize them by specified data.
             DCB is also replaced by "=".

  DCW{U}  -  to allocate a block of "half-word"(two bytes) type memory units and to initialize them by specified data.
             if with "U", those allocated memory units is not aligned.

  DCD{U}  -  to allocate a block of "word"(four bytes) type memory units and to initialize them by specified data.
             if with "U", those allocated memory units is not aligned.  DCD is also replaced by "&".

  DCFD{U} -  to allocate a block of "double float" type memory units and to initialize them by specified data.
             if with "U", those allocated memory units is not aligned.

  DCFS{U} -  to allocate a block of "single float" type memory units and to initialize them by specified data.
             if with "U", those allocated memory units is not aligned.

  DCQ{U}  -  to allocate a block of "8 bytes" type memory units and to initialize them by specified data.
             if with "U", those allocated memory units is not aligned.

  SPACE   -  to allocate a block of sequential memory units an to initialize with 0.

  Format:  Label SPACE expression

  DataSpace SPACE 100

  MAP and FIELD
  MAP/^ expression{, base_register}
  The MAP is used to define a start address of a structure memory table.  If the "base_register" is ignored,
the value of "expression" is considered as the start address of a structure; otherwise, the start address of
a structure is the sum of the value of "expression" and the value of "base_register".

  MAP 0x100, R0

  Label FIELD/# expression
  The FIELD is used to define a data field in a structure.  The value of "expression" tell how many bytes
is occupied.  It usually is used with MAP.

  Notice:  The above twp pesudo-instruction just declare a structure and do not allocate memory.

  MAP 0x100
  A   FIELD 16  ; at 0x100
  B   FIELD 32  ; at 0x110
  S   FIELD 256 ; at 0x130

  How to define a macro?

  $Label Macro_name $arg1, $arg2, ...
   codes...
  MEND

  There is a MEXIT can escape out from a macro body.


  There are some useful operators.

  ?X
  The "?" can return the length of the executable from the expression "X".

  : DEF: X
  To test whether a symbol "X" is defined.

  : STR: X
  To convert a number expression or boolean expression into a string.  For number, the
"STR" just convert it to a hexadecimal numeric string; for boolean expression, convert
it to "T" or "F" string.

  X: LEFT: Y / X: RIGHT: Y
  To get a sub-string from the left or the right of "X", "Y" specify the number of
characters.

  X: CC: Y
  To append "Y" into "X".

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值