News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_bluestar

Locomotive Basic Compiler

Started by bluestar, 23:43, 12 March 23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bluestar

Hi there!

As I mentioned in previous post I'm starting after more than 30 years again with my CPC 464. I've developed (almost finished) a version of the Oh Mummy game in pure Basic (after that I'll create versions using RSX, machine code, etc... just for fun and learning).

I was trying CPCBasic compiler in order to check the speed. The bin file has been created ok but I can't run it due to a Line too long error. I'll check all the lines later (specially the ones for sprite creation as they have a lot of CHRs) but I wonder...

Is there any particular Locomotive Basic Compiler you can recommend for a noob like me?

Thanks in advance!

MoteroV4

Maybe FABACOM (Fast BASIC Compiler). It is compatible with Locomotive BASIC, uses floating point, handles files on tape or disk, etc. In this article (in Spanish) it is described in more detail:

http://fremos.cheesetea.com/2014/05/18/compila-y-potencia-tus-juegos-en-basic-para-amstrad/
Released cpc games: Memtrainer, El Gerente (Remake)

Prodatron

There are even Locomotive Basic compilers for Windows:

https://www.cpcwiki.eu/index.php/CPCBasic_compiler
https://www.cpcwiki.eu/index.php/CPC_Basic_3

Unfortunately the sites don't seem to work anymore, but maybe you can still download them from http://archive.org . Does anyone know what happens to these projects?


Some old compilers:
https://www.cpcwiki.eu/index.php/Fabacom_(FAst_BAsic_COMpiler)
https://www.cpcwiki.eu/index.php/Laser_Basic
https://www.cpcwiki.eu/index.php/Hisoft_Turbo_Basic

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

bluestar

Quote from: Prodatron on 10:38, 13 March 23There are even Locomotive Basic compilers for Windows:

https://www.cpcwiki.eu/index.php/CPCBasic_compiler
https://www.cpcwiki.eu/index.php/CPC_Basic_3

Unfortunately the sites don't seem to work anymore, but maybe you can still download them from http://archive.org . Does anyone know what happens to these projects?


Some old compilers:
https://www.cpcwiki.eu/index.php/Fabacom_(FAst_BAsic_COMpiler)
https://www.cpcwiki.eu/index.php/Laser_Basic
https://www.cpcwiki.eu/index.php/Hisoft_Turbo_Basic
CPCBasic is still accesible through https://cpcbasic.webcindario.com/

This is the one I was trying.

I'll try at least with FABa amd Laser Basic. 

Thanks!

VincentGR

Fast Basic Compiler is what I use too, although I get errors like this from time to time.
I think it's 4x faster, did a sample video a few years ago.

zhulien

#5
There is a good book for the Amstrad for teaching Assembly Language - i don't have it but i read it before - it really goes through BASIC commands and explains how they work in Assembly Language and it is quite easy to follow for BASIC programmers (experienced or new).  E.g. it oulines variables vs memory locations, how to set a variable in BASIC vs setting in a memory location, how to do a loop WHILE WEND in BASIC and how to do it in Assembly Language - anyone know this book? It might be this one: https://archive.org/details/machine-code-for-beginners-on-the-amstrad-steve-krameracme

The reason I bring it up, much of what you can do in Locomotive BASIC (not all) is very easy to do in Assembly Language if you think of what you are doing in BASIC commands - you won't really get the most efficient code, but you will still get faster code than most BASIC (non-optimising) compilers and it also lets you grow your Assembly Language skills faster to more complex things later - i.e. it is easy to multiply 2 16 bit numbers by repeatedly adding within a loop - but it isn't the fastest way by far.  Still a good starting point though.

bluestar

Quote from: zhulien on 12:22, 15 March 23There is a good book for the Amstrad for teaching Assembly Language - i don't have it but i read it before - it really goes through BASIC commands and explains how they work in Assembly Language and it is quite easy to follow for BASIC programmers (experienced or new).  E.g. it oulines variables vs memory locations, how to set a variable in BASIC vs setting in a memory location, how to do a loop WHILE WEND in BASIC and how to do it in Assembly Language - anyone know this book? It might be this one: https://archive.org/details/machine-code-for-beginners-on-the-amstrad-steve-krameracme

The reason I bring it up, much of what you can do in Locomotive BASIC (not all) is very easy to do in Assembly Language if you think of what you are doing in BASIC commands - you won't really get the most efficient code, but you will still get faster code than most BASIC (non-optimising) compilers and it also lets you grow your Assembly Language skills faster to more complex things later - i.e. it is easy to multiply 2 16 bit numbers by repeatedly adding within a loop - but it isn't the fastest way by far.  Still a good starting point though.

Thanks @zhulien it is in my reading list. I know I can do things faster in ASM but I'm in a different kind of project...

My idea is to develop the same game (Oh mummy) in different languages: pure Basic first, then Basic plus ASM routines if possible, later on with 8BP and finally in CPCtelera and maybe in ASM. I've programming skills (working in IT the last 24 years) but I never programmed for Amstrad CPC, well I did when I was 8 to 12 years old (nothing serious). From BASIC to CPCtelera I don't expect to have much trouble with the programming (I know how to program in several languages). ASM is a different thing but I'll try (I did some in university some time ago). The first iteration of the project for me is the most important as is going to set up the skeleton for the next versions of the game.

I'm writting a tutorial of the whole process. Is interesting as I can see the pros and cons of each language in several aspects (not only performance). And here I am struggling with things like how to optimize the game loop in order to get all the characters moving at the same time, interruptions yes or no?, is it possible to do double buffering in Basic?, how can I set different speeds for each mummy? and things like that due to my lack of experience programming games in Basic. But as I say before this is a long trip and I'm enjoying the process plus the results are quite amazing already (except for the music the game looks like much the original one! :) )

