Why not Pascal / C instead BASIC?

Page 2/5
1 | | 3 | 4 | 5

By AxelStone

Prophet (2694)

AxelStone's picture

05-05-2016, 23:34

@tvalenca MSX-BASIC is definitively too limited, not only for memory issues, but it's sintax. You have not functions, structured data types or anything that allows you to make your code more readable.

I repeat, Pascal is very friendly and probably any BASIC programmer feel confortable using it. MSX-C is a bit harder, but you still get a structured language and has a lot of posibilities.

By Manuel

Ascended (15753)

Manuel's picture

06-05-2016, 00:04

I had quite some fun programming in Turbo Pascal 3.3. It didn't require MemMan at all (as was pointed out earlier; only if you use GIOS) and I used Kari's libs. It programs like in basic, but then a lot more structured. The speed: it's not superfast. It depends on the used libs too, of course and what you're doing. I had the idea it's as fast as MSX-BASIC kun, roughly. But you have a lot more memory at your disposal (programs are for MSX-DOS). AFAIK the run time library is bigger than for MSX-C: it's always 8kB. I believe the MSX-C one is smarter as the linker only adds the stuff used. But I'm not sure about that at all.
I do think Pascal code is a lot more readable than C code. It allows less awful/tricky constructions and it's using a bit more verbose syntax. It's very easy to convert from C to Pascal or vice versa, though.

By Kai Magazine

Paragon (1303)

Kai Magazine's picture

06-05-2016, 01:16

This thread is growing interesting to me.
I read so many different opinions, and I am happy to see that some of them go in favor of Basic, or at least a better turbobasic compiler, which is my most erotic wet dream.
I am well aware this will not happen any time soon (probably never) but it is nice to see I am not alone out there Smile
As NYYRIKKI very well said: "I don't think it is that important what language you select, but what you do with it"
I could not agree more!
Each language has it's advantadges and disadvantadges.
Some will allow you to optimize the CPU at 100% (as long as you are good enough) and others will allow you to develope games much faster.
Some are for mathematical oriented minds, others are for impatient people (like me) who want to see results now, and advance fast.
Regarding the structure and readibility, it is relative:
It is true that if I had to revisit the code from "Nuts" it would take me a copule of hours to get the hand of it and see what is what, but that is a code I did 20 years ago, and to spend a copule of hours to catch up, is not such a big deal.
But right now I am making a new project and it has already arround 100k of code. You can ask me which line number is a particular routine, and I will tell you exactly in which file it is, the number of the routine, what it does, how it does it, and how it is coded.
Why? because I cannot spend 2 years to create a game. I do not need to. As a matter of fact, the longer it takes, chances are you will end up sick of it and give up. Anyway you can write each routine number and variable definition on a .DOC (I never needed it, but it is a good option)
I have been programing in basic for so many years that readability is not a problem at all (to me) so, if another language is more readable than basic, that is not an incentive for me in particular.
Regarding the limitations: indeed it has many limitations (speed for regular basic, memory for turbo basic) but sintaxis is not an issue since you can add any ASM routine you want, so you can eventually manage to do almost anything.

Anyways popolony2k said he plans on improving the Pascal library including grahics support for msx2, 2+ and v9990.
You have my attention, popolon! if you do, I will sure give it a go!

Anyways 2.0: I am a pragmatical person and I am more motivated by facts than theory. In other words: what games have been done in Pascal, so I can see what I could do if I invest an unknown amount of hours learning it? (which I am willing to do if I see there are games which include the things I need to do my projects)
In the case there are such games, is there enough help and resources so a beginner such as me can actually learn all the necessary skills to finish a game the way I want?
(That is perhaps the most important thing of all)

I need to see results. That is how I get motivated.

Regarding the basic/turbo basic limitations and capabilities, I must cuote NYYRIKKI again because he said it so well (in my opinion): " it is not that important what language you select, but what you do with it."

