46 #define FAKE_GBE_FB_ADDRESS 0x38000000 53 #define GBE_DEFAULT_XRES 640 54 #define GBE_DEFAULT_YRES 480 88 int tile_nr = 0, on_screen = 1, xbase = 0, ybase = 0;
89 unsigned char tileptr_buf[
sizeof(uint16_t)];
90 uint64_t tileptr, tiletable;
91 int lines_to_copy, pixels_per_line, y;
92 unsigned char buf[16384];
93 int copy_len, copy_offset;
94 uint64_t old_fb_offset = 0;
114 sizeof(tileptr_buf) * tile_nr,
115 tileptr_buf,
sizeof(tileptr_buf),
MEM_READ,
117 tileptr = 256 * tileptr_buf[0] + tileptr_buf[1];
122 debug(
"[ sgi_gbe: tile_nr = %2i, tileptr = 0x%08lx, xbase" 123 " = %4i, ybase = %4i ]\n", tile_nr, tileptr, xbase, ybase);
136 copy_len =
sizeof(buf);
139 while (on_screen && copy_offset < 65536) {
140 if (old_fb_offset + copy_len > (uint64_t)
152 copy_offset, buf, copy_len,
MEM_READ,
156 copy_offset +=
sizeof(buf);
157 old_fb_offset +=
sizeof(buf);
164 if (ybase + lines_to_copy > d->
yres)
165 lines_to_copy = d->
yres - ybase;
167 pixels_per_line = 512 * 8 / d->
bitdepth;
168 if (xbase + pixels_per_line > d->
xres)
169 pixels_per_line = d->
xres - xbase;
171 for (y=0; y<lines_to_copy; y++) {
173 buf, pixels_per_line * d->
bitdepth / 8,
178 for (i=0; i<pixels_per_line * d->
bitdepth / 8; i++)
179 buf[i] ^= (random() & 0x20);
184 buf, pixels_per_line * d->
bitdepth / 8,
190 if (xbase >= d->
xres) {
193 if (ybase >= d->
yres)
209 uint64_t idata = 0, odata = 0;
216 debug(
"[ sgi_gbe: DEBUG: write to address 0x%llx, data" 217 "=0x%llx ]\n", (
long long)relative_addr, (
long long)idata);
220 switch (relative_addr) {
264 d->
freeze = idata & ((uint32_t)1<<31)? 1 : 0;
267 odata = ((random() % (d->
yres + 10)) << 12)
268 + (random() % (d->
xres + 10)) +
269 (d->
freeze? ((uint32_t)1 << 31) : 0);
275 odata = ((d->
yres-1) << 12) + d->
xres-1;
280 odata = (0 << 12) + d->
xres-1;
285 odata = (0 << 12) + d->
yres-1;
302 debug(
"[ sgi_gbe: setting color depth to %i bits ]\n",
305 fatal(
"sgi_gbe: warning: bitdepth %i not " 306 "really implemented yet\n", d->
bitdepth);
329 debug(
"[ sgi_gbe: frm_control = 0x%08x ]\n",
357 if (relative_addr >= 0x60000 && relative_addr <= 0x603ff) {
363 if (relative_addr >= 0x50000 && relative_addr <= 0x503ff) {
364 int color_nr, r, g, b;
365 int old_r, old_g, old_b;
367 color_nr = (relative_addr & 0x3ff) / 4;
368 r = (idata >> 24) & 0xff;
369 g = (idata >> 16) & 0xff;
370 b = (idata >> 8) & 0xff;
380 if (r != old_r || g != old_g || b != old_b) {
392 debug(
"[ sgi_gbe: unimplemented write to address " 393 "0x%llx, data=0x%llx ]\n",
394 (
long long)relative_addr, (
long long)idata);
396 debug(
"[ sgi_gbe: unimplemented read from address " 397 "0x%llx ]\n", (
long long)relative_addr);
402 debug(
"[ sgi_gbe: DEBUG: read from address 0x%llx: 0x%llx ]\n",
403 (
long long)relative_addr, (
long long)odata);
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
void fatal(const char *fmt,...)
struct vfb_data * dev_fb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int vfb_type, int visible_xsize, int visible_ysize, int xsize, int ysize, int bit_depth, const char *name)
#define CHECK_ALLOCATION(ptr)
struct vfb_data * fb_data
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
#define FAKE_GBE_FB_ADDRESS
void set_grayscale_palette(struct vfb_data *d, int ncolors)
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
int dev_fb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *)
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
#define DEV_SGI_GBE_LENGTH
void dev_sgi_gbe_init(struct machine *machine, struct memory *mem, uint64_t baseaddr)
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
unsigned char rgb_palette[256 *3]
int dev_sgi_gbe_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *)