#define Z80_MEMMODE REG16PTR(0xa11000)
#define Z80_BUSREQ REG16PTR(0xa11100)
#define Z80_RESET REG16PTR(0xa11200)
-#define Z80_MEM ((uint8_t*)0xa00000)
+#define Z80_MEM ((volatile uint8_t*)0xa00000)
#define VDP_DATA REG16PTR(VDP_DATA_PORT)
#define VDP_CTL REG16PTR(VDP_CTL_PORT)
part->start();
for(;;) {
+ unsigned char val;
+ z80_grab_bus();
+ while(!z80_have_bus());
+ val = Z80_MEM[0x1ffc];
+ dbgval[3] = (uint32_t)val << 8;
+ val = Z80_MEM[0x1ffd];
+ dbgval[3] |= val;
+ z80_release_bus();
+
dbg_setcursor(32, 0);
for(i=0; i<4; i++) {
printf("%04x\n", (unsigned int)dbgval[i]);
16
};
- dbgval[0] = pixsz;
-
if(pixsz <= 2) {
szlevel = 0;
pixsz = 2;
pixsz = 32;
}
- dbgval[1] = szlevel;
- dbgval[2] = tile;
-
offs = offstab[pixsz];
switch(szlevel) {
spr_add(x - invoffs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(2, 2));
break;
}
-
- dbgval[3] = offs;
}
while(!z80_have_bus());
src = z80prog;
- dest = Z80_MEM;
+ dest = (unsigned char*)Z80_MEM;
for(i=0; i<z80proglen; i++) {
*dest++ = *src++;
}
- z80_reset(1);
z80_release_bus();
+ z80_reset(1);
z80_reset(0);
}
include "sndregs.inc"
section .vect
- jp main
-
- org 38h
+ jr main ; RST 0
+ dc 6,0
+ dc 6*8, 0 ; RST [1, 7]
jp vblank_isr
TESTDATA_LEN equ 43
+IPC equ $1ffc
section .text
main: di
- ld sp, $2000
im 1
+ ld sp, $1ff0
call init
; iy is left with YMADDR
ld (iy), YM_OPER
ret
ymwait:
- ld hl, YMADDR
-.wait: ld a, (hl)
+ ld a, (YMADDR)
bit 7, a
- jr z, .wait
+ jr nz, ymwait
ret
-
vblank_isr:
ex af, af'
exx
ld hl, frame
inc (hl)
+ ld a, (hl)
+ ld (IPC+1), a
exx
ex af, af'
.incbin "z80.bin"
.align 2
z80proglen:
- .long z80prog - z80proglen
+ .long z80proglen - z80prog