Author Topic: #CPCtelera 1.4.2. release  (Read 72676 times)

0 Members and 1 Guest are viewing this topic.

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
You don't have to manually empty obj folders. "make clean" does it automatically for you :).

Have you checked that cpct_memset* files contain the same as github files and you don't have files that are not listed on github?

I'm unable to reproduce the warning either on Windows, Linux or Mac, and it makes no sense at all with the latest version of the code.

The final thing you can do is reinstalling cpctelera to ensure you have the latest version of everything.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.443
  • Country: au
    • index.php?action=treasury
  • Liked: 1139
  • Likes Given: 1359
You don't have to manually empty obj folders. "make clean" does it automatically for you :) .

Have you checked that cpct_memset* files contain the same as github files and you don't have files that are not listed on github?

I'm unable to reproduce the warning either on Windows, Linux or Mac, and it makes no sense at all with the latest version of the code.

The final thing you can do is reinstalling cpctelera to ensure you have the latest version of everything.

Thanks ronaldo.
A complete reinstall of cpctelera has fixed it!

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Small suggestion:
Rename the headline "Sprites" in the reference manual to "Graphics".

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
@mr_lou: why exactly do you suggest doing that?

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
@mr_lou: why exactly do you suggest doing that?

Because the chapter isn't only about sprites. At the moment it also contains a drawSolidBox() function, and in time you might add more, like e.g. a drawCircle() or what do I know. General graphical stuff.
One might also argue that "drawTile" isn't about sprites either.

Anyway, just a suggestion.

I've managed to compile my first little test, and so far I'm impressed. Very easy to get started. Creating a new project is easy, and compiling + creating a dsk is easy too.
Crazy fast text output. This is a great framework.
I think I'll start my game with CPCTelera too.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
@ronaldo: cpctelera is a nice game development environment.
If I wanted to use it with another library such as cpcrslib or my own sdcc libraries how is that supported? Do I need to edit the makefile
to make the library and link it in?

I think of cpctelera a bit like visual studio because it has a nice makefile generation script, nice tools and it's own library of cuntions so makes it easy to build programs.

I think if it would support other libraries that would make it more powerful and because the other libraries give the user a choice about the functions they want to use.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
@arnoldemu: as you have all source code included with CPCtelera, it is not difficult to add functions or even complete libraries to the project. For instance, if you wanted to link CPCRSLib along with your project, you can do it for a given individual CPCtelera project modifying the file cfg/build_config.mk:
Code: [Select]
##
## This line configures include directories for the project. Add -I<NewDirectory> to add an include folder where headers for a library reside.
##
Z80CCINCLUDE  := -I$(CPCT_SRC)
##
## This line configures linking for the project. Add -l<YourLibHere> to link with another library
##
Z80CCLINKARGS := -mz80 --no-std-crt0 -Wl-u \
                 --code-loc $(Z80CODELOC) \
                 --data-loc 0 -l$(CPCT_LIB)


You can do this either with CPCRSLib,  with your own library, with both of them... whatever you like :)

Personally, I didn't think of a way of including new libraries because of the way CPCtelera library is constructed. Right now, your final binary only includes the concrete functions you use and their requirements. The functions you don't use are never added to your binary.

Taking this into account, CPCtelera can include hundreds of functions by itself, either developed by me or contributed by anyone. There is no need to have distinct libraries and force the user to select. The user just goes to the reference manual and uses the desired functions. I think is much easier this way. Moreover, there is no need to split functionalities asking the user to pick the set of functionalities included in one versus other library. All functionalities can be together, grouped by modules just for clarity, and the user picks and uses.

Also take into account that you can directly add assembly files to your project (in ASZ80 syntax) and they will be compiled and included in your binary. That may suit your needs depending on your project requirements.

