moving sprite character convert to assembler

Por gasparrini

Champion (329)

Imagen del gasparrini

03-09-2010, 00:36

Hello Guys and Gilrs of MSX systems,

For a long time, I have to convert these two basic programs
assembler.
The first animation shows the motion to 2 frames
made to do a sprite characters.
Second, there are two sprites of characters that move
inside a maze, but on this second program is
a bug, because just moving sprites are stuck!
Why should not pass over the wall, must move in the maze.

This project I need for gaming for Msx1, you know
Msx1 up, can not appear more than 4 sprites per line, a limit
Technical chip video Msx1, and to reveal many more sprites
on the same line, I did move a sprite 4 characters (16x16 pixels)
Does it seem like a good trick? ^ _ ^ Oh .. Oh .. O_o

What I ask is that these two programs must be converted
assembler to obtain a high speed, do it basic is crap!
See if you can solve the problem .....

For others info, write me at: andreagasparrini@yahoo.it

I will be very happy if any of you manage to solve my problem ^_^

first programm from converter in assembler with CHAOS ASSEMBLER

10 REM VPOKE SPRITE
20 REM be translated into assembler
30 REM to speed up character sprites
40 REM For videogames MSX-1
50 REM BY AGsoftware 2008
60 REM
70 SCREEN1,2:KEYOFF:COLOR15,1,1
80 CLEAR200:DEFINTA-Z
90 RESTORE100:FORA=128*8TO136*8-1:READB:VPOKEA,B:NEXTA
100 DATA 7,15,31,23,51,49,63,56,28,14,7,51,32,59,30,14
110 DATA 224,240,248,232,204,140,252,28,56,112,224,192,0,96,116,124
120 DATA 7,15,31,23,51,49,63,56,28,14,7,3,0,6,46,62
130 DATA 224,240,248,232,204,140,252,28,56,112,224,204,4,220,120,112
140 REM
150 VPOKE8208,10*16
160 X=15:Y=10:C=0
170 VPOKE6144+X+Y*32,128:VPOKE6144+X+1+Y*32,130:VPOKE6144+X+32+Y*32,129:VPOKE6144+X+33+Y*32,131
180 REM
190 GOSUB210
200 GOTO190
210 C=C+1:IFC>5THENC=0:GOTO220ELSEGOTO240
220 M=INT(RND(-TIME)*4+1)
230 Z=Z+4ANDZ<4
240 IFM=1THENX=X+1:GOSUB290:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X-1+Y*32,32:VPOKE6144+X-1+32+Y*32,32
250 IFM=2THENX=X-1:GOSUB290:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+2+Y*32,32:VPOKE6144+X+34+Y*32,32
260 IFM=3THENY=Y+1:GOSUB290:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+Y*32-32,32:VPOKE6144+X+1+Y*32-32,32
270 IFM=4THENY=Y-1:GOSUB290:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+Y*32+64,32:VPOKE6144+X+1+Y*32+64,32
280 RETURN
290 IFY>19THENY=19
300 IFY<1THENY=1
310 IFX>30THENX=30
320 IFX<1THENX=1
330 RETURN

Second Programm from converter in assembler with CHAOS ASSEMBLER

10 REM VPOKE SPRITE
20 REM be translated into assembler
30 REM to speed up character sprites
40 REM For videogames MSX-1
50 REM BY AGsoftware 2008
60 REM
70 SCREEN1,2:KEYOFF:COLOR15,1,1
80 WIDTH32:CLEAR200:DEFINTA-Z
90 RESTORE120:FORA=128*8TO136*8-1:READB:VPOKEA,B:NEXTA
100 RESTORE120:FORA=136*8TO144*8-1:READB:VPOKEA,B:NEXTA
110 RESTORE160:FORA=144*8TO145*8-1:READB:VPOKEA,B:NEXTA
120 DATA 7,15,31,23,51,49,63,56,28,14,7,51,32,59,30,14
130 DATA 224,240,248,232,204,140,252,28,56,112,224,192,0,96,116,124
140 DATA 7,15,31,23,51,49,63,56,28,14,7,3,0,6,46,62
150 DATA 224,240,248,232,204,140,252,28,56,112,224,204,4,220,120,112
160 DATA 251,251,251,0,127,127,127,0
170 REM
180 VPOKE8208,10*16:VPOKE8209,6*16:VPOKE8210,8*16+10
190 GOSUB490
200 X=11:Y=15:C=0:XB=28:YB=5:C1=0
210 VPOKE6144+X+Y*32,128:VPOKE6144+X+1+Y*32,130:VPOKE6144+X+32+Y*32,129:VPOKE6144+X+33+Y*32,131
220 VPOKE6144+XB+YB*32,136:VPOKE6144+XB+1+YB*32,138:VPOKE6144+XB+32+YB*32,137:VPOKE6144+XB+33+YB*32,139
230 REM
240 X1=X:Y1=Y:GOSUB280
250 X2=XB:Y2=YB:GOSUB370
260 GOTO240
270 REM MOVE POLYP YELLOW
280 C=C+1:IFC>5THENC=0:GOTO290ELSEGOTO310
290 M=INT(RND(-TIME)*4+1)
300 Z=Z+4ANDZ<4
310 IFM=1THENX=X+1:GOSUB450:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X-1+Y*32,32:VPOKE6144+X-1+32+Y*32,32
320 IFM=2THENX=X-1:GOSUB450:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+2+Y*32,32:VPOKE6144+X+34+Y*32,32
330 IFM=3THENY=Y+1:GOSUB450:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+Y*32-32,32:VPOKE6144+X+1+Y*32-32,32
340 IFM=4THENY=Y-1:GOSUB450:VPOKE6144+X+Y*32,128+Z:VPOKE6144+X+1+Y*32,130+Z:VPOKE6144+X+32+Y*32,129+Z:VPOKE6144+X+33+Y*32,131+Z:VPOKE6144+X+Y*32+64,32:VPOKE6144+X+1+Y*32+64,32
350 RETURN
360 REM MOVE POLYP RED
370 C1=C1+1:IFC1>5THENC1=0:GOTO380ELSEGOTO400
380 M1=INT(RND(-TIME)*4+1)
390 Z1=Z1+4ANDZ1<4
400 IFM1=1THENXB=XB+1:GOSUB470:VPOKE6144+XB+YB*32,136+Z1:VPOKE6144+XB+1+YB*32,138+Z1:VPOKE6144+XB+32+YB*32,137+Z1:VPOKE6144+XB+33+YB*32,139+Z1:VPOKE6144+XB-1+YB*32,32:VPOKE6144+XB-1+32+YB*32,32
410 IFM1=2THENXB=XB-1:GOSUB470:VPOKE6144+XB+YB*32,136+Z1:VPOKE6144+XB+1+YB*32,138+Z1:VPOKE6144+XB+32+YB*32,137+Z1:VPOKE6144+XB+33+YB*32,139+Z1:VPOKE6144+XB+2+YB*32,32:VPOKE6144+XB+34+YB*32,32
420 IFM1=3THENYB=YB+1:GOSUB470:VPOKE6144+XB+YB*32,136+Z1:VPOKE6144+XB+1+YB*32,138+Z1:VPOKE6144+XB+32+YB*32,137+Z1:VPOKE6144+XB+33+YB*32,139+Z1:VPOKE6144+XB+YB*32-32,32:VPOKE6144+XB+1+YB*32-32,32
430 IFM1=4THENYB=YB-1:GOSUB470:VPOKE6144+XB+YB*32,136+Z1:VPOKE6144+XB+1+YB*32,138+Z1:VPOKE6144+XB+32+YB*32,137+Z1:VPOKE6144+XB+33+YB*32,139+Z1:VPOKE6144+XB+YB*32+64,32:VPOKE6144+XB+1+YB*32+64,32
440 RETURN
450 IFVPEEK(6144+X+Y*32)<>32THENX=X1:Y=Y1:RETURN290
460 RETURN
470 IFVPEEK(6144+XB+YB*32)<>32THENXB=X2:YB=Y2:RETURN380
480 RETURN
490 PRINT"";
500 PRINT"                      ";
510 PRINT"                      ";
520 PRINT"            ";
530 PRINT"            ";
540 PRINT"                  ";
550 PRINT"                  ";
560 PRINT"            ";
570 PRINT"            ";
580 PRINT"                     ";
590 PRINT"                     ";
600 PRINT"              ";
610 PRINT"              ";
620 PRINT"    ";
630 PRINT"                 ";
640 PRINT"                           ";
650 PRINT"              ";
660 PRINT"    ";
670 PRINT"    ";
680 PRINT"                             ";
690 PRINT"                             ";
700 PRINT"";
710 PRINT"";
720 RETURN
Login sesión o register para postear comentarios