Karoshi MSX Community
05 de Julio de 2021, 01:09:35 pm *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
Noticias:
 
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: [1] 2
  Imprimir  
Autor Tema: kun-basic and nestorbasic  (Leído 34198 veces)
0 Usuarios y 1 Visitante están viendo este tema.
nitrofurano
Karoshi Maniac
****
Mensajes: 259



WWW
« : 12 de Febrero de 2006, 09:54:58 pm »

While coding that games for the ViejoArchivero msxbasic competition, due on msxbasic slowness, i got meanwhile more curious about kun-basic and nestorbasic.
The problem is i'm having difficulties to start using them, and having as well difficulties to find stuff coded using them
Using nestorbasic, for now i only know some stuff from Paxanga (Msx Hot Numbers, Go Japo) and from Imanok (Arm Wrestling, an experimental remake of Konami's Combat School)
Should we know more interesting stuff, using both, or only msx-kun, or only nestorbasic?

En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #1 : 13 de Febrero de 2006, 09:46:47 am »

...or having enough experience programming BASIC; maybe it's time to try a complete assembler game! Wink
En línea

Doom dee doom dee doom
Imanok
Karoshi Hero
*****
Mensajes: 626


« Respuesta #2 : 13 de Febrero de 2006, 10:46:10 am »

What would be really interesting is finding the way to include kun-basic into a basic rom using your ROMcreator. Do you think it could be possible??
En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #3 : 13 de Febrero de 2006, 11:00:04 am »

I don't have the slightest idea of how kun-basic creates the executable. Do you have some schema about the memory map of a KUNB compiled program?
At first sight, if the executable is a compiled one, it's not BASIC anymore, so prolly, ROMcreator is not the right tool; even more, if the generated code, I'm guessing now, occupies pages 2 & 3, could be a bit tricky (only a bit Smiley) to create a standard ROM from it.
Seems that a new tool to convert KB programs to ROM ones could be a good idea! Wink
En línea

Doom dee doom dee doom
Imanok
Karoshi Hero
*****
Mensajes: 626


« Respuesta #4 : 13 de Febrero de 2006, 11:55:17 am »

I don't have the slightest idea of how kun-basic creates the executable. Do you have some schema about the memory map of a KUNB compiled program?

I have no idea... I'm sure Nestor can help you with that.

At first sight, if the executable is a compiled one, it's not BASIC anymore, so prolly, ROMcreator is not the right tool; even more, if the generated code, I'm guessing now, occupies pages 2 & 3, could be a bit tricky (only a bit Smiley) to create a standard ROM from it.
Seems that a new tool to convert KB programs to ROM ones could be a good idea! Wink

It's a GREAT idea. It would be really helpful for people who doesn't know ASM programming... you can get incredibly good results with kun basic.
En línea
nitrofurano
Karoshi Maniac
****
Mensajes: 259



WWW
« Respuesta #5 : 16 de Febrero de 2006, 02:02:15 pm »

Citar
Citar
I don't have the slightest idea of how kun-basic creates the executable. Do you have some schema about the memory map of a KUNB compiled program?
I have no idea... I'm sure Nestor can help you with that.
i may be wrong, maybe kun-basic is a kind of just-in-time precompiler (...?)


Citar
...or having enough experience programming BASIC; maybe it's time to try a complete assembler game!
i tried, and i think i'm still trying
The most problem is, when in Basic you can have lots of instructions into one text line, in assembler you have to unfold each 'high level' instruction into lots of lines, what is still hugelly confusing for me, as well keep understanding the fxxxing code i'm doing... (and still remembering and understanding what it does after months or years not looking at it...)
Btw, the idea of having a faster basic would be a kind of intermediary stage between pure msx-basic and asm - like testing ideas before recoding it in asm

for now, if you all know where can we get working examples using NestorBasic and KunBasic, please let us know...

« Última modificación: 16 de Febrero de 2006, 02:10:31 pm por nitrofurano » En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #6 : 16 de Febrero de 2006, 03:32:08 pm »

Citar
i may be wrong, maybe kun-basic is a kind of just-in-time precompiler (...?)

Right (I'm not sure neither); but to distribute the software it must create some kind of standalone executable or maybe include a execution library or so...
The question is how many memory (and where) it takes?. Maybe someday I'll give a look at the KB, I think that there's a floppy around there with the compiler Roll Eyes

Citar
The most problem is, when in Basic you can have lots of instructions into one text line, in assembler you have to unfold each 'high level' instruction into lots of lines, what is still hugelly confusing for me, as well keep understanding the fxxxing code i'm doing

Yep; but remember that 100 lines of machine language doesn't equals to a single line of BASIC. Execute a BASIC line could take hundreds of ML instructions. And yes, that's the reason why you found it so bloated; the best method to learn it is starting with simpler routines, easy to follow and remember and then, increase the complexity. Modularity is the key too, keep your functions on the small side (like in C!). keep in mind that assembler syntax is very easy to learn due the small number of instructions it has, so you can concentrate on implementing the solution and forgetting the inner workings of one hundred high level commands...
En línea

Doom dee doom dee doom
Imanok
Karoshi Hero
*****
Mensajes: 626


« Respuesta #7 : 16 de Febrero de 2006, 04:29:57 pm »

I don't know if you have this, but it can be very useful_

_________________________________
MSX-BASIC-KUN (BASIC COMPILER)

   by J.Suzuki 1989
   this document & samples by Sho Endo
   translate to english by LASP
   this text file typed without changes by Nestor Soriano

MSX-BASIC-KUN is an incredible BASIC compiler. It will compile a BASIC
program on memory in few seconds and execute it 15 to 100 times faster!! It
can compile most of the statements and functions of MSX-BASIC and can handle
strings and floating numbers. Once you see it, you'd feel you'd never need to
learn the Z-80 machine language. Real time games, C.G., demo programs can be
written by the ease of BASIC for machine language speed.


*** USAGE ***


1. Settings & General knowledge

This compiler is sold in Japan as a cartridge for 4500 yen. You just set it
in a slot to use it. Also, you can found this compiler in MSX2+ Sanyo
machines, in ROM.

Now you are in BASIC mode as usual, except that two commands are available:

CALL RUN
CALL TURBO ON/OFF

"CALL" can be written as "_" (underscore). I will ise that from now on.

_RUN is the command to compile and execute the entire program on memory. If
it finds an error it will stop and yield the message.

_TURBO ON is the statement to define the beginning of the turbo block.
_TURBO OFF is the end of the block.

The turbo block is the part of the program you want to execute fast. When the
entire program contains some uncompilable statements, you can define the
block to be compiled using this set.

   EXAMPLE

   100 SCREEN 8:DEFINT A-Z
   110 BLOAD"PICTURE",S
   120 _TURBO ON
   130 FOR X=0 TO 255
   140 LINE(X,0)-(X,211),0
   150 NEXT X
   160 _TURBO OFF
   170 GOTO 170

This program cannot be "_RUN", because the "BLOAD" is one of the commands
that cannot be compiled. If you "RUN" this, the part lines 130 through 150
will be executed fast.

As '_RUN"FILE"' is not supported, you have to add _TURBO ON and _TURBO OFF at
the beginning and the end if you want to RUN"FILE" and have the effect.

   100 FOR I=0 TO 999
   110 ...
    .
    .
    .
   890 'END OF THE PROGRAM

So, this can be _RUN or add 10 _TURBO ON and 900 _TURBO OFF and RUN"FILE".

If you _RUN a program containing "_TURBO ON/OFF" it will be an error.

_TURBO ON/OFF can not be written in a multi-statement lines.

_TURBO ON/OFF can not be nested. But you may have many closed blocks in a
program.

Variables and arrays are handled differently in and outside of the blocks.
Once you are out of the block, variables and arrays used in the block are
lost. Only, the integer types can be defined as common.

   100 DEFINT A-Z:DIM C(2),D(2)
   110 A=1:B=2:C(0)=3:D(0)=4
   120 _TURBO ON(A,C())
   130 DIM D(2)
   140 PRINT A,B,C(0),D(0)
   150 A=5:B=6:C(0)=7:D(0)=8
   160 _TURBO OFF
   170 PRINT A,B,C(0),D(0)

   RUN
    1 0 3 0
    5 2 7 4
   Ok

Floating numbers used by the compiler is a special format 3-byte value. It's
accuracy is about 4.5 digits. Double precision is not available.

An array must be declared by a constant in the beginning.

This compiler works on the BASIC program on the RAM and creates the objects
and variables on the left RAM. So there is a limit of the size of the source
program about 10K. Big arrays, string variables (each uses 256 byte), CLEAR
Huh,&H?Huh will make the situation tighter as you can imagine. The compiled
objects can not be saved as independent programs.

Interrupts available, such as KEY(1) ON, OFF etc. But it will decrease the
efficiency of the executed object's size & speed.

Some statements may not work correctly.

   100 GOTO 130
   110 A=3/2
   120 END
   130 DEFINT A-Z
   140 GOTO 110

If you RUN this, A is 1. If you _RUN this, A is 1.5. DEF??? will be effective
when encountered during the execution in the case of interpreter, while it
depends on the order of line number in the other case.

A little complicated string operation may cause easily a "String formula too
complex" error. As this compiler has only one level of stack for it. Break a
long string formula into multiple small ones, if so.

If you _RUN an endless program, you can not stop it. Make a part to check
keyboards.

   100 GOTO 100 'Reset or power off to stop

   100 IF INKEY$="" THEN 100
   110 END
   is better.


2. Difference from MSX-BASIC interpreter

List of statements, commands and functions that can not be compiled.

AUTO, BASE, BLOAD, BSAVE, CALL, CDBL, CINT, CLEAR, CLOAD, CLOAD?, CLOSE,
CONT, CSAVE, CSNG, CVD, CVI, CVS, DEFFN, DELETE, DRAW, DSKF, EOF, ERASE, ERL,
ERR, ERROR, EQV, FIELD, FILES, FPOS, FRE, GET, IMP, INPUT#, KEY LIST, LFILES,
LINEINPUT#, LIST, LLIST, LOAD, LOC, LOF, LPRINT USING, LSET, MAXFILES, MERGE,
MOTOR, MKD$, MKI$, MKS$, NAME, NEW, ON ERROR GOTO, ON INTERVAL GOSUB (due to
a bug), OPEN, PLAY, PRINT#, PRINT USING, PUT KANJI, RENUM, RESUME, RSET,
SAVE, SPC, TAB, TRON, TROFF, WIDTH.

List of those with limits.

CIRCLE: Start, end angles and aspect ratio can't be specified.
COPY: Only graphic COPY is available.
DEFDBL: Same as DEFSNG.
DIM: Must come first in the program or in the turbo block.
INPUT: Can handle only one variable at the time.
KEY: ON KEY GOSUB, KEY(n) ON/OFF only.
LOCATE: x,y must be given in as a set. No cursor switch parameter.
NEXT: Variable names after the NEXT can not be omitted.
ON: ON STOP GOSUB, ON INTERVAL GOSUB not available.
PRINT: Commas work in a different way. No wrapping for digits.
PUT: PUT SPRITE only.
RUN: Variables won't be initialized.
SCREEN: Screen mode and sprite size only.
SET: SET PAGE only.
STOP: Same as END.
USR: Parameter type must be integer only.
VARPTR: File number can not be given as the parameter.

Otherwise there is no significant difference.

In general, I/O commands & functions, and editing commands can not be
compiled. Of course they are available in the direct mode, and outside of the
turbo block. You can edit, debug and save a program in MSX-BASIC and execute
it by _RUN.

If you want to use PRINT# to write characters on GRP:, use it outside of
turbo block. Otherwise study the sample, "PRINT.TRB".

If you want to use PLAY, use BGM compiler, and get the sound by USR(n).


3. New features added

3 special commands are available by starting a remark line with some specific
characters.

#I
Stands for INLINE. You can write a short machine-language routine.

   100 DEFINT A-Z
   110 K=1
   120 '#I &H2A,K
   130 '#I &HF3,&HCD,@150,&HFB
   140 END
   150 'SUB
   160 RETURN

120 means LD HL,(K); K must be a simple variable of integer type.
130 means DI
     CALL @150 ;Be careful, this line won't be RENUMed.
     EI

#C
Stands for CLIP. In the screen modes 5 through 8 (except for PAINT, and
CIRCLE), this will be set clipping on and off.

   10 SCREEN 8
   20 '#C-
   30 LINE(0,0)-(255,255) 'Y CLIPPED
   40 IF INKEY$="" THEN 40
   50 '#C+
   60 LINE(0,0)-(255,255) 'NOT CLIPPED
   70 IF INKEY$="" THEN 70

#N
Check if NEXT overflows.

   10 FOR I%=0 TO &H7FFF
   20 NEXT I%

This program will end up in a "Overflow error" in MSX-BASIC. And if _RUN, it
will be an endless loop. If #N+ is specififed, it will end normally. This
code will decrease the efficiency of the object, too. Better not use unless
it's really necessary. To clear, specify #N-.


NOTE: In MSX-2+ Sanyo you can found a new command:

CALL BC

This command turn on the BASIC COMPILER options.
_________________________________
En línea
Dioniso
Visitante
« Respuesta #8 : 16 de Febrero de 2006, 05:53:26 pm »

   translate to english by LASP

IIIEEEEAAAUUUUHHHHH!!!!!!!!!!!!!!   LASP!!!!!!  Those old (and expensive) times ...
En línea
nitrofurano
Karoshi Maniac
****
Mensajes: 259



WWW
« Respuesta #9 : 16 de Febrero de 2006, 08:03:22 pm »

Citar
I don't know if you have this, but it can be very useful_
jesus, Imanok, you could do what you did only starting from this documentation?
 :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god: :god:


Citar
the best method to learn it is starting with simpler routines, easy to follow and remember and then, increase the complexity. Modularity is the key too, keep your functions on the small side (like in C!).
and it takes a huge time learning.....


Citar
keep in mind that assembler syntax is very easy to learn due the small number of instructions it has, so you can concentrate on implementing the solution and forgetting the inner workings of one hundred high level commands...
small number of instructions is fine, as well i think i know what they do - the problem is making the code to do what you want, and the tricky ways you may need to do it working, fast, and on a small code (and for me just make things fast enough or faster than msx-basic is more than enough)... (like that code i posted somewhere here in msx-basic can help you code the main scrolling loop on games like sammy's Viewpoint - it seems to be simple, but my asm knowledge is not yet to that level...)

 
« Última modificación: 16 de Febrero de 2006, 08:15:50 pm por nitrofurano » En línea
Imanok
Karoshi Hero
*****
Mensajes: 626


« Respuesta #10 : 17 de Febrero de 2006, 11:27:23 am »

jesus, Imanok, you could do what you did only starting from this documentation?

Well... I used this documentation, a BASIC book, and the Nestorbasic manual.

By the way... you were asking for some more examples of programs using Nestorbasic, didn't you?? if you have played only 'Armwrestling', you can have a look at my site and download 'Bubble Rain' and 'Cat'n'Mouse' promos.  Wink
En línea
nitrofurano
Karoshi Maniac
****
Mensajes: 259



WWW
« Respuesta #11 : 18 de Febrero de 2006, 03:18:37 pm »

Citar
Well... I used this documentation, a BASIC book, and the Nestorbasic manual.
you're a genius, really!!!!!   - with the same documentation, i only can code stuff in pure msx-basic!!!!!
:god::god::god::god::god::god::god::god::god::god::god::god::god::god::god::god:



Citar
By the way... you were asking for some more examples of programs using Nestorbasic, didn't you??
for sure!  i only can code stuff starting from examples

(sdlBasic were the only case i could start myself coding minimal examples, and help with it the whole sdlBasic development  (btw, i only could code there minimals for 50 percent of the commands)  )

Citar
if you have played only 'Armwrestling', you can have a look at my site and download 'Bubble Rain' and 'Cat'n'Mouse' promos.
not first time i tried - i only could download ArmWrestling - i think the others are not linked - have you the direct urls to them?




En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #12 : 18 de Febrero de 2006, 07:56:16 pm »

Citar
you can have a look at my site and download 'Bubble Rain' and 'Cat'n'Mouse' promos.

Hey!, thanks!. I'll give a look too. Hope I'll figure out the memory map studying your promos Smiley
En línea

Doom dee doom dee doom
KNM
Karoshi Hero
*****
Mensajes: 755

Fearless

jbosca@hotmail.com
Email
« Respuesta #13 : 19 de Febrero de 2006, 12:59:56 pm »

Imanok´s games always been funny and very well made  Grin.It´s a clear example of how far can you go with kun or nestorbasic.

BASIC is not dead! Cool

KNM
csave"burp" Roll Eyes
En línea

<Bacterion> : ¿ Por qué la gente se empeña en pulsar F5 ?
Imanok
Karoshi Hero
*****
Mensajes: 626


« Respuesta #14 : 19 de Febrero de 2006, 09:12:02 pm »

Thank you guys, I'll pay the beers I promised you!  Wink

Seriously, you can get very good results using Nestorbasic... you only have to be careful with the game you try to make... once you know and assume its limitations everything will be easier.
En línea
Páginas: [1] 2
  Imprimir  
 
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.21 | SMF © 2013, Simple Machines XHTML 1.0 válido! CSS válido!