Author Topic: Scramble - New game for Amstrad CPC  (Read 12022 times)

0 Members and 1 Guest are viewing this topic.

Offline PuzCPC

  • CPC464
  • **
  • Posts: 48
  • Country: si
  • Liked: 149
  • Likes Given: 61
Re: Scramble - New game for Amstrad CPC
« Reply #50 on: 15:48, 10 March 19 »
Very interesting!

I'm wondering if it can be optimised a little bit.
 8)

Code: [Select]
ADD HL,BC
DEC A
OR A
JR NZ,LOOP
RET

Is the OR A needed?

Actually, I notice that you're using ADD HL,BC.
Is DE free in your sprite loop?
If it is, you can use ADD HL,DE instead.
That will then allow you to replace the looping code I've quoted just above with DJNZ, if you use B as the loop counter instead of A.




Is the OR A needed? You right! No!
This code is for drawing 8x136px  tall sprite. Yes, I need DE for sprite loop.
ADD HL,BC is the same as:
LD A,L
ADD &50
LD L,A
JR NC,SKIP
INC H

SKIP:
No more space for optimizing anything. I think. :)
« Last Edit: 16:03, 10 March 19 by PuzCPC »

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 597
  • Country: fr
  • Liked: 478
  • Likes Given: 1030
Re: Scramble - New game for Amstrad CPC
« Reply #51 on: 16:02, 10 March 19 »
@PuzCPC and @ervin

Can you explain me a little about compiled sprites ?

All i my understand is the sprite datas are directly included in the code. That right ?

 ;D

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.117
  • Country: fr
  • Liked: 1048
  • Likes Given: 152
Re: Scramble - New game for Amstrad CPC
« Reply #52 on: 16:05, 10 March 19 »
Hey, why don't you use the stack instead of a loop?

RET instead of decreasing and looping.
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline PuzCPC

  • CPC464
  • **
  • Posts: 48
  • Country: si
  • Liked: 149
  • Likes Given: 61
Re: Scramble - New game for Amstrad CPC
« Reply #53 on: 16:14, 10 March 19 »
Hey, why don't you use the stack instead of a loop?

RET instead of decreasing and looping.

How? Please explain.
You know, I could not even set up a new stack addr. ;D

PuzCPC

Offline PuzCPC

  • CPC464
  • **
  • Posts: 48
  • Country: si
  • Liked: 149
  • Likes Given: 61
Re: Scramble - New game for Amstrad CPC
« Reply #54 on: 16:21, 10 March 19 »
@PuzCPC and @ervin

Can you explain me a little about compiled sprites ?

All i my understand is the sprite datas are directly included in the code. That right ?

 ;D

I'm still a student and not a teacher. ;D ;D

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.117
  • Country: fr
  • Liked: 1048
  • Likes Given: 152
Re: Scramble - New game for Amstrad CPC
« Reply #55 on: 18:27, 10 March 19 »
It's something called "RET table". It requires you to divert the stack, at least momentarily.

Let's say you want to have a "displayStuff" called 5 times. The normal way, using A:
   ld a,5
displayStuff
   ...
   dec a
   jr nz,displayStuff

With a RET table:
   ld sp,RetTable
DisplayStuff
   ...
   ret
AfterDisplayStuff
   ...
RetTable
   dw DisplayStuff
   dw DisplayStuff
   dw DisplayStuff
   dw DisplayStuff
   dw DisplayStuff
   dw AfterDisplayStuff

This saves one 8 bit register, and is one cycle faster (RET is 3 cycles, djnz is 4/3 if no jump, dec a+jr nz is the same).
This has some constraint of course, but I think it is rather elegant. You can also set SP to RetTable + 2/4/6 etc. if you need to change the loop counter, no need to duplicate the RetTable if you don't need to.

« Last Edit: 18:28, 10 March 19 by Targhan »
Targhan/Arkos

Arkos Tracker 2 - alpha 9 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Offline PuzCPC

  • CPC464
  • **
  • Posts: 48
  • Country: si
  • Liked: 149
  • Likes Given: 61
Re: Scramble - New game for Amstrad CPC
« Reply #56 on: 19:31, 10 March 19 »

