F'n Balls

People are still making stuff for the Sinclair related machines. Tell us about new games and other software that runs on the Spectrum, ZX80/ZX81, Pentagon and Next.
andydansby
Berk
Posts: 15
Joined: Fri Nov 24, 2017 5:09 pm

Re: F'n Balls

Post by andydansby » Fri Jul 12, 2019 11:01 am

I’m going to have to work with Antonio about that, I believe it’s in the Sprite engine. The rest of the code is standard C in Z88dk. Sprites are in assembly. Any clues where to look that might cause the snow effect?

Andy
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1076
Joined: Mon Nov 13, 2017 3:16 pm

Re: F'n Balls

Post by Ast A. Moore » Fri Jul 12, 2019 12:24 pm

andydansby wrote:
Fri Jul 12, 2019 11:01 am
I’m going to have to work with Antonio about that, I believe it’s in the Sprite engine. The rest of the code is standard C in Z88dk. Sprites are in assembly. Any clues where to look that might cause the snow effect?

Andy
Sure, look for an OUT instruction that triggers the paging and make sure it doesn’t hit any of the contended banks. The instruction is usually OUT (C),A, preceded by an LD A,bank_number/LD BC,$7FFD combo.

When I provide game fixes, I normally use a small architecture detection code and feed the appropriate bank number values, if necessary. In simple cases (when memory constraints are not an issue and speed isn’t an issue), you can simply choose a bank that is non-contended on the 128K/+2 machines (i.e. Bank 4 or 6).

Edit: Ah, now I see that during runtime, the instructions at $f1da set the bank to 1

LD A,$11
OUT (C),A

The bank switching code itself sits in Bank 0, however. So you might need to change the loader, too, so that the appropriate code is loaded in, say, Bank 4, and then change LD A,$11 to LD A,$14.
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1076
Joined: Mon Nov 13, 2017 3:16 pm

Re: F'n Balls

Post by Ast A. Moore » Fri Jul 12, 2019 1:01 pm

M’kay, this is a little puzzling. The loader is trivial enough to fix. Replace LD A,$11 at address $5b17 with LD A,$14. Now, the runtime code at $f1da is tricky—I can’t find it on the tape image. I guess it’s generated at runtime.

P.S. It is. There’s a lot of block moving and memory rearrangement (decryption?) going on.
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

andydansby
Berk
Posts: 15
Joined: Fri Nov 24, 2017 5:09 pm

Re: F'n Balls

Post by andydansby » Fri Jul 12, 2019 1:32 pm

Later on after work I can share my source code and Antonio’s code. It’s all open source.

It’ll be much easier to read.

Andy
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1076
Joined: Mon Nov 13, 2017 3:16 pm

Re: F'n Balls

Post by Ast A. Moore » Fri Jul 12, 2019 1:54 pm

Cool, except I’m not very good at C. Fortunately, bank switching isn’t rocket science, I think I’ll manage. ;)
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

andydansby
Berk
Posts: 15
Joined: Fri Nov 24, 2017 5:09 pm

Re: F'n Balls

Post by andydansby » Fri Jul 12, 2019 2:08 pm

FASE is pure assembly. My code interfaces with Antonio assembly via a function call. I’ll fill in the details a little later on.

Andy
0 x

andydansby
Berk
Posts: 15
Joined: Fri Nov 24, 2017 5:09 pm

Re: F'n Balls

Post by andydansby » Sun Jul 14, 2019 12:16 pm

With the tireless efforts of Ast. A Moore and Antonio Villena. I have compiled a new version of F'n Balls. Available at http://andyspeccysite.simplesite.com/. This update fixes several bugs 1)ULA rain on 128k Toast Rack and +2 Amstrad Models. 2) Key collecting bug discovered by Ast. A Moore.

Have fun.

Andy Dansby
1 x

antoniovillena
Berk
Posts: 11
Joined: Sat Dec 09, 2017 9:07 pm

Re: F'n Balls

Post by antoniovillena » Sun Jul 14, 2019 1:03 pm

About the bug, it's solved. That was ULA snow because I register was $FE and in 128K $C000 is switching between 2 pages (one of them is 7 for shadow and is contended). Solved with the help of Ast A Moore who suggest to change the I register to $3B.

About the bugs when launching on 48 BASIC on 128K machines, really there are no bugs. Just use Loader or 128K mode. I'll explain here. The engine has 3 types of machines. The loader detects the mode copy the routines and run.

Machine 0: 48K. Engine exploits floating bus (only 48K timings) for anti flickering. Good case
Machine 1: 128K. Engine exploits shadow video for anti flickering. Best case
Machine 2: Other. We don't have floating bus or shadow video (detected if paging is activated). Worst case

On machine 0 we have 26k cycles to repaint sprites, so we can manage 8 sprites without flickering. When detected the bottom bar disappears, because we paint a pattern to detect when electron beam paints this part of screen. This pattern is hidden with $00 attribute.
On machine 1 we have a whole frame (69k cycles), so we have more than 12 sprites without flickering.
On machine 2 we have only 14k cycles to repaint, that's 4-5 sprites without flickering.

The detection algorithm:

Code: Select all

IF paging available
  machine 1
ELSE
  IF bus floating
    machine 0
  ELSE
    machine 2
  END
END
The problem when you choose 48 BASIC on 128k machine (disable paging) is you have incorrect detection:
-On 128K detects machine 0, so the floating bus algorithm freezes because timings
-On +2A detects machine 2, so no freezes but less sprites without flickering

Machine 2 was thought to other non sinclair clones like Pentagon.
2 x

Post Reply