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

0 Members and 1 Guest are viewing this topic.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
It's done shifting sprite bytes for every movement. You can check the full code of the move1pixel example: it's included with latest version of CPCtelera :) .


Ok, so if I'm reading it properly you're dividing the number of pixels per byte to generate the effect.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Not exactly. CPCtelera's drawing functions draw sprites at byte locations. Division is there to convert pixel coordinates to byte locations.

The 1-pixel movement is based on shifting functions (shiftSpritePixelsRight / shiftSpritePixelsLeft). Each shift moves the sprite 1 pixel to the left or to the right in-place (inside the sprite buffer). Then the sprite is drawn normally copying bytes to screen with cpct_drawSprite function.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2278
  • Likes Given: 3478
Cygwin can fuck off.
I believe EgoTrip's point is that for windows users there is no simple one click installer?




My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
@arnoldemu: Having one-click installers would be marvellous. If someone wants to develop and maintain them, I would be more than happy :D.

Offline EgoTrip

  • 6128 Plus
  • ******
  • Posts: 1.058
  • Country: gl
    • http://egochip.blogspot.co.uk/
  • Liked: 704
  • Likes Given: 301
Well yeah, a 1-click would be nice. However, sitting around waiting for an hour to download, then 2 hours later it still had not finished installing, I just gave up cos there was no sign of it ever ending. All I did was try to install the devel package for gcc. Nothing else.

I'm going to try CPC Basic but thats not really going to  cut it from what I can gather. I need a proper coder who knows what they are doing really but nobody wants to get involved, theres no financial incentive and maybe my game ideas are just crap really.
EgoTrip's Stuff
EgoTrip's Stuff

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
@EgoTrip: That happens when you select a slow mirror for Cygwin. It has happened to me sometimes. Last time I was waiting for 10 minutes, then I cancelled, picked up a different mirror and everyting installed in 3 minutes.

Organizations set up mirrors with their own means and they are not always able to cope with demand.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Not exactly. CPCtelera's drawing functions draw sprites at byte locations. Division is there to convert pixel coordinates to byte locations.

The 1-pixel movement is based on shifting functions (shiftSpritePixelsRight / shiftSpritePixelsLeft). Each shift moves the sprite 1 pixel to the left or to the right in-place (inside the sprite buffer). Then the sprite is drawn normally copying bytes to screen with cpct_drawSprite function.


Cool, so the bytes are either Added or Subtracted by &55 to obtain the next pixel position.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
#CPCtelera 1.2.3 critical bugfix release
« Reply #257 on: 10:18, 14 August 15 »
As discussed yesterday, there is another occurence of the tail jumping bug when using __z88dk_callee functions in SDCC 3.5.0. This is a critical bug, as programs suffering it crash due to a bad optimization made by the compiler.

So, we have issued a new bugfix release of CPCtelera, fixing this bug. Everyone is urged to update.

You have more details on this update on its release notes.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.417
  • Country: au
    • index.php?action=treasury
  • Liked: 1110
  • Likes Given: 1320
Re: #CPCtelera 1.2.3 critical bugfix release
« Reply #258 on: 14:57, 14 August 15 »
As discussed yesterday, there is another occurence of the tail jumping bug when using __z88dk_callee functions in SDCC 3.5.0. This is a critical bug, as programs suffering it crash due to a bad optimization made by the compiler.

So, we have issued a new bugfix release of CPCtelera, fixing this bug. Everyone is urged to update.

You have more details on this update on its release notes.

Thanks ronaldo.
I'm very happy to see cpct_isAnyKeyPressed in this release.
 :)

My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: #CPCtelera 1.2.3 critical bugfix release
« Reply #259 on: 18:57, 14 August 15 »
Yes, @ervin, I implemented the functions when you suggested it, so I only had to write documentation and include them in the release :) .

It might also be more interesting for you the new feature I have just commited to the main branch (that will be available on next releases). Now CPCtelera automatically manages .bin files included under src/ folder. It detects them and automatically makes the conversion to .c array that is compiled and included in the project. It also detects any change to the .bin files and redoes the conversion when this happens. You don't have to worry anymore about manually converting your binary files: you only save them to a folder under src/ and they are automatically managed :) .

There is a very simple example under examples/medium folder (incbin example).

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.417
  • Country: au
    • index.php?action=treasury
  • Liked: 1110
  • Likes Given: 1320
Re: #CPCtelera 1.2.3 critical bugfix release
« Reply #260 on: 16:19, 15 August 15 »
Yes, @ervin, I implemented the functions when you suggested it, so I only had to write documentation and include them in the release :) .

It might also be more interesting for you the new feature I have just commited to the main branch (that will be available on next releases). Now CPCtelera automatically manages .bin files included under src/ folder. It detects them and automatically makes the conversion to .c array that is compiled and included in the project. It also detects any change to the .bin files and redoes the conversion when this happens. You don't have to worry anymore about manually converting your binary files: you only save them to a folder under src/ and they are automatically managed :) .

There is a very simple example under examples/medium folder (incbin example).

Now THAT is a feature I will find very useful!
Thanks for implementing it.
 :)
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2278
  • Likes Given: 3478
Re: #CPCtelera 1.2.3 critical bugfix release
« Reply #261 on: 17:47, 15 August 15 »
Nice!
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
You might need a "Clear Input" Void to go with that "Any Key" Routine?
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
@AMSDOS: "Clearing input" is a concept used when using intermediate buffers between keypresses and software key reads. That's not the case here. Keyboard functions access the present status of the keys. So, if a key is being pressed, there is no way to "clear it" as you only can wait for the user to stop pressing it. In other words, the status will be "pressed" until the user releases it.