However, as you see, everything is open and easy to modify. If you have a different point of view you can easily add other libraries and use them. It's up to your needs :) . I have no plans right now to include other libraries along with CPCtelera, but I will happily include contributions to the library. If you have some assembly functions that you think could be included, that would be amazing :) . Of course, as I always do, any contribution is placed on authors file as this is not a 1-man project: I'm just one more developer, and this project rests in the work of lots of people :) .

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Because the chapter isn't only about sprites. At the moment it also contains a drawSolidBox() function, and in time you might add more, like e.g. a drawCircle() or what do I know. General graphical stuff.
I agree with your considerations, but I always battle against myself when dealing with naming :). Somethines I also thing that VIDEO items should also be included along with "Graphics".

I'll give it a thought for next release. I might rename o even reorder groups. I'll consider your suggestion, thanks :).

Thank you very much for your appreciation. There is nothing more rewarding in developing this framework that being it useful for people. Thanks :)

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Right now, your final binary only includes the concrete functions you use and their requirements. The functions you don't use are never added to your binary.

I was just about to ask that question.
Very awesome! This looks more and more intriguing.

Yes, the names are always tricky. Thinking a bit more about it, the "Strings" section also kinda belongs under "Graphics".
So.... after some more thinking, maybe the headlines are actually fine the way they are...

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Regarding TotO's Multiplay board.

It's read from BASIC using INP(&F990) and INP(&F991)

It's probably not CPCTelera specific, but I'm gonna ask anyway. How would I read these ports in CPCTelera?

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
It's read from BASIC using INP(&F990) and INP(&F991)
It's probably not CPCTelera specific, but I'm gonna ask anyway. How would I read these ports in CPCTelera?
Right now, there is no function for directly reading ports in CPCtelera. However, you can easily add one to your project. Add a file called readport.s to your project src/ folder with these contents:
Code: [Select]
_readPort::
    pop af
    pop bc
    push bc
    push af
    in  l, (c)
    ret
Then, to use this function anywere in your C code, you need to declare it as extern, like this:
Code: [Select]
extern u8 readPort(u16 port);
You can place this declaration either on an include file or directly in the C file that calls the function.

Finally, you just call the function normally:
Code: [Select]
   u8 bytes[2];

   bytes[0] = readPort(0xF990);
   bytes[1] = readPort(0xF991);
And there you go :)
« Last Edit: 21:59, 05 July 15 by ronaldo »

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 248
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 249
  • Likes Given: 181
Humm...
Ronaldo, just a small question.  ;)
This programming framework could be easily adapted to build binaries for other platforms like... say, CP/M or the Amstrad PCW?  ???
 
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Taking into account that binaries generated are Z80 binaries, I assume they should be compatible. I have generated binaries for neither of them, but they should differ on the header, am I right?

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 248
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 249
  • Likes Given: 181
Taking into account that binaries generated are Z80 binaries, I assume they should be compatible. I have generated binaries for neither of them, but they should differ on the header, am I right?

Right.  :D
 
For me, a standard CP/M header would be fine for both (CP/M and PCW).
 
Not too much problem, I believe.
 
And the plain CP/M binary, should be compatible with the CPCs (and other Z80 computers), running CP/M (not a bad idea).
 
I will have a look, then.
 
Thanks!
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Then to produce CP/M binaries the change would be to add the appropriate header when creating DSKs and CDTs. That shouldn't be so difficult. Check for global_functions.mk file. There are two macros CREATEDSK and CREATECDT. They rely on iDSK and 2CDT programs. Adding a new macro like CREATECPMDSK or similar could be used, that calls appropriate programs for adding header to binary file and creating the DSK.

Offline Paulo Garcia

  • CPC464
  • **
  • Posts: 25
  • Country: ca
  • The ninja also loves the CPC464 :)
    • Vintage Is The New Old
  • Liked: 15
  • Likes Given: 10

Hey

About the question to link CPCRSLIB with CPCtelera. Is it possible to someone summarize where CPCTelera overlaps CPCRSLIB, or why I should choose to use both (where they complement each other) ?


Being completely new to Amstrad development, I hope someone can bring some light to this.


Thanks




Paulo

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
I have a question to @ronaldo (although it might be SDCC related rather than CPCTelera related)....

I'm doing this:
Code: [Select]
if (cpct_isKeyPressed(Joy0_Up)) doStuff();
if (cpct_isKeyPressed(Joy0_Left)) doSomeOtherStuff();
if (cpct_isKeyPressed(Joy0_Right)) doSomethingElse();

