NES(6502组装)精灵运动 [英] NES(6502 assembly) Sprites movement
问题描述
我目前正在开发NES(6502)组装游戏,但我不了解如何进行精灵移动。在这里,我认为它应该起作用:
I am currently working on a NES(6502) assembly game but I dont understand how to make a sprite move.Heres how I think its supposed to works:
(loop)
LDA $200 ;will load into the A register the content of address $200,wich contain the Y postion of my sprite
INA ;Increment the A register wich would increment the content of A wich is the Y position of my sprite..?
但是,您似乎无法递增A寄存器累加器,因为在尝试汇编时出现错误INA指令..所以我有点迷失了。我应该使用STA而不是LDA吗?但是我想使用地址$ 200的内容,而不要放置我选择的值。我不知道如何使我的精灵移动。
However it seems that you cannot increment the A register accumulator because I get an error when trying to assemble with the INA instruction..So Im a bit lost into that.Should I use STA instead of LDA? But I want to use the content of the address $200 and not place a value that I choose in it.I dont get how to make my sprite move.
谢谢!
推荐答案
实际上,对于在以下版本中使用的6502变体,没有 INA
NES。您可以按照以下说明将 A
加1:
There's indeed no INA
available on the variant of 6502 used in the NES. You can increment A
by 1 using the following pair of instructions:
CLC ; Clear carry
ADC #1 ; A = A + 1 + carry = A + 1
或者,如果其中一个索引寄存器为空您可以使用:
Or, if either of the index registers are free you can use:
LDX $200 ; or LDY
INX ; or INY
但是请记住,其他算术运算,例如 ADC
, SBC
, LSR
等,无法在<$ c $上执行c> X 或 Y
。
Keep in mind, though, that the other arithmetic operations like ADC
, SBC
, LSR
, etc, can't be performed on X
or Y
.
这篇关于NES(6502组装)精灵运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!