about a MSXBASIC compiler?

Página 7/7
1 | 2 | 3 | 4 | 5 | 6 |

Por PingPong

Prophet (3901)

imagem de PingPong

31-12-2007, 16:51

functions are in my mind (auto/locals vars also) as their sub counterparts. Not sure about Multi-dim arrays. As said, at a low level i need to perform multiplications, but often those result in inefficient performances. So instead why not do this when needed with an helper function?

Condider this pseudo -c code:

void find(char[][] array)
{

char subarray[]=array[1];
for (int k=0;k<1000;k++)
{
if subarray[k]==0 { ... found!}
}
}

in pseudo basic is

SUB find(array()() as char)

for i=0 to 1000
if array(1,i)=255 then ....
next i

END SUB

notice the difference: in c you can take the address of a specific portion of the array, in basic not. this involves doing 1001 multiplications in basic , (lot of code and time wasted for a z80), while in 'c' only a ptr increment is required... Cool

If you code manually the access on a single dim array you could do something like this:

dim startidx = 1*size of first dimension
for k=startidx to startidx+1000: if array(k) then .....

getting almost the same efficiency as the 'c' version.... Wink

Por PingPong

Prophet (3901)

imagem de PingPong

31-12-2007, 16:52

Ah, forgot: the sintax may be be more similar to the nestor basic one.

Por Yukio

Paragon (1540)

imagem de Yukio

31-12-2007, 19:02

Well, I got interest. And honestly, I'd like it better if its syntax was more like QBASIC or Blitz Basic, instead of MSX Basic.

Maybe you would like to find about something like PowerBASIC. It is like Microsoft QBasic plus Assembler support.
http://www.powerbasic.com/
Also feature capital letters on the BASIC acronym.
Nice downloads for people trying BASIC or wanting to make games.
Downloads
The important thing is that the code is compiled to be a stand alone executable file!

The Blitz Basic variants are a little hybrid, the page mentions BASIC/C hybrid.
http://www.blitzbasic.com/
BlitzPlus is nice for beginners.

The modern BASIC languages gets the approach of Structured programming. Because of it, the structure is a little similar to the ones found on Pascal and C compilers!

Maybe someone should check the ANSI BASIC and try to port this stuff for contemporary MSX computers. Or there is even the TrueBASIC for classic computers!

Página 7/7
1 | 2 | 3 | 4 | 5 | 6 |