more basic to bin (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 62 invitados y 7 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - more basic to bin

Ir a la página ( 1 | 2 | 3 Siguiente página )
Autor

more basic to bin

norakomi
msx professional
Mensajes: 861
Publicado: Febrero 16 2005, 20:01   
Hola !

I am looking for a way to make a .bin file which reads the d=stick(0) and moves
the sprite using basic.

something like this:
10 d=stick(0)
20 ifd=1theny=y-1 etc......
30 putsprite1,(x,y)

this is my basic programm....
can I save (bsave"spritemoves.bin??????????) this program and Call it in another basic programm?

Like this:

5 bload"spritemoves.bin",&hc000 (this is the above programm)
6 defusr0=&hc000
10 screen 5
20 sprite$(1)=chr$( bla bla bla )
30 x=100:y=100
40 a=usr(0): so this calls the programm above
50 goto 40

I know this is not correct, but I hope you get the idea.
I´m looking for a way to call (while in basic) a routine writen in basic


I found programms like bas2bin, rom2bin, bas2com, bas2rom & bin2rom
but I haven´t succeeded yet !!

anyone some suggestions?
Grauw
msx professional
Mensajes: 1006
Publicado: Febrero 16 2005, 22:10   
Looks like you want to make subroutines...? Why not just use GOSUB?

If speed is the goal, you can't really save Basic programs as an Assembly program... You would need a compiler for that, which does not exist (in this form).

~Grauw
norakomi
msx professional
Mensajes: 861
Publicado: Febrero 17 2005, 10:56   
gosub does the trick indeed, however I want to look for ways to make my main programm as small as possible, because I´m using nBasic I have little memory available.
And the last thing I need is a Out of Memory error.
norakomi
msx professional
Mensajes: 861
Publicado: Febrero 17 2005, 11:18   
so I´m more like looking for a way to use
gosub "movementplayer.bas"
and
gosub"fadeout.bas"
without having to load those files.

sub-routines, yes !! but with different files.
can i load a basic programm into memory somehow
(load"fadeout.bas",&hd000 ?????)

:?
NYYRIKKI
msx master
Mensajes: 1533
Publicado: Febrero 17 2005, 11:22   
Quote:

so I´m more like looking for a way to use
gosub "movementplayer.bas"
and
gosub"fadeout.bas"
without having to load those files.



Check N-BASIC functions 55-57 they are used to do just this. I have never tested them though...

norakomi
msx professional
Mensajes: 861
Publicado: Febrero 17 2005, 22:45   
i have the file nbasic.bin
and i use this programm to speed up my game,
however I have no idea what you mean by
function 55-57
can you tell me more about this?
NYYRIKKI
msx master
Mensajes: 1533
Publicado: Febrero 18 2005, 15:21   
Quote:

however I have no idea what you mean by
function 55-57
can you tell me more about this?



Look Nestor BASIC manual from: http://www.konamiman.com/msx/msx-e.html
norakomi
msx professional
Mensajes: 861
Publicado: Febrero 18 2005, 15:22   
i´ve reading the nbasic manual for some hours now.
And I wanted to start of with the simplest idea (to later build it to a more difficult platform)

10 rem ´test.bas
20 ?"test"

this is my programm which i wanted to save to RAM
(using function 55-57)
I have not been able to save this test.bas into a free segment (like say segment 6), it isn´t clearly explained.
what IS explained is that the basic programs begins address needs to be changed.

section 6 of the manual says:
6. BASIC PROGRAMS STORAGE AND EXECUTION

NestorBASIC includes functions that allows the storage of BASIC programs in
RAM or VRAM segments, and its activation or execution, without losing the
existing variables generated by the original program.

WARNING: For using these functions, the begin address of the BASIC programs
in the BASIC main RAM must be changed, from &H8000 to &H8003; this operation
must be done only once, and BEFORE NestorBASIC is installed. You can
do this in two different ways:

- In direct mode, enter the following commands:

POKE &HF676,4
POKE &H8003,0
NEW

- From a BASIC program. This is the best way, because you can use the same
program for performing this change and, after that, for loading NestorBASIC.
The first line of the program must be as follows:

1 'program.bas
10 IF PEEK(&HF676)<>4 THEN POKE &HF676,4OKE &H8003,0:RUN"program.bas"
20 'From here, you can load NestorBASIC

so my program changes into:

1 'test.bas
10 IF PEEK(&HF676)<>4 THEN POKE &HF676,4OKE &H8003,0:RUN"program.bas"
20 'From here, you can load NestorBASIC
10 rem ´test.bas
20 ?"test"

but still.... what now??

because to activate this program * Function 56 says: Activation of a BASIC program stored in a segment (S4)

Input: P(0) = Segment
P(1) = Begin address

but what is the segment of test.bas and what is the begin address?

Plus: I read that to make all this happen I need to save my test.bas with a header (* Function 57: Save a BASIC program with a special header (S4))

And I tried something, but am not sure of the result.....

In other words:

I wish manuals like the NBASIC manual would come for non-intellectuals as well.

sigh
[D-Tail]
online

msx guru
Mensajes: 3026
Publicado: Febrero 18 2005, 17:07   
Segment of test.bas doesn't exist because you just overwrote lines 10 and 20. Do something like this:
5 ' LOADER.BAS
10 IF PEEK(&HF676)<>4 THEN POKE&HF676,4: POKE &H8003,0: RUN "LOADER.BAS"
20 BLOAD "NBPATCH.BIN",R: BLOAD "NBASIC.BIN",R
From here on do the following in direct mode:
LOAD "TEST.BAS"
F$(0)="TEST.NBA":E=USR(57) 'Saves the program TEST.BAS as TEST.NBA with a special BASIC header
The test program is now available for loading inside NBASIC. Now do the following:
10 DEF INT E,P: DIM P(15)
20 CALL TURBO ON(P()) 'integer array P has been defined in program as NBASIC is loaded
30 DIM F$(1) 'Define F$(0) and F$(1) again
40 F$(0)="test.nba": E=USR(31) 'Open adapted test.bas
50 P(2)=6: P(3)=0: P(4)=&H4000: E=USR(33) 'Read contents to segment 6, address 0
60 E=USR(32) 'Close file
70 P(0)=6: P(1)=0 'Set up the segment and address variables
80 PRINT "Do you want to (R)un or (L)oad the program stored in segment 6?"
90 I$=INKEY$: IF I$="" GOTO 90
100 IF I$="R" OR I$="r" THEN E=USR(55): END 'Execute adapted test.bas
110 IF I$="L" OR I$="l" THEN E=USR(56): END 'Only load adapted test.bas and return to direct mode
This should do the trick...
flyguille
msx master
Mensajes: 1237
Publicado: Febrero 18 2005, 17:10   
the best way to move the main player in basic is.


dim mh%(8),mv%(8)
for x=0 to 8
read mh%(x),mv%(x)
next x
data 0,0
data 0,-1
data 1,-1
data 1,0
data 1,1
data 0,1
data -1,1
data -1,0
data -1,-1

so, in the animation routine

is

st%=stick(pl)
x = x + mh(st%):y=y+mv(st%)

instead a lot of

if stick()=1 then
if stick()=3 then

etc....

now, a lot of games needs to test if the player are on a wall or fire, or something...

so, having the new x,y positions, do the checks, if the player just can't go at the new x,y. just do this

x = x - mh(st%):y=y-mv(st%)

and then

PUT SPRITE ...



[D-Tail]
online

msx guru
Mensajes: 3026
Publicado: Febrero 18 2005, 17:18   
PUT SPRITE.... use VPOKE instead. I know, it's 2 or 3 VPOKEs instead of one PUT SPRITE, but in the end, VPOKE's faster in BASIC.
NYYRIKKI
msx master
Mensajes: 1533
Publicado: Febrero 18 2005, 17:27   
Flyguille, this was already discussed in earlyer post and we ended up to:
10 DEFINTA-Z:DIMDX(8),DY(8)
20 FORI=1TO8:DX(I)=SGN(I-5)*(I>1):DY(I)=-SGN((IAND7)-3)*(I<>7):NEXTI
30 D=STICK(0):X=X+DX(D):Y=Y+DY(D)


BTW from this topic I got the IOMBCC idea

enribar
msx freak
Mensajes: 129
Publicado: Febrero 18 2005, 17:31   
I've found a loadble BIN routine to move sprites!
It's here:

http://xoomer.virgilio.it/enribarb/msx/files/UTILITY3.zip

but I think you really need a shot explanation... Maybe in the next days if I have some time (or if you understand Italian a bit...).
enribar
msx freak
Mensajes: 129
Publicado: Febrero 18 2005, 17:37   
Ohps! Sorry, you'd better download this:

http://xoomer.virgilio.it/enribarb/msx/files/UTILITY2.zip
norakomi
msx professional
Mensajes: 861
Publicado: Febrero 19 2005, 23:50   
However this one came out faster in my (time=0 at start, and ?time at end) test

10 DIM DX[8],DY[8]
20 DX[0]=0X[1]=0X[2]=1X[3]=1X[4]=1X[5]=0X[6]=-1X[7]=-1X[8]=-1
30 DY[0]=0Y[1]=-1Y[2]=-1Y[3]=0Y[4]=1Y[5]=1Y[6]=1Y[7]=0Y[8]=-1
: <other initialization>
100 D=STICK(0)
110 X=X+DX[D]: Y=Y+DY[D]
: <do boundary tests, copy stuff etc>
200 GOTO 100

QUOTE
Flyguille, this was already discussed in earlyer post and we ended up to:

10 DEFINTA-ZIMDX(8),DY(8)
20 FORI=1TO8X(I)=SGN(I-5)*(I>1)Y(I)=-SGN((IAND7)-3)*(I<>7):NEXTI
30 D=STICK(0)=X+DX(D):Y=Y+DY(D)
/QUOTE


Although I havent tested this one on speed:the best way to move the main player in basic is.


dim mh%(8),mv%(8)
for x=0 to 8
read mh%(x),mv%(x)
next x
data 0,0
data 0,-1
data 1,-1
data 1,0
data 1,1
data 0,1
data -1,1
data -1,0
data -1,-1

so, in the animation routine

is

st%=stick(pl)
x = x + mh(st%):y=y+mv(st%)

instead a lot of

if stick()=1 then
if stick()=3 then

etc....

now, a lot of games needs to test if the player are on a wall or fire, or something...

so, having the new x,y positions, do the checks, if the player just can't go at the new x,y. just do this

x = x - mh(st%):y=y-mv(st%)

and then

PUT SPRITE ...


 
Ir a la página ( 1 | 2 | 3 Siguiente página )
 







(c) 1994 - 2009 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation