Smooth text scroll in Screen 5.

페이지 1/3
| 2 | 3

By Pippo

Hero (521)

Pippo의 아바타

27-10-2016, 15:23

Hello everyone,
I would want to make a very simple smooth Screen_5 text scroll in Assembler.
Please, how can I speed the Vdp up just like many demo disks for Msx?
Thanks a lot for your precious help.

Login or 등록 to post comments

By Sandy Brand

Champion (295)

Sandy Brand의 아바타

27-10-2016, 20:51

It completely depends on what you want to do Smile

The MSX VDP has no proper support for horizontal scrolling. The trick that the demos and games do is to use VDP register 18 to move the screen 16 pixels in either the right or left direction (this corresponds to SET ADJUST in BASIC). And in the mean time you will need to copy the front page 16 pixels leftwards or rightwards into the background page, build the next column of 16 pixels cells on the backpage and then loop.

The hard part of doing this in screen 5 is to erase and copy the left and right borders on the front page in time to keep the screen 'stable'.

If you only want to scroll big text on the screen (with a 'big' font), then you might want to consider doing this in screen 4.
You can get much higher speeds and make it look really smooth (even up to 60 frames per second). The concept is more or less the same, but you may need to add sprites on the left and right side in order to mask the borders.

By Pippo

Hero (521)

Pippo의 아바타

28-10-2016, 07:12

Thank you for your kindness.
However, I think it isn't the only way. Smile

By Manuel

Ascended (19273)

Manuel의 아바타

28-10-2016, 07:54

Why do you say that?

By Kai Magazine

Paragon (1423)

Kai Magazine의 아바타

28-10-2016, 09:50

On screen 5, if you just want a small line text scrolling while the rest of the screen is still (or animated, or whatever) you could use a fast copy command (HMMM) to scroll that particular area.
On screen 4 you can also scroll a small area by redefining characters, so the rest of the screen remains still.
You can also superimpose a text scroll made with hardware sprites, but considering the limit of hw sprites per line is 8, you will have to use some trick to avoid that limitation such as making the text bounce or make it go from the bottom-right part of the screen to the top-left part of the screen.

By Pippo

Hero (521)

Pippo의 아바타

28-10-2016, 12:04

Dear Manuel,
I said that because there are other methods, I thought. Smile

---

Dear Oscar,
I am not an expert (like you). Smile
Please, can you kindly show me, if possible, a little Screen_5 HMMM example in Assembler?
Thank you very much.

By Latok

msx guru (3925)

Latok의 아바타

28-10-2016, 21:44

