首页 > 解决方案 > 如何在 2 列中显示交替的文本行?

问题描述

我有这部分代码,所有文本行都同时出现在屏幕上。现在我希望每一行从另一侧出现在屏幕上(即左起第一行,右起第二行等)。任何人都可以帮忙吗?

Start                   SEI
                        LDX #$01
                        STX $0286
                        DEX
                        STX $D020
                        STX $D021
                        JSR $E544

mainLoop               LDA #$FA
waitRaster             CMP $D012
                        BNE waitRaster
waitRaster2            CMP $D012
                        BEQ waitRaster2

                        LDA #$0F
                        STA $D020
                        JSR UpdateThings
                        INC $D020
                        JMP mainLoop

UpdateThings        ; is state 0 ?
                        LDA State
                        BNE nextState
                    ; yes, call Move Text to Screen routine
                        JSR MoveTextIn
nextState              RTS

我在这里尝试了一些改变..

MoveTextIn              LDX 02
                        LDY Counter
loop                   ; LDA TextLines1+(1*40),x
                       ; STA $0400+(1*40),X
                        LDA TextLines2+(1*40),y 
                        STA $0400+(1*40),X
                       ; LDA TextLines+(5*40),Y 
                       ; STA $0400+(5*40),X
                        INX 
                        INY
                        CPY #$28
                        BNE loop
and there....
                       ; LDX #$27
                        TXA
                        SEC 
                        SBC Counter
                        TAY

又在这里...

loop2                   ;LDA TextLines1+(0*40),x
                        ;STA $0400+(0*40),X
                        LDA TextLines2+(0*40),y 
                        STA $0400+(0*40),X
                        ;LDA TextLines+(4*40),Y 
                        ;STA $0400+(4*40),X
                        DEX 
                        DEY
                        BPL loop2

                        LDA Counter
                        BEQ TextMoveDone

                        DEC Counter
                        RTS
TextMoveDone            INC State
                        RTS

State                   !byte 0

Counter                 !byte $10

TextLines1              !scr "!x-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-xx!"
TextLines2              !scr "!x      commodore master soft         x!"
                        !scr "!        -------------------           !"
                        !scr "!         somewhere in 2019.           !"
                        !scr "!          ----------------            !"
                        !scr "! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  !"

标签: assemblyc64

解决方案


好的,谢谢大家。我找到了答案:

一种可能性是让计数器从 0 变为 240,并且一旦帧添加 +1,它就会更新......

如果值为 0 - 39,它将移动第 1 行并计算需要将文本放到屏幕上的位置 如果值为 40 - 79,它将移动第 2 行 + 相同...如果值为 200 - 239,它将移动第 6 行 + 相同如果值为 240,则所有移动都已完成...

其他方法是让计数器变为 0..40,当 40 时,它会添加 linecounter。


推荐阅读