- [FIX] Les interrupcions no se deshabilitaven
- [NEW] Botons implementats
This commit is contained in:
25
mbc_none.cpp
25
mbc_none.cpp
@@ -1,6 +1,7 @@
|
|||||||
#include "mbc_none.h"
|
#include "mbc_none.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
namespace mbc_none
|
namespace mbc_none
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,26 @@ namespace mbc_none
|
|||||||
|
|
||||||
uint8_t tags[65536];
|
uint8_t tags[65536];
|
||||||
|
|
||||||
|
uint8_t getKeypad(uint8_t value)
|
||||||
|
{
|
||||||
|
const uint8_t *keys = SDL_GetKeyboardState(NULL);
|
||||||
|
value = value & 0xf0;
|
||||||
|
if (value & 0x10) {
|
||||||
|
if (!keys[SDL_SCANCODE_RETURN]) value = value | 0x8;
|
||||||
|
if (!keys[SDL_SCANCODE_SPACE]) value = value | 0x4;
|
||||||
|
if (!keys[SDL_SCANCODE_Z]) value = value | 0x2;
|
||||||
|
if (!keys[SDL_SCANCODE_X]) value = value | 0x1;
|
||||||
|
} else if (value & 0x20) {
|
||||||
|
if (!keys[SDL_SCANCODE_DOWN]) value = value | 0x8;
|
||||||
|
if (!keys[SDL_SCANCODE_UP]) value = value | 0x4;
|
||||||
|
if (!keys[SDL_SCANCODE_LEFT]) value = value | 0x2;
|
||||||
|
if (!keys[SDL_SCANCODE_RIGHT]) value = value | 0x1;
|
||||||
|
} else {
|
||||||
|
value = value | 0x0f;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t readMem(uint16_t address)
|
uint8_t readMem(uint16_t address)
|
||||||
{
|
{
|
||||||
if (address < 0x8000) {
|
if (address < 0x8000) {
|
||||||
@@ -27,6 +48,9 @@ namespace mbc_none
|
|||||||
} else if (address < 0xFE00) {
|
} else if (address < 0xFE00) {
|
||||||
return wram[address - 0xE000];
|
return wram[address - 0xE000];
|
||||||
} else {
|
} else {
|
||||||
|
if (address==0xFF00) {
|
||||||
|
hram[address - 0XFE00] = getKeypad(hram[address - 0XFE00]);
|
||||||
|
}
|
||||||
return hram[address - 0XFE00];
|
return hram[address - 0XFE00];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,6 +70,7 @@ namespace mbc_none
|
|||||||
wram[address - 0xE000] = value;
|
wram[address - 0xE000] = value;
|
||||||
} else {
|
} else {
|
||||||
if ( (address==0xFF50) && ((value&0x01) != 1) ) return; //Only allow disabling boot room
|
if ( (address==0xFF50) && ((value&0x01) != 1) ) return; //Only allow disabling boot room
|
||||||
|
if ( (address==0xFF00) ) { value = value & 0x30; }
|
||||||
hram[address - 0xFE00] = value;
|
hram[address - 0xFE00] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
sm83.cpp
1
sm83.cpp
@@ -474,6 +474,7 @@ namespace sm83
|
|||||||
void processInterrupts()
|
void processInterrupts()
|
||||||
{
|
{
|
||||||
const uint8_t IF = mem::readMem(0xff0f);
|
const uint8_t IF = mem::readMem(0xff0f);
|
||||||
|
if (ime==0) return;
|
||||||
if ( (IF & 0x1f) == 0) return;
|
if ( (IF & 0x1f) == 0) return;
|
||||||
DI();
|
DI();
|
||||||
PUSH(rPC);
|
PUSH(rPC);
|
||||||
|
|||||||
Reference in New Issue
Block a user