disasm: $(elf)
$(OBJDUMP) -D $< >$@
-src/data-asm.o: src/data.s data/font8x8.img data/cellspr.img data/lifebg.tiles \
- data/lifefg.tiles
+src/data-asm.o: src/data.s data/font8x8.img data/cellspr.img data/simbabg.tiles \
+ data/simbafg.tiles
src/z80prog-asm.o: src/z80prog.s $(z80bin)
data/cellspr.img: data/cellspr.png
.globl cellspr_data_end
.globl cellspr_cmap
.globl cellspr_cmap_end
- .globl lifebg_data
- .globl lifebg_data_end
- .globl lifebg_cmap
- .globl lifebg_cmap_end
- .globl lifebg_tmap
- .globl lifebg_tmap_end
- .globl lifefg_cmap
- .globl lifefg_cmap_end
- .globl lifefg_tmap
- .globl lifefg_tmap_end
+ .globl simbabg_data
+ .globl simbabg_data_end
+ .globl simbabg_cmap
+ .globl simbabg_cmap_end
+ .globl simbabg_tmap
+ .globl simbabg_tmap_end
+ .globl simbafg_cmap
+ .globl simbafg_cmap_end
+ .globl simbafg_tmap
+ .globl simbafg_tmap_end
font8x8_data:
.incbin "data/font8x8.img"
font8x8_data_end:
cellspr_cmap_end:
.align 2
-lifebg_data:
- .incbin "data/lifebg.tiles"
-lifebg_data_end:
+simbabg_data:
+ .incbin "data/simbabg.tiles"
+simbabg_data_end:
.align 2
-lifebg_cmap:
- .incbin "data/lifebg.cmap"
-lifebg_cmap_end:
+simbabg_cmap:
+ .incbin "data/simbabg.cmap"
+simbabg_cmap_end:
.align 2
-lifebg_tmap:
- .incbin "data/lifebg.tmap"
-lifebg_tmap_end:
+simbabg_tmap:
+ .incbin "data/simbabg.tmap"
+simbabg_tmap_end:
.align 2
-lifefg_data:
- .incbin "data/lifefg.tiles"
-lifefg_data_end:
+simbafg_data:
+ .incbin "data/simbafg.tiles"
+simbafg_data_end:
.align 2
-lifefg_cmap:
- .incbin "data/lifefg.cmap"
-lifefg_cmap_end:
+simbafg_cmap:
+ .incbin "data/simbafg.cmap"
+simbafg_cmap_end:
.align 2
-lifefg_tmap:
- .incbin "data/lifefg.tmap"
-lifefg_tmap_end:
+simbafg_tmap:
+ .incbin "data/simbafg.tmap"
+simbafg_tmap_end:
uint32_t frameno;
uint32_t dbgval[4];
+struct part parts[2];
+static struct part *part;
+
+
int main(void)
{
int i;
dbg_init();
dna_init();
+ simba_init();
+
+ parts[0].start = dna_start;
+ parts[0].update = dna_update;
+ parts[1].start = simba_start;
+ parts[1].update = simba_update;
+ part = parts + 1;
+
+ part->start();
for(;;) {
dbg_setcursor(32, 0);
}
spr_begin();
- dna_update();
+ part->update();
vdp_wait_vblank();
spr_submit();
bndiff = bnstate ^ bnprev;
bnprev = bnstate;
+ if(bndiff & bnstate & PAD_START) {
+ if(++part >= parts + 2) {
+ part = parts;
+ }
+ part->start();
+ }
+
frameno++;
}
}
}
+void dna_start(void)
+{
+}
+
void dna_update(void)
{
static int x = 160;
+++ /dev/null
-#include <stdio.h>
-#include <stdint.h>
-#include "vdp.h"
-#include "parts.h"
-
-extern uint16_t lifebg_data[], lifebg_data_end[];
-extern unsigned char lifebg_cmap[], lifebg_cmap_end[];
-extern uint16_t lifebg_tmap[], lifebg_tmap_end[];
-
-void life_init(void)
-{
- uint16_t *src;
-
- /* upload tiles */
- src = lifebg_data;
- vdp_setup_addr(VDP_VRAM, 0);
- while(src < lifebg_data_end) {
- VDP_DATA = *src++;
- }
-}
-
-void life_start(void)
-{
- int i;
- uint16_t *src;
- unsigned char *cptr;
-
- /* setup tilemaps */
- src = lifebg_tmap;
- vdp_setup_addr(VDP_VRAM, 0xd000); /* nametable B */
- while(src < lifebg_tmap_end) {
- VDP_DATA = VDP_TILENAME(*src++, 2, 0);
- }
-
- /* setup colormaps */
- cptr = lifebg_cmap;
- for(i=0; i<16; i++) {
- vdp_setcolor(2, i, cptr[0] >> 4, cptr[1] >> 4, cptr[2] >> 4);
- cptr += 3;
- }
-}
--- /dev/null
+#include <stdio.h>
+#include <stdint.h>
+#include "vdp.h"
+#include "parts.h"
+
+extern uint16_t simbabg_data[], simbabg_data_end[];
+extern unsigned char simbabg_cmap[], simbabg_cmap_end[];
+extern uint16_t simbabg_tmap[], simbabg_tmap_end[];
+
+void simba_init(void)
+{
+ uint16_t *src;
+
+ /* upload tiles */
+ src = simbabg_data;
+ vdp_setup_addr(VDP_VRAM, 0);
+ while(src < simbabg_data_end) {
+ VDP_DATA = *src++;
+ }
+}
+
+void simba_start(void)
+{
+ int i;
+ uint16_t *src;
+ unsigned char *cptr;
+
+ /* setup tilemaps */
+ src = simbabg_tmap;
+ vdp_setup_addr(VDP_VRAM, 0xd000); /* nametable B */
+ while(src < simbabg_tmap_end) {
+ VDP_DATA = VDP_TILENAME(*src++, 2, 0);
+ }
+
+ /* setup colormaps */
+ cptr = simbabg_cmap;
+ for(i=0; i<16; i++) {
+ vdp_setcolor(2, i, cptr[0] >> 4, cptr[1] >> 4, cptr[2] >> 4);
+ cptr += 3;
+ }
+}
+
+void simba_update(void)
+{
+}
#ifndef PARTS_H_
#define PARTS_H_
+struct part {
+ void (*start)(void);
+ void (*update)(void);
+};
+
+extern struct part parts[];
+
void dna_init(void);
+void dna_start(void);
void dna_update(void);
+void simba_init(void);
+void simba_start(void);
+void simba_update(void);
+
#endif /* PARTS_H_ */