CPCWiki forum

General Category => Programming => Topic started by: nico24 on 03:03, 12 March 18

Title: Breakout game assembly
Post by: nico24 on 03:03, 12 March 18
Hi,

Would anyone happen to have the source code of the Amstrad Computer User, August '87 article called Assembly Point. It had the listing of a Breakout type game? I have spend the weekend (what little time I have not looking after kids etc.) typing it in from the listing and it doesn't seem to work. I've done a couple of scans of the code and can't find any obvious mistakes.

Otherwise I'll have to break it down and try to get each element working. Not great considering I'm a real novice!

Thanks in advance in anyone can help.

Kind regards,

Nick
Title: Re: Breakout game assembly
Post by: Johnny Olsen on 08:31, 12 March 18
Upload the code here and we'll look at it.
Title: Re: Breakout game assembly
Post by: tastefulmrship on 14:27, 12 March 18
I have typed it in (as best I can)... and it almost works, but the ball misses some bricks!
Was there a correction to this program in a later issue, I wonder?



Title: Re: Breakout game assembly
Post by: Urusergi on 23:52, 12 March 18
Hello!
the failure is very obvious. In hit_bit subrutine we have:

            sla    c
            rl    b            ; multiply BC by 2
            ld    c,b
            ld    b,0            ; and divide by 256, overall effect is to divide BC by 128
                                 ; now HL=address of required byte within bitmap table

            ld    bc,p2            ; point BC  to "powers of 2" table

We are calculating a value for BC and, suddenly, it loads BC with another value  :doh:
We also have a comment which indicates a value update of HL  ::) so probably one instruction is missing, and it's ADD HL,BC  ;D

Title: Re: Breakout game assembly
Post by: AJW on 03:29, 13 March 18
Quote from: Urusergi on 23:52, 12 March 18
Hello!
the failure is very obvious. In hit_bit subrutine we have:

            sla    c
            rl    b            ; multiply BC by 2
            ld    c,b
            ld    b,0            ; and divide by 256, overall effect is to divide BC by 128
                                 ; now HL=address of required byte within bitmap table

            ld    bc,p2            ; point BC  to "powers of 2" table

We are calculating a value for BC and, suddenly, it loads BC with another value  :doh:
We also have a comment which indicates a value update of HL  ::) so probably one instruction is missing, and it's ADD HL,BC  ;D


Yup, that seems to fix it. Well spotted. Personally, I think it needs a bit more work anyway: it restarts immediately when your last life is gone, before you have a chance to read the score. A nice little game though.
Title: Re: Breakout game assembly
Post by: tastefulmrship on 11:52, 13 March 18

Thanks to @Urusergi (http://www.cpcwiki.eu/forum/index.php?action=profile;u=923) for finding the fault in hit_bit! It works a treat, now! ^_^

Attached is a .dsk with the original .asm file and a slightly updated BASIC loader! I have added a "do you want to play again?" section instead of the game just restarting!


All in all, for a tiny assembler type-in, this is quite an addictive little game! Nice find, @nico24 (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1959)



Title: Re: Breakout game assembly
Post by: Johnny Olsen on 14:30, 13 March 18
Almost 31 years to debug a game, it must be a new record.  :laugh:

Title: Re: Breakout game assembly
Post by: tastefulmrship on 15:26, 13 March 18
Quote from: Johnny Olsen on 14:30, 13 March 18
Almost 31 years to debug a game, it must be a new record.  :laugh:
Better late than never, huh? ^_^
Title: Re: Breakout game assembly
Post by: nico24 on 01:19, 14 March 18
Well - can't say how happy I am that you helped out with this. Really appreciated

Kind of bummed I wasted all that time typing it in though!! Kidding...
Title: Re: Breakout game assembly
Post by: freemac on 19:38, 19 March 18
run fine on WinAPE assembler, just adding this line :
run $
just after
org &8000
and enabling AMX Mouse input as control
Powered by SMFPacks Menu Editor Mod