warn = -pedantic -Wall
dbg = -g
-opt = -O3
+#opt = -O3
def = -D__NO_CTYPE
inc = -I. -Isrc -Isrc/libc
[ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
umount /media/usbmass
+.PHONY: debug
+debug: $(bin)
+ $(TC)gdb $(elf)
+
# ---- tools ----
PNGDUMP = tools/pngdump/pngdump
#define VDP_NA_ADDR(x) (((x) >> 10) & 0x38)
#define VDP_NW_ADDR(x) (((x) >> 10) & 0x3e)
-#define VDP_NB_ADDR(x) ((x) >> 13)
+#define VDP_NB_ADDR(x) (((x) >> 13) & 7)
#define VDP_SPRTAB_ADDR(x) ((x) >> 9)
#define VDP_HSTAB_ADDR(x) ((x) >> 10)
parts[0].update = dna_update;
parts[1].start = simba_start;
parts[1].update = simba_update;
- part = parts + 1;
+ part = parts;
part->start();
/* setup tilemaps */
src = simbabg_tmap;
- vdp_setup_addr(VDP_VRAM, 0xd000); /* nametable B */
+ vdp_setup_addr(VDP_VRAM, 0xe000); /* nametable B */
while(src < simbabg_tmap_end) {
VDP_DATA = VDP_TILENAME(*src++, 2, 0);
}
.globl spr_submit
spr_submit:
- move.l spr_count, %d0
- lsl.l #2, %d0 | 4 words per sprite
+ move.w spr_count, %d0
+ tst.w %d0
+ bne.s 0f
+ | if spr_count is zero, upload a single null sprite
+ addq.w #1, %d0
+0: ext.l %d0
+ lsl.w #2, %d0 | 4 words per sprite
move.l %d0, -(%sp)
pea spr_shadow
- pea 0xe000.w | we placed the spirte table at e000
+ pea 0xd000.w | we placed the spirte table at d000
jsr dma_systovram
addq.l #8, %sp
addq.l #4, %sp
#include "vdp.h"
struct hwsprite spr_shadow[MAX_HWSPRITES];
-int spr_count;
+short spr_count;
void spr_begin(void)
{
void spr_add(int x, int y, unsigned int tile, int sprsz)
{
- int id;
+ short id;
struct hwsprite *spr;
if(spr_count >= MAX_HWSPRITES) {
#define MAX_HWSPRITES 64
extern struct hwsprite spr_shadow[MAX_HWSPRITES];
-extern int spr_count;
+extern short spr_count;
void spr_begin(void);
void spr_add(int x, int y, unsigned int tile, int sprsz);
.byte VDP_REG_MODE2, VDP_M2_INIT + VDP_M2_DISP | 1: mode 2
.byte VDP_REG_NAMEA, VDP_NA_ADDR(0xc000) | 2: scroll A nametable addr.
.byte VDP_REG_NAMEW, 0 | 3: window nametable addr.
- .byte VDP_REG_NAMEB, VDP_NB_ADDR(0xd000) | 4: scroll B nametable addr.
- .byte VDP_REG_SPR, VDP_SPRTAB_ADDR(0xe000) | 5: sprite table addr.
+ .byte VDP_REG_NAMEB, VDP_NB_ADDR(0xe000) | 4: scroll B nametable addr.
+ .byte VDP_REG_SPR, VDP_SPRTAB_ADDR(0xd000) | 5: sprite table addr.
.byte VDP_REG_BGCOL, 0 | 7: bg color
.byte VDP_REG_HINTR, 0 | 10: horiz. interrupt interval
.byte VDP_REG_MODE3, 0 | 11: mode 3