1

I have this part of code where all text lines come to the screen at once. Now I want for each lines to come on the screen from the other side (ie. first line from left, second from right etc.). Can anyone help?

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

I tried with some change here..

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

and again here...

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 "! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  !"
7
  • Clarified the title (I hope). Formatted code. Commented May 15, 2019 at 21:26
  • 1
    I'll never not upvote attempts to program on the C64! You might want to post this on Retrocomputing if you don't get good answers here. Commented May 15, 2019 at 21:57
  • 1
    @fuz This question was also posted to Retrocomputing, but was deleted by OP. It wasn't on-topic there because it was (essentially) a generic programming question, not specific to retrocomputing. Commented May 21, 2019 at 8:07
  • @simun9 It would be great if you could explain what you're trying to accomplish; as it stands your question is essentially a page of assembly. We can't really see what's going on. My first though is there's some kind of animation or a scrolly thing, but I'm not sure. So first thing is to explain what you want to know. Commented May 21, 2019 at 8:10
  • @Wilson: I want each line come to screen one by one instead of all at same time. Commented May 21, 2019 at 12:16

2 Answers 2

0

I'm copying my solution below. I think it is self explanatory.

counter must be set to zero before jumping to MoveTextIn

MoveTextIn
shiftRight      ldx #$00
                lda textLines1+(0*40),x
                sta $0400+(0*40),x
                lda textLines1(2*40),x
                sta $0400+(2*40),x
                lda textLines1(4*40),x
                sta $0400+(4*40),x

                inx
                cmp #$40
                bne shiftRight

shiftLeft       lda textLines1+(1*40),x
                sta $0400+(1*40),x
                lda textLines1(3*40),x
                sta $0400+(3*40),x
                lda textLines1(5*40),x
                sta $0400+(5*40),x

                dex
                bne shiftLeft

copyRight       ldx counter
                lda textLines1+(1*40),x
                sta $0400+(1*40)-1
                lda textLines1+(3*40),x
                sta $0400+(3*40)-1
                lda textLines1+(5*40),x
                sta $0400+(5*40)-1

copyLeft        sec
                lda #$40
                sbc counter
                tax
                lda textLines1+(0*40),x
                sta $0400+(0*40)-1
                lda textLines1+(2*40),x
                sta $0400+(2*40)-1
                lda textLines1+(4*40),x
                sta $0400+(4*40)-1

                inc counter
                lda counter
                cmp #$40
                beq textMoveDone
                rts

textMoveDone    inc state
                rts
Sign up to request clarification or add additional context in comments.

Comments

0

Ok, thank you all. I found answer:

One possibility would be having counter that go from 0 to 240, and it would be updated once a frame adding +1 to it....

if value be 0 - 39 it would move line 1 and calculate locations it needs to put text to screen if value be 40 - 79 it would move line 2 + same ... if value be 200 - 239 it would move line 6 + same if value be 240, all moving has been done...

Other way would be to have counter that go 0..40 and when 40, it adds linecounter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.