[V9990] Q&A Official Thread

Page 10/23
3 | 4 | 5 | 6 | 7 | 8 | 9 | | 11 | 12 | 13 | 14 | 15

Par hit9918

Prophet (2932)

Portrait de 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.

Par tvalenca

Paladin (747)

Portrait de 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.

Par JohnHassink

Ambassador (5672)

Portrait de JohnHassink

07-03-2016, 03:39

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

Par tvalenca

Paladin (747)

Portrait de 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.

Par anonymous

incognito ergo sum (116)

Portrait de 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.

Par tvalenca

Paladin (747)

Portrait de 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.

Par Grauw

Ascended (10768)

Portrait de 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.

Par Kai Magazine

Paragon (1428)

Portrait de 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.

Par Manuel

Ascended (19467)

Portrait de 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.

Par Kai Magazine

Paragon (1428)

Portrait de Kai Magazine

07-03-2016, 10:09

I am on it Smile

Page 10/23
3 | 4 | 5 | 6 | 7 | 8 | 9 | | 11 | 12 | 13 | 14 | 15