1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-07 17:29:31 +00:00

atari7800: fixed write mode

This commit is contained in:
Steven Hugg 2023-07-16 21:43:10 -05:00
parent 3cea5a7d15
commit cc385b7d98

View File

@ -114,6 +114,7 @@ class MARIA {
dli : boolean = false; dli : boolean = false;
h16 : boolean = false; h16 : boolean = false;
h8 : boolean = false; h8 : boolean = false;
writemode : number = 0;
indirect : boolean = false; indirect : boolean = false;
pixels = new Uint8Array(320); pixels = new Uint8Array(320);
WSYNC : number = 0; WSYNC : number = 0;
@ -140,6 +141,7 @@ class MARIA {
h16: this.h16, h16: this.h16,
h8: this.h8, h8: this.h8,
indirect: this.indirect, indirect: this.indirect,
writemode: this.writemode,
}; };
} }
loadState(s) { loadState(s) {
@ -152,6 +154,7 @@ class MARIA {
this.h16 = !!s.h16; this.h16 = !!s.h16;
this.h8 = !!s.h8; this.h8 = !!s.h8;
this.indirect = !!s.indirect; this.indirect = !!s.indirect;
this.writemode = s.writemode|0;
} }
isDMAEnabled() { isDMAEnabled() {
return (this.regs[0x1c] & 0x60) == 0x40; return (this.regs[0x1c] & 0x60) == 0x40;
@ -225,7 +228,6 @@ class MARIA {
let b2 = bus.read(dlhi + ((dlofs+2) & 0x1ff)); let b2 = bus.read(dlhi + ((dlofs+2) & 0x1ff));
let b3 = bus.read(dlhi + ((dlofs+3) & 0x1ff)); let b3 = bus.read(dlhi + ((dlofs+3) & 0x1ff));
let indirect = false; let indirect = false;
const writemode = b1 & 0x80;
// extended header? // extended header?
if ((b1 & 31) == 0) { if ((b1 & 31) == 0) {
var pal = b3 >> 5; var pal = b3 >> 5;
@ -234,6 +236,7 @@ class MARIA {
indirect = (b1 & 0x20) != 0; indirect = (b1 & 0x20) != 0;
dlofs += 5; dlofs += 5;
this.cycles += 10; this.cycles += 10;
this.writemode = b1 & 0x80;
} else { } else {
// direct mode // direct mode
var xpos = b3; var xpos = b3;
@ -247,7 +250,7 @@ class MARIA {
xpos *= 2; xpos *= 2;
const ctrlreg = this.regs[0x1c]; const ctrlreg = this.regs[0x1c];
// gfx mode (readmode + writemode * 4) // gfx mode (readmode + writemode * 4)
const grmode = (ctrlreg & 0x3) + (writemode ? 4 : 0); const grmode = (ctrlreg & 0x3) + (this.writemode ? 4 : 0);
// kangaroo mode // kangaroo mode
const kangaroo = (ctrlreg & 0x4) != 0; const kangaroo = (ctrlreg & 0x4) != 0;
// double bytes? // double bytes?
@ -687,12 +690,14 @@ export class Atari7800 extends BasicMachine implements RasterFrameBased {
// extended header? // extended header?
let indirect = false; let indirect = false;
let description = ""; let description = "";
let writemode;
const grmode = (ctrlreg & 0x3) + ((b1 & 0x80) ? 4 : 0); const grmode = (ctrlreg & 0x3) + ((b1 & 0x80) ? 4 : 0);
if ((b1 & 31) == 0) { if ((b1 & 31) == 0) {
var pal = b3 >> 5; var pal = b3 >> 5;
var width = 32 - (b3 & 31); var width = 32 - (b3 & 31);
var xpos = this.readConst(dlhi + ((dlofs+4) & 0x1ff)); var xpos = this.readConst(dlhi + ((dlofs+4) & 0x1ff));
indirect = (b1 & 0x20) != 0; indirect = (b1 & 0x20) != 0;
writemode = b1 & 0x80;
dlofs += 5; dlofs += 5;
} else { } else {
// direct mode // direct mode
@ -702,6 +707,7 @@ export class Atari7800 extends BasicMachine implements RasterFrameBased {
dlofs += 4; dlofs += 4;
} }
description += "X=" + xpos + " W=" + width + " P=" + pal; description += "X=" + xpos + " W=" + width + " P=" + pal;
if (writemode) description += " WM=1";
if (indirect) description += " CHR=$" + hex((this.maria.regs[0x14] + this.maria.offset) & 0xff) + "xx"; if (indirect) description += " CHR=$" + hex((this.maria.regs[0x14] + this.maria.offset) & 0xff) + "xx";
let gfxadr = b0 + (((b2 + (indirect?0:this.maria.offset)) & 0xff) << 8); let gfxadr = b0 + (((b2 + (indirect?0:this.maria.offset)) & 0xff) << 8);
description = " $" + hex(gfxadr,4) + " " + description; description = " $" + hex(gfxadr,4) + " " + description;