getting closer and closer to the xfb copy loop in panda
This commit is contained in:
@@ -1,15 +1,53 @@
|
||||
#include <broadway/mmio/vi.hpp>
|
||||
#include "ircolib/log.hpp"
|
||||
#include <ircolib/log.hpp>
|
||||
#include <mem.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
void video_interface::write(ircolib::u32 addr, ircolib::u16 value) {
|
||||
addr -= 0x0c002000;
|
||||
video_interface::video_interface(mem &mem) {
|
||||
mem.register_write16_handler(0x0c002000, 0x0c0020ff,
|
||||
[&](ircolib::u32 addr, ircolib::u16 value) { write16(addr, value); });
|
||||
mem.register_write32_handler(0x0c002000, 0x0c0020ff,
|
||||
[&](ircolib::u32 addr, ircolib::u32 value) { write32(addr, value); });
|
||||
}
|
||||
|
||||
void video_interface::write16(ircolib::u32 addr, ircolib::u16 value) {
|
||||
switch (addr) {
|
||||
case 2:
|
||||
case 0x00:
|
||||
vtr.raw = value;
|
||||
break;
|
||||
case 0x02:
|
||||
dcr.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("video_interface::write to unimplemented addr 0x{:04X} with value 0x{:04X}", addr, value);
|
||||
ircolib::panic("video_interface::write16 to unimplemented addr 0x{:04X} with value 0x{:04X}", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
void video_interface::write32(ircolib::u32 addr, ircolib::u32 value) {
|
||||
switch (addr) {
|
||||
case 0x02:
|
||||
dcr.raw = value;
|
||||
break;
|
||||
case 0x04:
|
||||
htr0.raw = value;
|
||||
break;
|
||||
case 0x08:
|
||||
htr1.raw = value;
|
||||
break;
|
||||
case 0x0c:
|
||||
vto.raw = value;
|
||||
break;
|
||||
case 0x10:
|
||||
vte.raw = value;
|
||||
break;
|
||||
case 0x14:
|
||||
bbei.raw = value;
|
||||
break;
|
||||
case 0x18:
|
||||
bboi.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("video_interface::write32 to unimplemented addr 0x{:04X} with value 0x{:08X}", addr, value);
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
|
||||
+74
-17
@@ -2,25 +2,82 @@
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
union DCR {
|
||||
struct {
|
||||
unsigned e : 1;
|
||||
unsigned r : 1;
|
||||
unsigned i : 1;
|
||||
unsigned d : 1;
|
||||
unsigned le0 : 2;
|
||||
unsigned le1 : 2;
|
||||
unsigned fmt : 2;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
ircolib::u16 raw;
|
||||
};
|
||||
struct mem;
|
||||
|
||||
struct video_interface {
|
||||
void write(ircolib::u32, ircolib::u16);
|
||||
video_interface(mem &);
|
||||
void write16(ircolib::u32, ircolib::u16);
|
||||
void write32(ircolib::u32, ircolib::u32);
|
||||
|
||||
private:
|
||||
DCR dcr{};
|
||||
union DCR {
|
||||
struct {
|
||||
unsigned e : 1;
|
||||
unsigned r : 1;
|
||||
unsigned i : 1;
|
||||
unsigned d : 1;
|
||||
unsigned le0 : 2;
|
||||
unsigned le1 : 2;
|
||||
unsigned fmt : 2;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
ircolib::u16 raw;
|
||||
} dcr;
|
||||
|
||||
union HTR0 {
|
||||
struct {
|
||||
unsigned hlw : 9;
|
||||
unsigned : 7;
|
||||
unsigned hce : 7;
|
||||
unsigned : 1;
|
||||
unsigned hcs : 7;
|
||||
unsigned : 1;
|
||||
};
|
||||
|
||||
ircolib::u32 raw;
|
||||
} htr0;
|
||||
|
||||
union HTR1 {
|
||||
struct {
|
||||
unsigned hsy : 7;
|
||||
unsigned hbe : 10;
|
||||
unsigned hbs : 10;
|
||||
unsigned : 5;
|
||||
};
|
||||
|
||||
ircolib::u32 raw;
|
||||
} htr1;
|
||||
|
||||
union VTR {
|
||||
struct {
|
||||
unsigned equ : 4;
|
||||
unsigned acv : 10;
|
||||
unsigned : 2;
|
||||
};
|
||||
|
||||
ircolib::u16 raw;
|
||||
} vtr;
|
||||
|
||||
union VTO {
|
||||
struct {
|
||||
unsigned prb : 10;
|
||||
unsigned : 6;
|
||||
unsigned psb : 10;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
ircolib::u32 raw;
|
||||
} vto, vte;
|
||||
|
||||
union BBI {
|
||||
struct {
|
||||
unsigned bs1 : 5;
|
||||
unsigned be1 : 11;
|
||||
unsigned bs3 : 5;
|
||||
unsigned be3 : 11;
|
||||
};
|
||||
|
||||
ircolib::u32 raw;
|
||||
} bbei, bboi;
|
||||
};
|
||||
} // namespace weee::core
|
||||
|
||||
Reference in New Issue
Block a user