When I compile that, it says to me:
src/main.c:53: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
src/main.c:54: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG

Experimenting, I tried changing my code to this:
Code: [Select]
if (cpct_isKeyPressed(Joy0_Up)) doStuff();
else if (cpct_isKeyPressed(Joy0_Left)) doSomeOtherStuff();
else if (cpct_isKeyPressed(Joy0_Right)) doSomethingElse();

Then warnings are gone.

So... it appears it requires me to use "else if" - as if a joystick can only either be up or left or right...
But a joystick can easily be both up and right, or both up and left.

Any thoughts?

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 248
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 249
  • Likes Given: 181
It seems you have two options:
1. Disable the SDCC optimizations in full (bad option, if you want the other optimizations that SDCC does).
2. Declare the variables Joy0_Up, etc. as volatile.
 
Hope this helps.
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
2. Declare the variables Joy0_Up, etc. as volatile.

But the variable Joy0_Up (and the others) are CPCTelera keyID's. Meaning, they're declared by CPCTelera.

I'll wait for a comment from @ronaldo. Maybe it is him who should declare them as volatile inside his framework?

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Sorry, guys. These days I'm presenting some work in a spanish conference (JENUI 2015) and have extremely limited time.

@Paulo Garcia: CPCRSLib has some functionalities that CPCtelera doesn't. CPCRSLib was developed years ago and was more focused on functionality. CPCtelera is very young and is mainly focused on code quality, documentation and usability. It takes way longer for any given functionality to be implemented for CPCtelera simply because there are much more requisites (mainly usability and documentation). Said this, a coder having experience with CPCRSLib may want to continue using it because it has these extra functions, and the coder is used or has previous code developed for it.

@mr_lou: this warning does not normally represent a problem. What it is saying to you is that the optimizer has found a different way of implementing your logic to make it faster. That can happen, for instance, if one of your "doStuff()" functions is still a placeholder with nothing inside or, if that function has an code flow that does nothing in general or under some assumptions. I would need to analize your code for understanding better your personal case.

@FloppySoftware, @mr_lou: Joy0_Up and other keyID values are constants. It does not make sense at all to declare them as volatile, as they shouldn't change at all and the compiler may implement them with fixed values in the code (not with a given value stored at a given memory location). Even if that was legal, it would be fatal, as it would destroy compiler possibilities to optimize based on those values being constants.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.514
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1108
  • Likes Given: 606
I feel like an idiot for asking but how do you even get this running?  I downloaded the main file and unzipped it but not sure what I do with it.
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
@Carnivac: Have you had a look to the online manual? It has install instructions

I prefer you following them to know if they have any mistake or can be better explained in any way  :)

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.514
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1108
  • Likes Given: 606
I got as far as
Quote
4. Launch setup.sh
./setup.sh

and got
Quote
'.' is not recognized as an internal or external command, operable program or batch file.

Am I even doing this in the right thing.  It said enter this stuff into the terminal and I don't know what a terminal is but the commands looked like lil DOS-type CMD thingy so I was using that.
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Am I even doing this in the right thing.  It said enter this stuff into the terminal and I don't know what a terminal is but the commands looked like lil DOS-type CMD thingy so I was using that.

The ./setup.sh is a Linux thing.
Are you trying to run it under Windows?
According to the install instructions, you need Cygwin to install on Windows. Did you download and install Cygwin?
Or what OS are you using?

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.514
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1108
  • Likes Given: 606
The ./setup.sh is a Linux thing.
Are you trying to run it under Windows?
According to the install instructions, you need Cygwin to install on Windows. Did you download and install Cygwin?
Or what OS are you using?

I installed that cygwin thing but I didn't know what it was or what it had to do with the running cpctelera bit.   Ugh.  I thought I'd had my last experiences of running linux related stuff years ago...

am trying to run this on Windows 7  64bit home thingy.


ok now i i look at my start menu i see cygwin put a folder and put cygwin terminal in it.  ok i'll try that.
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy