C64 Assembly - 6502/6510 - displaying a series of three bitmaps one after the other, and then moving into character mode

292 views Asked by At

I have a pretty big question here that I am finding really difficult to answer with just a couple of reference books, the internet, and yours truly.

  1. I just want to display a bitmap. Wait a couple secs.
  2. Wipe it from memory.
  3. Display another bitmap. Wait again.
  4. Wipe that one from memory.
  5. Display a final bitmap. Wait for one last time.
  6. And, you've guessed it, wipe that from memory.
  7. Then enter the standard character mode. & Continue running my code - which starts with a screen blank, and moves into asking the user for some text input etc...

Bits in bold I am having real trouble with!

This is the code I am using to run the display bitmap part, at the mo it is just going into an infinite loop...

*=$1000

        lda $4710
        sta $d020
        sta $d021
        ldx #$00

loaddccimage
        lda $3f40,x
        sta $0400,x
        lda $4040,x
        sta $0500,x
        lda $4140,x
        sta $0600,x
        lda $4240,x
        sta $0700,x
        lda $4328,x
        sta $d800,x
        lda $4428,x
        sta $d900,x
        lda $4528,x
        sta $da00,x
        lda $4628,x
        sta $db00,x
        inx
        bne loaddccimage

        lda #$3b
        sta $d011
        lda #$18
        sta $d016
        lda #$18
        sta $d018
        
        jsr *

*=$1FFE
        incbin "ASTRO1.prg"

I have, so far, tried repeating the code thinking that it could just over-write everything but the *=$1FFE doesn't seem to work chronologically, with each file, I get a memory over-write error and it always defaults to displaying the last bitmap I call with the incbin function. Is there a way to reset everything (but just go to black) between each bitmap frame? Or am I just loading these images in incorrectly?

Moving then into character mode is also going to be tricky as I can't find a way to do this even with one bitmap. Perhaps this entire code structure is the wrong way to go about, idk...

Or is this simply something the c64 can't do? I am reluctant to go here as I am sure I have seen bitmaps cycle in game intros before - just really scratching my head to figure out how it could be done.

Thanks again guys and sorry for the lack of understanding here, I am new to programming in general but think i'm on the right track. I hope that many can learn from your answers as this is genuinely something I think there isn't really any information on.

Your Commodore loving friend,

James (Smokeyparkin)

1

There are 1 answers

2
Emir Akaydın On BEST ANSWER

You have three alternatives.

  1. You can include all three bitmaps to the different memory locations and transfer them one by one to the correct location. For example you currently load your first bitmap to $2000. It's fine. You can load next bitmaps to $4800 and $7000. Then transfer them accordingly to the right places when you need to show the next bitmap.
  2. You can load bitmaps to the suitable VIC bitmap positions like $2000, $6000, $e000 etc. Then all you need to do is to change $dd00 and make bank switching. But be careful, $6000 is fine but to be able to use $e000, you need to disable Kernal ROM. Things get a little bit more trickier there, you need to fiddle with $01 values.
  3. You can use an IRQ loader like Krill's IRQ loader. You can search it on the web. Using an IRQ loader, you can include first bitmap, and then load the other bitmaps from the disk to $2000 location again and do repeat the same thing. Of course you might want to show something else, a loading message maybe during loading. Better way is to use $2000 and $6000 for the bitmap, loading next picture to the other bank and make bank switching using $dd00 again. This way your initial PRG file would only include the first picture and you can load the rest from the disk.

About going back to the character mode, just setting $d011, $d016 and $d018 to their initial values would be enough (also $dd00 if you change it).

    lda #$1b
    sta $d011
    lda #$c8
    sta $d016
    lda #$14
    sta $d018

For creating a delay, check my answer here: How to create a delay in asm for the MOS 6502

For keyboard input, check my answer here: Compare keystrokes - Assembly CCS64