Thanks for your help!

zhulien

Remember, the logic 'can' be identical in Assembler (especially at the beginner level using the execellent firmware calls available on the CPC), so consider adding it as the last one to your tutorial :D

IndyUK

I'd love to see what you've managed to come up with so far using BASIC. Any pics or video? I think that if you put some thought into the game design, it's amazing what you can come up with. Some months ago I too had a go at creating a platform game in BASIC. It was definitely challenging but fun. It was just about playable at native speed but, if you increased the CPC to around 200% it was perfect. There are a few demos on here where people have come up with potential games in BASIC and they look great.

abalore

Quote from: IndyUK on 21:31, 16 March 23I'd love to see what you've managed to come up with so far using BASIC. Any pics or video? I think that if you put some thought into the game design, it's amazing what you can come up with. Some months ago I too had a go at creating a platform game in BASIC. It was definitely challenging but fun. It was just about playable at native speed but, if you increased the CPC to around 200% it was perfect. There are a few demos on here where people have come up with potential games in BASIC and they look great.
Take a look at this

https://www.cpcwiki.eu/forum/games/locomotive-basic-game-p4-return-to-ganymede

IndyUK

Quote from: abalore on 22:10, 16 March 23Take a look at this

https://www.cpcwiki.eu/forum/games/locomotive-basic-game-p4-return-to-ganymede
Now that's exactly what I was talking about - the thought process. You've designed it with BASIC in mind meaning there's no need to try and overload the game screens with lots of sprites, when you know that BASIC will not cope. Well done! You've done an excellent job, puts my effort to shame.

bluestar

#11
Quote from: IndyUK on 21:31, 16 March 23I'd love to see what you've managed to come up with so far using BASIC. Any pics or video? I think that if you put some thought into the game design, it's amazing what you can come up with. Some months ago I too had a go at creating a platform game in BASIC. It was definitely challenging but fun. It was just about playable at native speed but, if you increased the CPC to around 200% it was perfect. There are a few demos on here where people have come up with potential games in BASIC and they look great.
Yep the process is the key.... I'm here another night struggling with the main loop and how to make mummies and player running almost at the same time. Here you have a picture of the current development. The algorithm for checking and discovery tumbs works quite fast. Now going for the array of mummies. Scary :)
You cannot view this attachment.

bluestar

Quote from: abalore on 22:10, 16 March 23
Quote from: IndyUK on 21:31, 16 March 23I'd love to see what you've managed to come up with so far using BASIC. Any pics or video? I think that if you put some thought into the game design, it's amazing what you can come up with. Some months ago I too had a go at creating a platform game in BASIC. It was definitely challenging but fun. It was just about playable at native speed but, if you increased the CPC to around 200% it was perfect. There are a few demos on here where people have come up with potential games in BASIC and they look great.
Take a look at this

https://www.cpcwiki.eu/forum/games/locomotive-basic-game-p4-return-to-ganymede
¡Mis respetos compañero!

IndyUK

Quote from: bluestar on 23:02, 16 March 23I'm here another night struggling with the main loop and how to make mummies and player running almost at the same time.

For some reason my reply didn't get posted. What i wanted to say was Well done! on your effort. Looks 100% identical to the original. With regards to your struggle. If you can share the code, I'm sure the folks here will try and help. In the meantime if I've understood you correctly. Are you looking to make the sprites move at the same time?

bluestar

Quote from: IndyUK on 23:49, 16 March 23
Quote from: bluestar on 23:02, 16 March 23I'm here another night struggling with the main loop and how to make mummies and player running almost at the same time.

For some reason my reply didn't get posted. What i wanted to say was Well done! on your effort. Looks 100% identical to the original. With regards to your struggle. If you can share the code, I'm sure the folks here will try and help. In the meantime if I've understood you correctly. Are you looking to make the sprites move at the same time?
Thanks! I'll give another few tries before sharing the code ;) (quite stubborn here), altough any orientation is more than welcome. Yeah you understood all right. I know there is no such a thing like paralellism, but if do things fast in the main loop I can got that perception. The mummies must be in motion no matter the user press any key to control the player. Currently I'm in that point where mummies slow down when I press a control key (not sttopped, but slow down...)

Powered by SMFPacks Menu Editor Mod