我刚接触C64的汇编语言编程,我有一个关于保存和加载内存区的过程的问题。我对以下几点表示关注:
lda #$01
sta $0400将字母A放在屏幕的左上角
ldx #$00
lda #$01
sta $0400, x有了这个,我可以使用x寄存器作为计数器,并可以比较我使用循环的频率。
但是现在我有了一个16位的计算(屏幕起始地址加上xxx),并将结果存储在一个内存地址中,比如$4000和$4001。如何使用此值作为新的屏幕地址,在屏幕上的计算区域上打印字母a?
发布于 2020-09-21 01:46:38
好了,现在我明白了(间接),Y的意思了。我的解决方案现在看起来是这样的:
.var lines = $28 //40 characters
.var currentPos = $fd //save screen address
calcLine:
ldx #$05 //counter 5 backward
ldy #$00 //Sets carry to 0
lda #lines //A=40
asl //A=80
calc:
clc
adc #lines //A=120 (or $78 in hex)
bcc next //If carry, then increase
iny
next:
dex
cpx #$00
bne calc
sta currentPos //If carry, then increase
sty currentPos+1 //Save value if carry
//add screen start address ($0400)
clc
lda currentPos+1
adc #$04
sta currentPos+1
lda #$42 //the sign
sta (currentPos),y https://stackoverflow.com/questions/63976732
复制相似问题