mattgodbolt / jsbeeb

Javascript BBC micro emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support "proper" address translation

mattgodbolt opened this issue · comments

jsbeeb/video.js

Lines 245 to 264 in a2cf276

this.readVideoMem = function () {
if (this.addr & 0x2000) {
// Mode 7 chunky addressing mode if MA13 set.
// Address offset by scanline is ignored.
// On model B only, there's a quirk for reading 0x3c00.
// See: http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=1011
var memAddr = this.addr & 0x3ff;
if ((this.addr & 0x800) || this.isMaster) {
memAddr |= 0x7c00;
} else {
memAddr |= 0x3c00;
}
return this.cpu.videoRead(memAddr);
} else {
var addr = (this.scanlineCounter & 0x07) | (this.addr << 3);
// Perform screen address wrap around if MA12 set
if (this.addr & 0x1000) addr += this.screenAdd;
return this.cpu.videoRead(addr & 0x7fff);
}
};

c.f. http://beebwiki.mdfs.net/Address_translation