Hi,
Thank you very much for the explanation!
This will help me at the next project.
PuzCPC

Offline AxelStone

  • CPC664
  • ***
  • Posts: 106
  • Country: es
  • CPC 464+
  • Liked: 42
  • Likes Given: 11
Re: Scramble - New game for Amstrad CPC
« Reply #57 on: 21:27, 10 March 19 »
The feeling is totally arcade, really a great job!!  ;) ;)

Offline jomicamp

  • CPC464
  • **
  • Posts: 27
  • Liked: 10
  • Likes Given: 28
Re: Scramble - New game for Amstrad CPC
« Reply #58 on: 02:53, 11 March 19 »
Fantastic job!
What a great conversion! Congratulations and, by the way,...
What about converting Galaga??!!  ;D


Best regards

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.325
  • Country: au
    • index.php?action=treasury
  • Liked: 987
  • Likes Given: 1154
Re: Scramble - New game for Amstrad CPC
« Reply #59 on: 08:36, 11 March 19 »
@PuzCPC and @ervin

Can you explain me a little about compiled sprites ?

All i my understand is the sprite datas are directly included in the code. That right ?

 ;D

Hi Arnaud.

A compiled sprite is actually a program/function that draws the sprite.
It's fast because it doesn't have to navigate through a data table of byte values, but it takes up more memory because it contains the instructions *and* the byte values to print the sprite.
It's very helpful for transparency, as there is no need to check for a transparent byte value. That byte can simply be skipped over with INC in the compiled sprite code.

This is a great post to read:
http://www.cpcwiki.eu/forum/programming/compiled-sprites/msg124169/#msg124169
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 Golem13

  • CPC664
  • ***
  • Posts: 50
  • Country: fr
  • Liked: 199
  • Likes Given: 173
Re: Scramble - New game for Amstrad CPC
« Reply #60 on: 15:20, 11 March 19 »
Excellent conversion.
Really very good work, with a sensations and result very faithful to the arcade.
Congratulations, I just love it!

Offline dakidski

  • Speccy
  • *
  • Posts: 2
  • Country: dk
  • Liked: 1
  • Likes Given: 0
Re: Scramble - New game for Amstrad CPC
« Reply #61 on: 21:25, 11 March 19 »
Simply amazing. Thanks!

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 597
  • Country: fr
  • Liked: 478
  • Likes Given: 1030
Re: Scramble - New game for Amstrad CPC
« Reply #62 on: 21:34, 11 March 19 »
Hi Arnaud.

A compiled sprite is actually a program/function that draws the sprite.
It's fast because it doesn't have to navigate through a data table of byte values, but it takes up more memory because it contains the instructions *and* the byte values to print the sprite.
It's very helpful for transparency, as there is no need to check for a transparent byte value. That byte can simply be skipped over with INC in the compiled sprite code.

This is a great post to read:
http://www.cpcwiki.eu/forum/programming/compiled-sprites/msg124169/#msg124169

Thanks @ervin,
i just tried to draw opaque sprite in this way and i have got a moderate speed gain (around %20) but it takes too much memory.

Offline Xyphoe

  • 6128 Plus
  • ******
  • Posts: 891
  • Country: gb
    • GX4000.CO.UK
  • Liked: 322
  • Likes Given: 183
Re: Scramble - New game for Amstrad CPC
« Reply #63 on: 22:46, 11 March 19 »
Amazing work! I think it's arcade perfect!
Here's my little longplay of it (1 loop, no life lost) taken from Friday's Amstream :)


https://www.youtube.com/watch?v=maQN0NZUhfw

Offline alex76gr

  • CPC664
  • ***
  • Posts: 143
  • Country: gr
  • Liked: 92
  • Likes Given: 40
Re: Scramble - New game for Amstrad CPC
« Reply #64 on: 12:45, 12 March 19 »
Another hi-score after 2 complete loops.
I'll be back.
« Last Edit: 12:48, 12 March 19 by alex76gr »
I still believe that i got my myopia from the green GT-65 monitor, but i can't prove it! :)

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 1.227
  • Country: gr
    • Parts from the past.
  • Liked: 695
  • Likes Given: 1781
Re: Scramble - New game for Amstrad CPC
« Reply #65 on: 13:01, 12 March 19 »
When the highscore race started, I had Alex in mind...
You have no chance.

Offline Hammer

  • CPC464
  • **
  • Posts: 4
  • Country: de
  • Liked: 1
  • Likes Given: 2
Re: Scramble - New game for Amstrad CPC
« Reply #66 on: 19:18, 12 March 19 »
Will there be a tape version for all the 464 users?

Offline MiGaNuTs

  • CPC464
  • **
  • Posts: 10
  • Country: fr
  • Liked: 11
  • Likes Given: 9
Re: Scramble - New game for Amstrad CPC
« Reply #67 on: 19:24, 12 March 19 »
omg, it's so fast !
good job.

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.862
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 841
  • Likes Given: 2093
Re: Scramble - New game for Amstrad CPC
« Reply #68 on: 00:03, 13 March 19 »
Decades ago I loved to play Avenger on CBS, I got really good at that, now I suck with entering higher stages here... but hey, I can poke it.  ;D



http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline PuzCPC

  • CPC464
  • **
  • Posts: 48
  • Country: si
  • Liked: 149
  • Likes Given: 61
Re: Scramble - New game for Amstrad CPC
« Reply #69 on: 15:28, 13 March 19 »

Hi,
Tape version is added! 8)


Amazing work! I think it's arcade perfect!
Here's my little longplay of it (1 loop, no life lost) taken from Friday's Amstream :)


Thanks for the video! I enjoyed watching! GG  :)



Another hi-score after 2 complete loops.
I'll be back.



Omg, you're really good! :o
For me, meteors are usually fatal.
Same as on a Arcade when I was a boy. ;D


Offline SpDizzy

  • CPC464
  • **
  • Posts: 44
  • Country: es
  • Liked: 18
  • Likes Given: 22
Re: Scramble - New game for Amstrad CPC
« Reply #70 on: 12:38, 21 March 19 »
Hi,
Tape version is added! 8)
Thanks so much for that .cdt version, just waiting to enjoy it on my 464!!

Offline zhulien

  • 464 Plus
  • *****
  • Posts: 490
  • Country: au
    • 8bitology
  • Liked: 194
  • Likes Given: 143
Re: Scramble - New game for Amstrad CPC
« Reply #71 on: 19:27, 30 March 19 »
I just watched the Xyphoe video of Scramble, wow!!!  that's awesome.

It makes my all time best arcade port list to Amstrad CPC for sure, which is now (not in any specific order):


- Scramble- Frogger
- R Type (both versions, but the remake obviously is noteworthy)
- Donkey Kong
- Moon Cresta
- Elevator Action *
- Star Wars *
- Empire Strikes Back *


* only just worthy of best arcade port list, in all cases the audio isn't faithful enough but I love the Elevator Action music though


Offline zhulien

  • 464 Plus
  • *****
  • Posts: 490
  • Country: au
    • 8bitology
  • Liked: 194
  • Likes Given: 143
Re: Scramble - New game for Amstrad CPC
« Reply #72 on: 19:36, 30 March 19 »
Will we ever see a Super Cobra port?  Perhaps 90% of Scramble source can be re-used for that?  or a physical release (wishful thinking)?
« Last Edit: 20:44, 30 March 19 by zhulien »

Offline BSC

  • CPC6128
  • ****
  • Posts: 238
  • Country: de
  • CPC 464 aspirant
    • my (Android) mobile game
  • Liked: 298
  • Likes Given: 266
Re: Scramble - New game for Amstrad CPC
« Reply #73 on: 22:49, 30 April 19 »
Hej PuzCPC, your game looks fantastic and was among my favourites back in the olden days. Well done!

Offline XeNoMoRPH

  • Supporter
  • 6128 Plus
  • *
  • Posts: 721
  • Country: es
  • " ... in space no one , can hear you scream ... "
  • Liked: 1524
  • Likes Given: 1197
your amstrad news source in spanish language : https://auamstrad.es