$(OBJDUMP) -D $< >$@
src/data-asm.o: src/data.s data/font8x8.img data/cellspr.img data/simbabg.tiles \
- data/simbafg.tiles data/simbafg.tmap
+ data/simbafg.tiles data/simbafg.tmap data/floor.tiles data/floor.tmap
src/z80prog-asm.o: src/z80prog.s $(z80bin)
data/cellspr.img: data/cellspr.png
.globl simbafg_cmap_end
.globl simbafg_tmap
.globl simbafg_tmap_end
+ .globl floor_data
+ .globl floor_data_end
+ .globl floor_cmap
+ .globl floor_cmap_end
+ .globl floor_tmap
+ .globl floor_tmap_end
font8x8_data:
.incbin "data/font8x8.img"
font8x8_data_end:
.incbin "data/simbafg.tmap"
simbafg_tmap_end:
+ .align 2
+floor_data:
+ .incbin "data/floor.tiles"
+floor_data_end:
+ .align 2
+floor_cmap:
+ .incbin "data/floor.cmap"
+floor_cmap_end:
+ .align 2
+floor_tmap:
+ .incbin "data/floor.tmap"
+floor_tmap_end:
| vi:ft=gas68k:
uint32_t frameno;
uint32_t dbgval[4];
-struct part parts[2];
+struct part parts[3];
static struct part *part;
dbg_init();
dna_init();
+ mitosis_init();
simba_init();
parts[0].start = dna_start;
parts[0].update = dna_update;
- parts[1].start = simba_start;
- parts[1].update = simba_update;
- parts[1].vblank = simba_vblank;
+ parts[1].start = mitosis_start;
+ parts[1].update = mitosis_update;
+ parts[1].vblank = mitosis_vblank;
+ parts[2].start = simba_start;
+ parts[2].update = simba_update;
+ parts[2].vblank = simba_vblank;
part = parts;
part->start();
bnprev = bnstate;
if(bndiff & bnstate & PAD_START) {
- if(++part >= parts + 2) {
+ if(++part >= parts + 3) {
part = parts;
}
part->start();
--- /dev/null
+#include <stdio.h>
+#include "vdp.h"
+#include "demo.h"
+#include "pad.h"
+#include "parts.h"
+#include "debug.h"
+
+
+#define FTILES_OFFS 256
+
+extern uint16_t floor_data[], floor_data_end[];
+extern unsigned char floor_cmap[], floor_cmap_end[];
+extern uint16_t floor_tmap[], floor_tmap_end[];
+
+static short scroll;
+
+void mitosis_init(void)
+{
+ uint16_t *src;
+
+ src = floor_data;
+ vdp_setup_addr(VDP_VRAM, FTILES_OFFS * 32);
+ while(src < floor_data_end) {
+ VDP_DATA = *src++;
+ }
+}
+
+void mitosis_start(void)
+{
+ int i;
+ uint16_t *src;
+ unsigned char *cptr;
+
+ /* setup tilemap */
+ src = floor_tmap;
+ vdp_setup_addr(VDP_VRAM, 0xc000);
+ while(src < floor_tmap_end) {
+ VDP_DATA = VDP_TILENAME(*src++ + FTILES_OFFS, 3, 0);
+ }
+
+ /* setup colormap */
+ cptr = floor_cmap;
+ for(i=0; i<16; i++) {
+ vdp_setcolor(3, i, cptr[0] >> 4, cptr[1] >> 4, cptr[2] >> 4);
+ cptr += 3;
+ }
+
+ vdp_setreg(VDP_REG_MODE3, VDP_M3_HLINE);
+ scroll = 0;
+}
+
+static int16_t scrolltab[96];
+
+void mitosis_update(void)
+{
+ short i, dir;
+ int16_t delta;
+
+ if(bnstate & PAD_LEFT) {
+ dir = -1;
+ } else if(bnstate & PAD_RIGHT) {
+ dir = 1;
+ } else {
+ dir = 0;
+ }
+
+ if(dir) {
+ for(i=0; i<96; i++) {
+ delta = ((96 - i) + 64) << 1;
+ if(dir > 0) {
+ scrolltab[i] += delta;
+ } else {
+ scrolltab[i] -= delta;
+ }
+ }
+ }
+
+ dbgval[0] = scrolltab[0];
+}
+
+void mitosis_vblank(void)
+{
+ short i;
+ uint16_t val;
+
+ vdp_setup_addr(VDP_VRAM, 0xf000); /* hscroll table is at f000, see vdp.S */
+ for(i=0; i<96; i++) {
+ val = 512 - (scrolltab[i] >> 8);
+ VDP_DATA = val;
+ VDP_DATA = val;
+ }
+}
+
void dna_start(void);
void dna_update(void);
+void mitosis_init(void);
+void mitosis_start(void);
+void mitosis_update(void);
+void mitosis_vblank(void);
+
void simba_init(void);
void simba_start(void);
void simba_update(void);
section .text
main: di
+ halt ; XXX
im 1
ld sp, $1ff0
call init