### Author Topic: Breakout game assembly  (Read 652 times)

0 Members and 1 Guest are viewing this topic.

#### nico24

• CPC464
• Posts: 16
• Country:
• Liked: 8
##### Breakout game assembly
« on: 04: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

#### Johnny Olsen

• Supporter
• CPC6128
• Posts: 203
• Country:
• Liked: 124
##### Re: Breakout game assembly
« Reply #1 on: 09:31, 12 March 18 »
Upload the code here and we'll look at it.

#### SuTeKH/Epyteor

• 6128 Plus
• Posts: 1.266
• Country:
• Liked: 1144
##### Re: Breakout game assembly
« Reply #2 on: 15: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?

#### Urusergi

• CPC6128
• Posts: 159
• Country:
• Liked: 241
##### Re: Breakout game assembly
« Reply #3 on: 00:52, 13 March 18 »
Hello!
the failure is very obvious. In hit_bit subrutine we have:
Code: [Select]
`            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
We also have a comment which indicates a value update of HL  so probably one instruction is missing, and it's ADD HL,BC

#### AJW

• Speccy
• Posts: 2
• Country:
• Liked: 1
##### Re: Breakout game assembly
« Reply #4 on: 04:29, 13 March 18 »
Hello!
the failure is very obvious. In hit_bit subrutine we have:
Code: [Select]
`            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
We also have a comment which indicates a value update of HL  so probably one instruction is missing, and it's ADD HL,BC

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.

#### SuTeKH/Epyteor

• 6128 Plus
• Posts: 1.266
• Country:
• Liked: 1144
##### Re: Breakout game assembly
« Reply #5 on: 12:52, 13 March 18 »

Thanks to @Urusergi 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

« Last Edit: 14:04, 13 March 18 by SuTeKH/Epyteor »

#### Johnny Olsen

• Supporter
• CPC6128
• Posts: 203
• Country:
• Liked: 124
##### Re: Breakout game assembly
« Reply #6 on: 15:30, 13 March 18 »
Almost 31 years to debug a game, it must be a new record.

#### SuTeKH/Epyteor

• 6128 Plus
• Posts: 1.266
• Country:
• Liked: 1144
##### Re: Breakout game assembly
« Reply #7 on: 16:26, 13 March 18 »
Almost 31 years to debug a game, it must be a new record.
Better late than never, huh? ^_^

#### nico24

• CPC464
• Posts: 16
• Country:
• Liked: 8
##### Re: Breakout game assembly
« Reply #8 on: 02: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...

#### freemac

• CPC6128
• Posts: 296
• Country:
• Liked: 231
##### Re: Breakout game assembly
« Reply #9 on: 20: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