So, using cpct_anyKeyPressed(), the solution is using 2 loops: a first loop that waits until no key is pressed and then, another loop that waits for a keypress. That's the way to ensure that a key has been pressed voluntarily by the user. This is a code sample for doing that:
Code: [Select]
void wait4Keypress() {
   // First, if there is any key pressed, we wait until no key is pressed
   do { cpct_scanKeyboard_f(); } while ( isAnyKeyPressed() );

   // Then we wait until a Key is pressed
   do { cpct_scanKeyboard_f(); } while ( !isAnyKeyPressed() );
}
« Last Edit: 12:01, 16 August 15 by ronaldo »

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Yeah so usually what happens is a buffer of user input has been generated, and needs to be cleared, otherwise the Any key routine just does it's own thing, which could be taking you back into the game and if your lucky some user input from earlier if running the game.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: #CPCtelera 1.2.3.
« Reply #265 on: 12:00, 16 August 15 »
[quote
[...] what happens is a buffer of user input has been generated, and needs to be cleared, [...]
That usually happens on nowadays machines and operative systems. OS are those who create and maintain buffers for user input. That does not happen on a CPC when you directly program its hardware, like CPCtelera does. All keyboard functions from CPCtelera do scan and report present keyboard status, with no input buffers (not like modern OSes).

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
I see what your saying, but what I'm asking is does the "Any Key" Routine need something to clear the buffer? I would have thought the Hardware Especially keeps a Buffer of Backlogged key-presses, otherwise you've got yourself a computer ignoring Key-presses.
Would of thought something for Clearing the Buffer needed to be kept separate from an "Any Key" routine, I don't know, just thought that if the Buffer was Cleared before the "Any Key" routine was called, would a key become ignored?
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: #CPCtelera 1.2.3.
« Reply #267 on: 12:42, 16 August 15 »
I'm asking is does the "Any Key" Routine need something to clear the buffer? I would have thought the Hardware Especially keeps a Buffer of Backlogged key-presses, otherwise you've got yourself a computer ignoring Key-presses.
No, hardware does not have any buffer. Keyboard is directly scanned to see if keys are pressed or not.

Quote from: AMSDOS
I don't know, just thought that if the Buffer was Cleared before the "Any Key" routine was called, would a key become ignored?
Keys could be ignored if your keyboard scanning frequency is low, and a user presses and releases a key between two scans. If you scan keyboard 25/50 times per seconds that's unlikely. However, as your frequency decreases, you may experience ignored keys. In fact, you can see this happening on lot of games with low framerate (as they may be scanning keyboard once per frame drawn to screen).
« Last Edit: 13:09, 16 August 15 by ronaldo »

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
I guess this is where games were tested for playability and reviewers would say if a game was unplayable. So it would seem there was more than one way of scanning the keyboard. Even on @arnoldemu website there's a routine which is considered CPC Plus unfriendly.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: #CPCtelera 1.2.3.
« Reply #269 on: 14:12, 17 August 15 »
I guess this is where games were tested for playability and reviewers would say if a game was unplayable. So it would seem there was more than one way of scanning the keyboard. Even on @arnoldemu website there's a routine which is considered CPC Plus unfriendly.
To my knowledge, there is only one way of scanning the keyboard. You can arrange it in multiple ways (scan only some keys, scan the complete keyboard, store scanned status or not...), but I only know of a way to scan it.

Anyways, the kind of unplayability you are referring comes from low scan frequency, not from different ways of scanning. Games tend to scan for user input once on every iteration of the game loop. If a game runs at 6 FPS, that lefts the player with a maximum of 6 actions per second. Moreover, you may have a delay up to 0,16s between a keypress and its reaction. That drives the game unplayable, in most cases.
« Last Edit: 14:21, 17 August 15 by ronaldo »

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924

Cool, so the bytes are either Added or Subtracted by &55 to obtain the next pixel position.


i tested this out, though my comment isn't correct in the sense it's not being added or subtracted, but shifted, and for a graphic to shift from one spot to another depending on direction relies on it being shifted by either &55 or &AA which are based on Left Most Pixel or Right Most Pixel in a 7 or 8 bit format.


The routine obviously works, though I cannot workout (from a sprite driver I made a few years ago, which allows for 1 byte pixel movement), the encoded byte results from it.


For example a Left Byte Position looks like this:


Code: [Select]
&C0,&40,&40,&80

which becomes:


Code: [Select]
&40,&80,&80,&C0

Don't think I'm shifting based on Byte positions.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

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 Ronaldo, I am curious...why did you remove the maze game example from master branch?


Cheers




Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 928
  • Liked: 458
  • Likes Given: 73

i tested this out, though my comment isn't correct in the sense it's not being added or subtracted, but shifted, and for a graphic to shift from one spot to another depending on direction relies on it being shifted by either &55 or &AA which are based on Left Most Pixel or Right Most Pixel in a 7 or 8 bit format.


The routine obviously works, though I cannot workout (from a sprite driver I made a few years ago, which allows for 1 byte pixel movement), the encoded byte results from it.


For example a Left Byte Position looks like this:


Code: [Select]
&C0,&40,&40,&80

which becomes:


Code: [Select]
&40,&80,&80,&C0

Don't think I'm shifting based on Byte positions.

&55 and &AA wouldn't be values to shift by, they'd be pixel masks to AND with. You're encoding each byte so that both the left and right pixels are set to the same Pen, then you can extract the left pixel by ANDing the encoded value with &AA or the right pixel by ANDing with &55. The two subsequent values can then be OR'd to get the final value to write to the display.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
&55 and &AA wouldn't be values to shift by, they'd be pixel masks to AND with. You're encoding each byte so that both the left and right pixels are set to the same Pen, then you can extract the left pixel by ANDing the encoded value with &AA or the right pixel by ANDing with &55. The two subsequent values can then be OR'd to get the final value to write to the display.


I wrote this little example using AND to move left and right pixels to the Right:


Code: [Select]
org &4000

ld a,(&c000)
and &aa
ld (&c001),a
ld a,(&c000)
and &55
ld (&c000),a


I guess to implement it in a working environment, it would be applied from the Right Edge of the Sprite, moving backward though a loop and going down. Which I presume would mean the opposite when moving the Sprite Left.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: #CPCtelera 1.2.3
« Reply #274 on: 10:08, 20 August 15 »
Hey Ronaldo, I am curious...why did you remove the maze game example from master branch?
Because I merged it to the master branch by mistake. It's still under development, on its own branch. It will return to master branch once finished ;).