[V9990] Q&A Official Thread

Página 10/21
3 | 4 | 5 | 6 | 7 | 8 | 9 | | 11 | 12 | 13 | 14 | 15

Por hit9918

Prophet (2923)

Imagen del hit9918

06-03-2016, 16:21

Yeah the time it takes has no meaning, it is not thought to be used on an interpreter.
The point is that code made in plain BASIC is most widely understood.
The only feature used is INP and OUT, it is easy to get the 9990 in all the kun, pascal, C.
Once the gosubs are ported the rest of the whole game goes without OUT.

Por tvalenca

Paladin (747)

Imagen del tvalenca

07-03-2016, 03:36

Manuel wrote:

It almost takes a minute... drawing that first object takes a lot of time.

About 4 seconds when using MSX-BASIC-kun... (after adding the variable names after "NEXT").

Anyway, you can easily try this in openMSX, e.g. with Boosted MSX2 EN, it has Video9000/GFX9000 included. Just run the program in it.

I bet there's a lot of time being wasted because the FOR loops variables are being treated by BASIC as Double precision numbers when they only needed to be integers. its a matter of one "DEFINT A-Z" on the top of the program to get a slight but perceptive increase of speed.

Por JohnHassink

Ambassador (5605)

Imagen del JohnHassink

07-03-2016, 03:39

DEFINT A-Z only gets slight extra speed? In my experience, it works wonders.

Por tvalenca

Paladin (747)

Imagen del tvalenca

07-03-2016, 03:48

Yes @JohnHassink, when there are FOR loops with lots of repetitions, a simple DEFINT A-Z works wonders... But you actually have to be dealing with integer numbers being stored as double precision numbers to it works. One thing I often do is write BASIC programs that draw graphics using trigonometric functions... DEFINT A-Z won't help getting any speed here, and there's no words to express how slow those programs are.

Por anonymous

incognito ergo sum (116)

Imagen del anonymous

07-03-2016, 04:06

tvalenca, please excuse me if this is a dumb question, but is there any circumstance in coding a game (for MSX/8-bit) that requires using double precision or "floating points" at all? I always thought those types were only meant to make "serious" programs.

Por tvalenca

Paladin (747)

Imagen del tvalenca

07-03-2016, 04:38

Not that I'm aware of. But, and there's always a "but", you may want some NPC (or screen object) to move not on a straight line. this would lead to a quadratic or trigonometric function.

anyway, I just got used to add a "DEFINTA-Z" whenever I'm starting a BASIC program. Feels odd to not do this.

Por Grauw

Ascended (10604)

Imagen del Grauw

07-03-2016, 09:32

You can almost always use integers as fixed point if you want to avoid floating point. Although due to the lack of shift operators in Basic, I guess having to use divisions and multiplications in stead to change between integer and fixed point is a bit suboptimal.

Por Kai Magazine

Paragon (1418)

Imagen del Kai Magazine

07-03-2016, 10:04

DEFNIT A-Z on turbobasic makes real wanders.
It does not only accelerate the FOR loops but all mathematical calculations as long as those are done with integers.
This is why I try to find solutions with integer calculations as much as I can.
Anyway, if you need a non-integer variable in particular, you can DEFINTA-Y and you can use Z as you wish.

Por Manuel

Ascended (18850)

Imagen del Manuel

07-03-2016, 10:07

The times I gave were including the calculation and drawing of the shape. The actual copying is quite fast. Just try it to see for yourself.

Por Kai Magazine

Paragon (1418)

Imagen del Kai Magazine

07-03-2016, 10:09

I am on it Smile

Página 10/21
3 | 4 | 5 | 6 | 7 | 8 | 9 | | 11 | 12 | 13 | 14 | 15