平台
assembler
我的数字是从
#2
2F美元
%0000111
我不明白为什么在6502?的汇编代码中使用#$%
有时ldx #$FF
用#$FF加载x寄存器
为什么这里使用两个符号?
发布于 2021-06-22 07:42:30
DASM允许用二进制、八进制、十进制和十六进制表示数字。
二进制数字使用%1101).
015).
0前缀(例如,015).
13).
$前缀(例如,$0D).)
#符号用于指定即时寻址:
LDA 0 ; Load the byte from address 0 in memory into register A
LDA #0 ; Load the value 0 into register A当然,可以将即时寻址与不同的数字基结合起来,例如:
LDA #$FF ; Load the value $FF into register A发布于 2021-06-22 05:42:18
这些符号是许多汇编程序在许多平台上使用的常用语法糖,其目的是使人类更容易在2、10和16 (二进制、十进制和十六进制)的基础上向汇编程序提供数值:
%00001100 means 12 in binary
12 means 12 in decimal
$0C means 12 in hexadecimal#符号作为许多程序集语法中寻址的指示符,包括DASM,还有更重要的意义:
LDA #%00001100 loads 12 into the Accumulator
LDA #12 loads 12 into the Accumulator
LDA #$0C loads 12 into the Accumulator
LDA $0C loads the contents of memory location 12 into the Accumulatorhttps://stackoverflow.com/questions/68077785
复制相似问题