; write value to vdp register
vdp_set macro register, value
	ld a,value
    out (#99),a
    ld a,register+128
    out (#99),a
    endm

; check if vdp is ready for new command
vdp_wait macro
    push af
    ; selecteer s#2
    vdp_set 15,2
    nop
.vdp_loop
    in a,(#99)
    rra
    jp c,.vdp_loop
    pop af
    endm

; inputs command registers #32-#46
vdp_command macro
    vdp_set 17,32
    ld c,#9b
    vdp_wait
        rept 15
        ; 15x outi = 21% faster than otir (grauw)
        outi
        endm
    endm

demo8
    ; enable interrupts
    ei
    nop
    ; wait for last interrupt
    halt
    ; disable interrupt
    di
    ; enable screen
    vdp_set 1,%01100000

    ld hl,copyscroll8
    vdp_command

    ld a,(slowdown8)
    xor 1
    ld (slowdown8),a
    jp z,noletter8

    ld de,(textpos8)
    ld a,(de)
    cp 255
    jp z,part2 (part 2 is the expanding bigger scroll in No Pressure)

    ; select next character
    inc de
    ld (textpos8),de
    sub 65
    ld b,a
teller
    add a,7
    djnz teller

    ld (copyletter8),a

    ld hl,copyletter8
    vdp_command

noletter8
    ; set s#0
    vdp_set 15,0
    jp demo8

copyscroll8 db 4,0,90,0,0,0,90,0,252,0,8,0,0,0,208
copyletter8 db 0,0,64,1,248,0,90,0,8,0,8,0,0,0,208
textpos8    dw text8
slowdown8   db 0

text8
    db "[[[[[[[[[flying[bytes[proudly[presents\\\\\\\\\\\\"
    db "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[no[pressure[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[an[entry"
    db "[to[the[first[edition[of[the[[[[[[[[[[[err\\\\\\\\[[[[[[[[[[latok\\\\\\\\[[[[[[[[["
    db "[[[[[[[[[[[[[[[[[[[[[[[yes[snout\\\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[err\\\\\\\\[[[[[[[[[[[[[[[[[[where"
    db "[is[the[hash[character\\\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "well[snout\\\\\\[[[[[[[[[[[we[do[not[have[one\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "[[[[[arf\\\\\\[[[[[[[well\\\\\\\\\\[[[[[[[okay\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "[[[[an[entry[to[the[first[edition[of[the[[[[[[hash[[[[[msxdev[competition"
    db "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[so\\\\\\\\\\[[[[[[[[[[[[[[[[[do[you[guys[like[this["
    db "absolutely[smooth[scroller[[[[[[[[[[[[[[[[[[["
    db "[[[[[[[[[[[[[it[is[our[very[first[assembly[project["
    db "ever\\\\\\[[[[[[[[[[[[[[[[[[[and[we[think[it[is[the["
    db "best[thing[flying[bytes[released[in[the[past"
    db "[fifteen[years\\\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "it[is[also[the[only[thing[we[released[in[fifteen[years[[[[[[[["
    db "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "wait\\\\\\\\\\\\[[[[[[[[[[[i[think[we[even[can[do[a[little[bit"
    db "[better[than[this\\\\\\\\\\\\\\\\[[[[[[[[[[[[[[[[[[[[[[[[[["
    db "hang[on\\\\\\\\\\\\[[[[[[["
    db "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["
    db 255

This is the asm to the first scroller in our No Pressure demo. Please don't mind the [ instead of SPACE in the text8 definitions. We improved this later in the No Pressure sources, but for the first scroller, we just kept this code, as it worked Smile I extracted all the necessary macros and definitions. For compiling we used Grauw his GLASS compiler. If you want the scroller to bounce, I suggest you do a screen split. Then with register #23 you can do a nice bounce. To do a screen split I suggest polling using this library source:

; FB Lib v0.1.0
; Sander Zuidema, Anne Geert de Raad
; MIT License, Flying Bytes, 2014-2015

; waits for vdp to reach line 


; requires 	di
; changes  	a
;			vdp status register
	
vdp_line_wait_polling macro line, ?vdp_status
		
	if ?vdp_status != 1
		vdp_register_write 15,1 	; first set status register
									; needs at least 1 t-cycle
									; before it can be read via #99								
	endif

	ld a,line
	vdp_register_write 19,a
.horizontal_scan_loop
	in a,(#99)					; reads current status register
	
	rra							; checks if horizontal scan
								; interrupt flag (FH) is set
	
	jp nc,.horizontal_scan_loop	; loops when vdp is not yet scanning
								; line 
	endm

; vdp R#19		interrupt line register
; 				should contain the line (0-255) to wait for

; vdp R#15		status register pointer
; S#1 bit 0		horizontal scan interrupt flag (FH)
; 				0 - vdp is not scanning line 
;				1 - vdp is scanning line 
;					note: instantly sets FH to 0

I hope it is of any use to you Smile

By Pippo

Hero (521)

Pippo의 아바타

28-10-2016, 19:39

Thank you very, very much, Latok.
You have been extremely, extremely kind.
You must be a very GREAT MAN!
I will not forget your BIG favor!
Thank you again. Smile

By Latok

msx guru (3925)

Latok의 아바타

28-10-2016, 21:54

If you want to understand the data in copyscroll8 and copyletter8 you have to know how to give the VDP commands. I suggest you download the V9938 Programmers Guide and start reading from page 63. In our source we use HMMM which is being explained from page 71 and onwards.

By Manuel

Ascended (19273)

Manuel의 아바타

28-10-2016, 23:50

Oh, yes, he IS a great man!

Quote:

I said that because there are other methods, I thought. Smile

That's fine, but it sounds quite weird. You ask 'how to do this and that'. Someone replies with a good answer. Then you say "I think it isn't the only way". So, you expected something else? Why didn't you say that, then? What kind of method were you looking for?

By Latok

msx guru (3925)

Latok의 아바타

29-10-2016, 00:36

@Manuel: Sandy proposed a full screen scroller using register #18 while Pippo asked for a text scroller. I guess that's why Pippo reacted that he thinks there are other methods. I think Pippo just intended to give a nice reaction on Sandy his efforts Smile

페이지 1/3
| 2 | 3