Please take a look at this youtube link.
The video played in the MSX.ORG window is shown at 30fps and low resolution. Please click on the youtube button to watch it on youtube directly and make sure that "720 HD 60FPS" is available and selected.
You will see big screen 8 graphics moving at near 60 fps, perfectly smooth. Many people on faceook (I posted some of this a few days ago on facebook spanish pages) do not belive this is a standard msx2 without gfx9000 and they say it looks like super nintendo (snes, super famicom):

https://youtu.be/C-mAIT1v7J8

I have not published any moonsound version videos yet because John Hassink wishes to finish the songs properly before we do so, but I can assure you that with moonsound, it actually feels like snes!

Well, this is made mainly in basic, with the exeption of very small turbo basic blocks so I can use all available basic memory. This way I beat the memory limitation of Turbo basic and the "too slow" limitation of basic at the same time.
This is possible because the game is a turn-based game so there are still limitations, but I can (will) use this engine to make an old-school RPG on screen 8 in the future. I belive it can look very nice.

There can be done interesting things in basic that have yet not been done, with nice results.
But if anyone ever made a new turbo basic with more available memory, that would be an spectacular improvement for the developer scene since there are many basic lovers/coders/creators and the production time is way shorter than many (any?) other languages (press f5, wait a few seconds and test your code right from the point of the project you want).

SORRY FOR SUCH A LONG POST!
iI did not had any free time this days and today I had a copule of hours to write this, so I went for it "full throttle"...

By popolony2k

Hero (525)

popolony2k's picture

06-05-2016, 02:26

raymond wrote:

Thanks for this nice collection Smile Bookmarked the page Big smile

Thanks for bookmarking. In fact today I have a lot of new features added to this framework and soon I'll commit with my VGM Player written in Turbo Pascal (Pop!Art VGM Player). But I need to finish the memory mapper library implementation (in fact is finished but I just need to integrate with the player).

[]'s
PopolonY2k

By popolony2k

Hero (525)

popolony2k's picture

06-05-2016, 04:20

About the Borland's Turbo Pascal...

...compiler, a good source for optimization considering this specific version (Turbo Pascal 3), this article is very useful and there are a lot of things that you could do just modifying your code style, to get an optimal code (remember that Borland Turbo Pascal is almost a 40's guy like us Smile and in those days compiler optimization was something embrionary or inexistent).

http://www.pcengines.ch/tp3.htm

The compiler considered in the article above is x86 but several concepts are the same used in Turbo Pascal for Z80.

Maybe in the future I'll make a source code optimizer for this compiler.

[]'s
PopolonY2k

By popolony2k

Hero (525)

popolony2k's picture

06-05-2016, 04:02

Kai Magazine wrote:

This thread is growing interesting to me.....
Anyways popolony2k said he plans on improving the Pascal library including grahics support for msx2, 2+ and v9990.
You have my attention, popolon! if you do, I will sure give it a go!

Yes I'll add V9990 suppport to Turbo Pascal. For now if you can follow the url I sent before (to my framework on SourceForge.net), you will check that I have added support to several technologies below:

1) Serial communication (WIP);
2) Obsonet UNAPI Ethernet (WIP);
3) OptoNet ethernet support (Luis Fernando Luca ethernet card);
4) Abstract Socket implementation (with a driver supporting the OptoNet card and Obsonet will be added in the future);
5) All soundcards support functions, capable of detecting and controlling SCC, YM2151, AY8910, YM2413 and Y8950;
6) BigInteger math functions (Int24, Int32, ..... infinite);
7) IDE (Sunrise) low level functions;
8) Direct Screen support functions;
9) TextUI functions (Will be increased to support multiple widgets);
10) MSX platform specific function calls (MSXBIOS, MSXDOS1, MSXDOS2, Slot management);
11) VGM processing (file, player, GD3 tags);
12) Unit test framework (Ptest - PopolonY2k Test Framework) - All BigInt tests were written using this framework;
13) FAT12/16/32 full implementation (functions to create FAT, Find files, CD, RD, MD, and related functions) (WIP, still was not commited to SourceForge.net). This will be used to add a more powerful support to Beer IDEs in the future, considering sub directories and FAT16 handling;
14) Accurate sleep routines, hooks and interrupt handling routines;

I think that this framework has a lot of things I forgot but for now is what I remember Smile

