Subject: [stella] the matrix unveiled From: Piero Cavina <p.cavina@xxxxxxxxxxxxx> Date: Mon, 14 Apr 1997 14:40:19 +0200 (METDST) |
Here's how I stored in memory the matrix of tiles of my current demo/game. Each row (16 tiles) is stored as two bytes (1 bit per tile), the order of the bits was choosen so that they could be easily put into the playfield control registers. This is the first row, the following row goes into PFMAP+2, PFMAP+3 and so on. 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 screen 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 O = tile O . O . O . O . O . O . O . O . O . O . O . O . O . O . O . O . . = always blank | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +---|PF1|---|-+ +---|PF2|---|-+ +---|PF1|---|-+ +---|PF2|---|-+ | | | | | | | | | | | | | | | | V V V V V V V V V V V V V V V V 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 PFx registers | | | | | | | | | | | | | | | | | /-|---|---|---|---|---|---/ | /-|---|---|---|---|---|---/ | | | /-|---|---|---|---/ | | | /-|---|---|---|---/ | | | | | /-|---|---/ | | | | | /-|---|---/ | | | | | | | /-/ | | | | | | | /-/ V V V V V V V V V V V V V V V V 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 memory PFMAP PFMAP+1 Please note that PF0 isn't used. The following code prepares the values to be put into PFx, it's inside the kernel executed during the blank lines between two rows of tiles. LDY MAPPNT ; pointer to the first byte of the current row LDA PFMAP,Y AND #%10101010 STA TEMP+1 LDA PFMAP,Y AND #%01010101 STA TEMP+2 LDA PFMAP+1,Y AND #%01010101 STA TEMP+3 LDA PFMAP+1,Y AND #%10101010 STA TEMP+4 INC MAPPNT INC MAPPNT Then in the following lines TEMP, TEMP+1... will be put into PF1, PF2 and PF2, PF2 again. There's also a subroutine, called two or three times during VBLANK, that allows to peek and poke into the map given two row and column numbers. Ciao, P. -- Archives available at http://www.biglist.com/lists/stella/archives/ E-mail UNSUBSCRIBE in the body to stella-request@xxxxxxxxxxx to be removed.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] Linking 2600 consoles?, kickass | Thread | [stella] PAL<->NTSC colors, Piero Cavina |
Re: [stella] My game - Alpha 2 - in, Erik Mooney | Date | [stella] PAL<->NTSC colors, Piero Cavina |
Month |