3

I would like to blank out a couple of lines between two given rasterlines. Above that I'm planning to have a scrolling background and sprites, below that is a textual info area.

enter image description here

I'm thinking of a rasterline interrupt that turns on the blanking and a second one turning it off a couple of rasterlines later. Half-drawn characters and sprites should be covered by the bar. For this reason I cannot realize it with sprites, because the sprites are in use.

For scrolling, the VIC chip provides the feature of increasing the borders, which covers scrolling artifacts, but this feature only works at the border. Bit 4 of register $D011 provides a blank out feature, but this one only starts at rasterline 0 and blanking cannot be controlled to turn on/off during one frame.

Any good idea how to realize this?

  • If you have lined up your timing precisely with the beam, I think switching the screen from narrow to wide on just the right cycle would probably work, but you'd probably have to adjust vertical scrolling as well to prevent a badline from hitting at the critical time (I think a badline would hit just before the required store). A comment rather than an answer because I'm not sure if this would work. – supercat Jul 31 at 15:47
4

I found a very compact solution that requires only two memory writes to enable the bar:

It uses a combination of Extended Color Mode (ECM) with Bitmap Mode (BMM), which the VIC cannot display - it is going into some sort of blanking mode instead. This provides a good separation line for the scrolled characters. After a couple of rasterlines (I used 12) the normal text mode is turned back on. To avoid jumping of the lines, it is necessary to force a badline. Luckily this is done via the same register as for the ECM and bitmap mode, so the following code does the trick (raster1 is the rasterline where the blanking area starts):

lda #$78 + ((raster1+1) & 7) ;turn on ECM and BMM and cause a badline at line raster1+1
sta $D011

As a welcome side effect, this also sets the 9th bit of the next raster line IRQ.

Unfortunately, the ECM+Bitmap blank does not cover the sprites, to cut off a sprite in mid-drawing I temporarily switch the screen pointer to a location where SCREEN+$3f8 are pointing to an empty sprite. Since there is no output of characters, the other content of the screen area does not matter. I used $0000 as screen address during blanking and had the empty sprite at $340 (so address $3f8 to $3ff contain $0d):

lda #$05
sta $d018   ;change sprite pointers by switching screen

That's it to start the blanking bar, two memory writes. To end the bar, I set these two addresses back after a couple of rasterlines. In my experiment, I used a rasterline IRQ to start blanking at line 150 (this is in the middle of a character) and ended the blanking bar in 162. The gray border showing in the picture is an additional effect that can be left out.

Example with a cut off sprite

One disadvantage is that the bar created with ECM+BMM is always black, but for my purpose this is acceptable.

| improve this answer | |
  • This should be the accepted answrt – OmarL Aug 1 at 7:01
  • I would expect that switching screen width at just the right time would blank the screen to the border color, rather than black, and would affect sprites rather than just the background. – supercat Aug 2 at 3:34
  • @supercat Why? Screen width does not influence the display other than right at the edges. – OmarL Aug 3 at 16:21
  • @OmarL: The VIC-II chip has a circuit that triggers "border/blanking" mode when the raster reaches the right edge of the screen and presumably cancels that mode when it reaches the left. If the screen width is decreased on the cycle where the raster would hit the right edge, the raster will progress from being one cycle before the right edge, to one cycle after the right edge, without triggering the circuit. That's how "sprites in the side border" demos work. I would expect that border blanking is turned off in analogous fashion at the left edge, but I haven't tested that. – supercat Aug 3 at 16:28
  • @supercat oh, kind of like the "opening border trick", but in reverse, that's a clever idea – OmarL Aug 4 at 8:49
1

There may still be a way that you can use sprites to achieve this: If you have raster interrupt firing at the right time, then you can reprogram the sprites to cover the right area.

Then your next interrupt will fire to turn the "blanking" back off. At this time you set the sprites to be what you need in the top area.

This simple trick is known as sprite multiplexing.


With judicious or clever graphical design, it might be unnecessary to do this. If you can set your background colour, attributes and the border colour all the same, and make sure that graphical data never gets written to this area, then you can safely switch to text mode when you need. But this depends on where your badlines are, exactly how tall you want the blank region, and so on.

| improve this answer | |
  • I remember an adventure game that did something like this - high res picture at the top, text at the bottom and a row of expanded black sprites covering the junction between the two areas to hide the raster flicker. – Alan B Jul 31 at 10:09
  • @AlanB, that could have been maniac mansion or some such. I'm pretty sure there's a question on this site about it – OmarL Jul 31 at 10:23
  • @AlanB - to be honest you shouldn't need to use sprites to hide a raster flicker you just whack a few NOPs or other commands in the interrupt loop to move the raster off screen to remove the flicker. – Rich Campbell Aug 11 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.