spencercw avatar spencercw committed d07e6b2

Include the VRAM bank when saving the HDMA destination address back to the registers.

This fixes the APA demo.

Comments (0)

Files changed (2)

gb_emulator/src/gb_memory.cpp

 
 				// Update the HMDA registers
 				source = (source + length) & 0xfff0;
-				destination = (destination + length) & 0x1ff0;
+				destination = (destination + length) & 0x3ff0;
 
 				ioPorts[HDMA1] = static_cast<uint8_t>(source >> 8);
 				ioPorts[HDMA2] = static_cast<uint8_t>(source);

gb_emulator/src/gb_video.cpp

 
 			// Update the HMDA registers
 			gb_.mem_.hdmaSource &= 0xfff0;
-			gb_.mem_.hdmaDestination &= 0x1ff0;
+			gb_.mem_.hdmaDestination &= 0x3ff0;
 			
 			gb_.mem_.ioPorts[HDMA1] = static_cast<uint8_t>(gb_.mem_.hdmaSource >> 8);
 			gb_.mem_.ioPorts[HDMA2] = static_cast<uint8_t>(gb_.mem_.hdmaSource);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.