ATARI-2600应用负HMP0值时精灵渲染故障求助
ATARI-2600应用负HMP0值时精灵渲染故障求助
各位搞ATARI-2600开发的大佬们,我最近碰到个棘手的问题,想请大家帮忙看看!
先给大家铺垫下背景:当把一个字节存入TIA的HMP0寄存器时,会对精灵的粗光束位置做精细调整。Stella手册里明确说这个值的范围是-8到7,其中-8对应二进制1000,7对应0111,因为这个半字节是按补码来读取的。
但我现在遇到的问题是,只要给HMP0设置负的精细位置值,精灵就完全渲染不出来。我做了个测试Demo:大家可以看精灵0的对角线效果,这是每一行通过HMOVE偏移得到的,但只要偏移值的高位是1(也就是负数),那一行的精灵就直接消失了,屏幕上啥都没有。对比之下,精灵1因为没加任何精细位置调整,在整个屏幕上就是一条完整的直线,完全正常。
下面是我写的可见行循环代码:
ScanLoop REPEAT 10 ; wait to nop ; get beam REPEND ; arbitrarily near center ; All we do here is ++ the hi nibble in the Accumulator ; and apply it to HMP0 to adjust the fine position. ; QUESTION FOR READER: WHY DOESN'T THE SPRITE RENDER WHEN ; THE VALUE EQUATES TO A NEGATIVE VALUE (-7...-1?) clc adc #%00010000 ; Add (UI) '1' to high nibble in A sta HMCLR ; Due diligence - clear all Motion values sta HMP0 ; Set fine P0 Sprite pos to incremented value (*) sta RESP0 ; set coarse position of P0 Sprite sta RESP1 ; Set coarse position (only) of P1 Sprite sta WSYNC ; Wait for next scanline sta HMOVE ; Apply fine tweak stx COLUBK ; Set the background color dex ; decrement the scanline bne ScanLoop ;(*)PS: Tried putting HMP0 after RESP's, didn't help
我还特意试过把HMP0的赋值语句移到RESP指令之后,结果还是一样,没解决问题。真心希望有经验的大佬能指点下,为啥负的精细位置值会导致精灵消失呢?
备注:内容来源于stack exchange,提问作者Quinn Carver
相关产品推荐
相关产品推荐

