I have started learning a little assembler of the past few months so that I can enhance my BASIC programming. As an exercise, I am trying to recreate the sort of scroll employed in Konami's Road Fighter. The task is therefore to create a routine which scrolls the lefthand 22 characters of 24 lines of a 30 character width Screen 1.
Being a total ASM noob, I have managed to produce the following, which works:
ROWLEN EQU 22
VRMADR EQU 6144
ORG $D000 ; Start Address
JP SCROLL ; &HD000
LD HL,VRMADR+705 ; Set VRAM address
LD C,23 ; Set Counter (screen rows)
PUSH BC ; Preserve counter
LD HL,[TARGET] ; Calc Address
LD HL,[TARGET] ; Copy RAM block back to VRAM 1 row lower
LD HL,[TARGET] ; Move address up 1 row
POP BC ; Restore counter and check for end of loop
DS 32 ; Reserve [V]RAM Space
DS 4 ; Current MOVEBL Address
I call it from BASIC like this:
Is there is a better/faster way of doing this?
Of course it can be faster, but the code is only good if you understand it yourself. Optimizations by an asm expert will only make you feel lost. So unless this is for a game you're making that needs this part to be optimized, just leave it be.
Keep on learning.
cool idea you got there
what about using 8 vram pages,
in each consecutive page you use the same tiles, but scrolled down 1 pixel compared to the previous page.
and then simulate the scroll by swapping pages (and replace tiles that need to be replaced).
you would still have to read out the mapdata in ram and copy all the tiles each frame,
but hey that will really speed up your routine...
unless it's only a sc4 thing... I don't know sc2 specs that well.
oh yeah one more thing. the:
rewrite it into your own routine, it can always be optimised
e.g. setting vdp address and set write and using oti instead of otir.
If you have the complete level data in memory (as is the case with Road Fighter), you wont need to read from VRAM anymore. You just write all the data to VRAM and once your screen is full, just repeat it but starting from one row lower in memory.
Don't you have an account yet? Become an MSX-friend and register an account!
MSX2 Seikima2 Special Japan (FGBR4
Sony Memory Stick PRO Duo, 1GB (MSX-M1GN)
Bothtec's space-war simulation "Ginga Eiruu De ...
Moon Patrol Cartridge for MSX - Import MSX Brazilia ...