ref: 52ab0d153472f74effbcbd7fbfb6faa84dd80e61
parent: 66c98fab71ea8878fc963b38a106a38518dac83a
author: aiju <devnull@localhost>
date: Wed Apr 1 15:27:52 EDT 2015
games/gb: fix gbc dma
--- a/sys/src/games/gb/dat.h
+++ b/sys/src/games/gb/dat.h
@@ -69,10 +69,10 @@
WX = 0x4B,
KEY1 = 0x4D,
VBK = 0x4F,
- HDMASL = 0x51,
- HDMASH = 0x52,
- HDMADL = 0x53,
- HDMADH = 0x54,
+ HDMASH = 0x51,
+ HDMASL = 0x52,
+ HDMADH = 0x53,
+ HDMADL = 0x54,
HDMAC = 0x55,
BCPS = 0x68,
--- a/sys/src/games/gb/mem.c
+++ b/sys/src/games/gb/mem.c
@@ -549,7 +549,7 @@
u16int sa, da;
sa = (reg[HDMASL] | reg[HDMASH] << 8) & 0xfff0;
- da = (reg[HDMADL] | reg[HDMADH] << 8) & 0x0ff0;
+ da = (reg[HDMADL] | reg[HDMADH] << 8) & 0x1ff0 | 0x8000;
for(i = 0; i < 16; i++)
memwrite(da++, memread(sa++));
reg[HDMASL] += 16;