Enjoy.

[]'s
PopolonY2k

By popolony2k

Hero (525)

popolony2k's picture

06-05-2016, 04:14

Manuel wrote:

I had quite some fun programming in Turbo Pascal 3.3. It didn't require MemMan at all (as was pointed out earlier; only if you use GIOS) and I used Kari's libs. It programs like in basic, but then a lot more structured. The speed: it's not superfast. It depends on the used libs too, of course and what you're doing. I had the idea it's as fast as MSX-BASIC kun, roughly. But you have a lot more memory at your disposal (programs are for MSX-DOS). AFAIK the run time library is bigger than for MSX-C: it's always 8kB. I believe the MSX-C one is smarter as the linker only adds the stuff used. But I'm not sure about that at all.
I do think Pascal code is a lot more readable than C code. It allows less awful/tricky constructions and it's using a bit more verbose syntax. It's very easy to convert from C to Pascal or vice versa, though.

Yes Manuel, I agree with you that Turbo Pascal is a little bit more verbose than C and in my opinion, this is the only point that they differs, because everything else serious you want to make using C, you can make using Turbo Pascal and the results will be the same and following some rules in Pascal you can reach the same performance levels in both languages (considering the MSX scenario).

Unfortunately this MSX Turbo Pascal version has an "orthodox" pointer deference and indexing method and this was changed in Turbo Pascal 4.0 for PC, but as an experienced C/C++ programmer (are the languages that I'm using to pay my bills in the latest 25 years Smile ) I studied the complete manual of Turbo Pascal looking a solution for this "issue" and I discovered that you can use a compiler directive to turn off the range checking generation, so you can use a trick to have the same deference and pointer indexing style as used in C, for example (and Turbo Pascal 4 Smile ).

There are a lot of tricks that make your Turbo Pascal code faster, the best way of knowing them is writting a lot of code using Turbo Pascal. Smile

[]'s
PopolonY2k

By popolony2k

Hero (525)

popolony2k's picture

06-05-2016, 03:36

If you are considering...

...to integrate Z80 Assembly to your Pascal code, Hans Otten created an excellent tool known as INLASS.

INLASS is the best tool created to integrate your ASM library code to your Turbo Pascal code (procedure or function). This tool is mandatory for those who want improve Turbo Pascal, using Z80 ASM.

A lot of code written in ASM were added through inline code to my framework and they were assembled using INLASS. Today I can't imagine my life without INLASS when I'm writing ASM code to be integrated to my Turbo Pascal routines Smile

Here is the link where you can find INLASS.

http://msx.hansotten.com/index.php?page=msxpascal

Here is the link where you can see a short manual for INLASS.

http://pascal.hansotten.com/uploads/msx/inlass.pdf

[]'s
PopolonY2k

By AxelStone

Prophet (2694)

AxelStone's picture

06-05-2016, 08:10

Manuel wrote:

I do think Pascal code is a lot more readable than C code. It allows less awful/tricky constructions and it's using a bit more verbose syntax. It's very easy to convert from C to Pascal or vice versa, though.

Yes, Pascal is the best structured language I've ever seen, really simple to read. However MSX-C is a good language compiler too, a bit harder than Pascal, but more optimized.

@Kai Magazine, take a loook at this game for example: Dungeons & Dragons . A very impressive RPG game including FMV. Give a try, you will like! ;)

@popolony2k With Kai's libs, your libs, and resources on Hansotten page, any MSX programmer could feel covered to start using Pascal ;) . It should be really great to have same support with MSX-C.

However the thread is talking about Pascal and C, I shuold be happy to know more MSX-C programmers, I feel really alone ;(

By enribar

Paladin (1000)

enribar's picture

06-05-2016, 08:45

my little poor old contribution work with MSX Pad Turbo Pascal.
A simple game in screen 8, never finished. I think Pascal for MSX actually IS THE alternative to Basic, since C has not clear libraries and IDE for developing, yet (many projects in these years but vaporware till today).
http://xoomer.virgilio.it/enribarb/msx/msxsoftware.html

Page 2/5
1 | | 3 | 4 | 5