Banner Scroll with Screen Wrap

Par Chilly Willy

Rookie (30)

Portrait de Chilly Willy

30-12-2020, 01:50

Does anyone have a formula for scrolling text or any pattern that will scroll the bottom of the screen and wrap around the other side in forward or reverse.

MSX 1, software scroll in Z80 assembly language.

I do not mean a repeating pattern.
While the pattern is leaving one side it shows up on the other side like a long snake chasing it's tail.

I can set up the patterns and graphics mode but no matter what I do or change the pointers my "snake" will go out one side then advance to the next row.
the snake is a basic set of characters such as
Snake:
DB 00,09,10,10,10,10,10,10,10,11,00

patterns are currently defined as
00 is blank
09 is snake end
10 is the body
11 is the head

!login ou Inscrivez-vous pour poster

Par santiontanon

Paragon (1222)

Portrait de santiontanon

30-12-2020, 04:12

There are two easy ways to do what you want:
1) The easiest:
- Make sure your pattern is of length 32 bytes (which is the width of the screen in patterns)
- Have your pattern twice in your assembler file (so, 64 bytes, with the second 32 bytes being identical to the first 32)
- You then just copy 32 bytes to the screen, starting from the position 0, then in the next frame, from the position 1, in the next one from position 2, etc. once you reach copying 32 bytes starting from position 31, then you go back to position 0, and that's it.
2) Another method (a bit better), is to have the pattern only repeated once (so, only 32 bytes). But then you need to split your copy routine into two parts in order to simulate the "wrapping around" (which was simulated in the previous method by having the pattern repeated twice)

I hope that helps Smile

Par Chilly Willy

Rookie (30)

Portrait de Chilly Willy

30-12-2020, 04:33

Thank you so much for the input.
I have tried and tried and tried.

I guess I am not as cool at programing as I thought.
What you seem would be simple in BASIC then you try in assemble.

I would not ask if I haven't tried for a couple weeks now but if you have a sample source code that is similar to what I am looking for that would go a long ways to identify my mistakes.

Teach a guy how to fish sort of thing.

I used to read old Family Computing magazines and learned basic by typing in the programs.
To learn Assembly better I need something similar.

Par Manuel

Ascended (17513)

Portrait de Manuel

30-12-2020, 10:53

Did you already try to program it in basic?

Par Chilly Willy

Rookie (30)

Portrait de Chilly Willy

30-12-2020, 17:43

I am using Assembly language.
Basic is too slow for the entire game that I am attempting to make.

Par Manuel

Ascended (17513)

Portrait de Manuel

30-12-2020, 18:13

yes, but it helps you to prototype what you want. If it works (but slowly), you know the algorithms involved and what kind of VDP instructions you need.

Par albs_br

Master (199)

Portrait de albs_br

30-12-2020, 21:30

Manuel wrote:

yes, but it helps you to prototype what you want. If it works (but slowly), you know the algorithms involved and what kind of VDP instructions you need.

Indeed. That's a good approach. Actually my very first assembly routine,t he scrolling inside a tile (the sea animation on Pacific), was made in Basic (VPOKEs and VPEEKs) and the converted to assembly.
It worked on the first try. As I forgot to add a delay routine, it worked so fast that looked broken...

Par Chilly Willy

Rookie (30)

Portrait de Chilly Willy

01-01-2021, 19:47

Somehow I can not make the correlation between Z80 assembly language and basic.
BTW, I haven't a clue about any basic on the MSX.
I learned basic on the Apple 2 line of computers.
I have been learning Z80 assembly lately and this is just a stumbling block I asked for help with.

I don't have too many issues setting up and small time routines but for some reason just a scrolling banner with screen wrap has been complicated.

Par Metalion

Paragon (1319)

Portrait de Metalion

01-01-2021, 20:51

Well your problem starts there: you have no idea how MSX works, since you don't know the specifics of it. Therefore it's complicated to program something. Knowing the langage is only the first step, the second one being to know the system ...

Making a text banner wrap is reallly not difficult once you know how to print stuff on screen.
Start there: print (display) something, and then learn how to play around with the pointer to your text.
I'm sure the rest will follow.

Par santiontanon

Paragon (1222)

Portrait de santiontanon

01-01-2021, 20:52

Ok, here's some example code on how to do it (just compile this to a ROM and run it). I assumed Screen 1, but the same should work in other tile-based video modes. I used the first simple method I mentioned above. I hope it helps Smile

CHGMOD: equ #005f
LDIRVM: equ #005c
NAMTBL2: equ #1800   

    org #4000
    db "AB"     ; ROM signature
    dw Execute  ; start address
    db 0,0,0,0,0,0,0,0,0,0,0,0

Execute:
    ld a,1      ; Change screen mode
    call CHGMOD

loop:
    ld b,32
    ld hl,snake
loop_internal:
    halt
    push hl
    push bc
        ld de,NAMTBL2
        ld bc,32
        call LDIRVM
    pop bc
    pop hl
    inc hl
    djnz loop_internal
    jr loop


snake:
  db "------HEAD====BODY====TAIL------"
  db "------HEAD====BODY====TAIL------"