Layer 2,Sprites, ULA in that order

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

Post Reply
User avatar
robpearmain
Posts: 59
Joined: Tue May 30, 2017 5:35 pm
Location: York
Contact:

Layer 2,Sprites, ULA in that order

Post by robpearmain » Sun Dec 10, 2017 9:37 pm

Is it possible to

1. Have layer2 as a scrolling background
2 Draw sprites on top of the layer2 background
3. Present the standard ULA as the last layer, effectively cropping the window sprites are displayed in

E.g having the right 25% for a HUD using the standard spectrum attributes and screen memory
Rob Pearmain
Bipboi (Zx Spectrum 48k), Harry Hedgehog (ZX Spectrum [1K]), Luna C (PC), Turbotoons (PC)

ZX Spectrum 48k, +, 128k, Next (board)

Alcoholics Anonymous
Posts: 495
Joined: Mon May 29, 2017 7:00 pm

Re: Layer 2,Sprites, ULA in that order

Post by Alcoholics Anonymous » Sun Dec 10, 2017 9:42 pm

Yes. You want ULA on top of sprites on top of layer 2?
Check out register 0x15 ( https://www.specnext.com/tbblue-io-port-system/ ):

Code: Select all

(R/W) 0x15 (21) => Sprite and Layers system
  bit 7 - LoRes mode, 128 x 96 x 256 colours (1 = enabled)
  bits 6-5 = Reserved, must be 0
  bits 4-2 = set layers priorities:
     Reset default is 000, sprites over the Layer 2, over the ULA graphics
     000 - S L U
     001 - L S U
     010 - S U L
     011 - L U S
     100 - U S L
     101 - U L S
  bit 1 = Over border (1 = yes)(Back to 0 after a reset)
  bit 0 = Sprites visible (1 = visible)(Back to 0 after a reset)
You want the "USL" one - binary 100. In your ULA screen, use the global transparent colour to allow layers underneath to be seen.

Keep in mind that each layer - ula, sprites, layer 2 - has a clipping window too. So you can confine each layer to a rectangle with the layer transparent outside the clipping rectangle. That's in registers 0x18 to 0x1c.

User avatar
robpearmain
Posts: 59
Joined: Tue May 30, 2017 5:35 pm
Location: York
Contact:

Re: Layer 2,Sprites, ULA in that order

Post by robpearmain » Sun Dec 10, 2017 9:48 pm

Fantastic. I missed the clipping functions, excellent they are in there.

Essentially I want the left 75% to be the game area and the right 25% to hold the score etc (imagine trans am), with a cool scrolling layer2 and sprites that smoothly disappear off one side of the screen and reappear on the other (pac man for example)

Thanks for the quick reply m8
Last edited by robpearmain on Sun Dec 10, 2017 9:54 pm, edited 1 time in total.
Rob Pearmain
Bipboi (Zx Spectrum 48k), Harry Hedgehog (ZX Spectrum [1K]), Luna C (PC), Turbotoons (PC)

ZX Spectrum 48k, +, 128k, Next (board)

Alcoholics Anonymous
Posts: 495
Joined: Mon May 29, 2017 7:00 pm

Re: Layer 2,Sprites, ULA in that order

Post by Alcoholics Anonymous » Sun Dec 10, 2017 9:54 pm

robpearmain wrote:
Sun Dec 10, 2017 9:48 pm
Fantastic. I missed the clipping functions, were they added recently?
Yes a recent-ish feature mid Nov maybe?
Thanks for the quick reply m8
Np just happened to be online :)

Post Reply