*
*/
-#define CDTV_DEBUG
-#define CDTV_DEBUG_CMD
+//#define CDTV_DEBUG
+//#define CDTV_DEBUG_CMD
//#define CDTV_DEBUG_6525
#include "sysconfig.h"
static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset;
static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error, cd_finished, cd_isready, cd_hunt;
-static volatile int cdtv_hsync, dma_wait, dma_finished;
+static volatile int cdtv_hsync, dma_finished;
+static volatile uae_u64 dma_wait;
static void do_stch(void);
static int readsector;
uae_u8 *p = NULL;
- write_log("DMAC DMA: sector=%d, addr=%08.8X, words=%d\n",
- cdrom_offset / 2048, dmac_acr, dmac_wtc);
- dma_wait += dmac_wtc * 312 * 50 / 75 + 1;
+ //write_log("DMAC DMA: sector=%d, addr=%08.8X, words=%d\n",
+ //cdrom_offset / 2048, dmac_acr, dmac_wtc);
+ dma_wait += dmac_wtc * (uae_u64)312 * 50 / 75 + 1;
while (dmac_wtc > 0 && dmac_dma) {
if (!p || readsector != (cdrom_offset / 2048)) {
readsector = cdrom_offset / 2048;
if (hdcv < 1 || hdcv > 4)
hdcv = 0;
}
- if (secs > 0 || heads > 0 || reserved > 0)
- hdcv = 0;
}
}
}
--- /dev/null
+/*
+ * cpummu.cpp - MMU emulation
+ *
+ * Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
+ *
+ * Inspired by UAE MMU patch
+ *
+ * This file is part of the ARAnyM project which builds a new and powerful
+ * TOS/FreeMiNT compatible virtual machine running on almost any hardware.
+ *
+ * ARAnyM is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ARAnyM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with ARAnyM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if 0
+
+#define DEBUG 0
+#define DUNUSED(x)
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#include "memory.h"
+#include "custom.h"
+#include "newcpu.h"
+#include "cpummu.h"
+#include "debug.h"
+
+#define DBG_MMU_VERBOSE 1
+#define DBG_MMU_SANITY 1
+
+static int mmu_hit;
+
+mmu_atc_l1_array atc_l1[2];
+mmu_atc_l1_array *current_atc;
+struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
+
+#ifdef ATC_STATS
+static unsigned int mmu_atc_hits[ATC_L2_SIZE];
+#endif
+
+
+static void mmu_dump_ttr(const char * label, uae_u32 ttr)
+{
+ uae_u32 from_addr, to_addr;
+
+ from_addr = ttr & MMU_TTR_LOGICAL_BASE;
+ to_addr = (ttr & MMU_TTR_LOGICAL_MASK) << 8;
+
+ write_log("%s: [%08lx] %08lx - %08lx enabled=%d supervisor=%d wp=%d cm=%02d",
+ label, ttr,
+ from_addr, to_addr,
+ ttr & MMU_TTR_BIT_ENABLED ? 1 : 0,
+ (ttr & (MMU_TTR_BIT_SFIELD_ENABLED | MMU_TTR_BIT_SFIELD_SUPER)) >> MMU_TTR_SFIELD_SHIFT,
+ ttr & MMU_TTR_BIT_WRITE_PROTECT ? 1 : 0,
+ (ttr & MMU_TTR_CACHE_MASK) >> MMU_TTR_CACHE_SHIFT
+ );
+}
+
+void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode)
+{
+ uae_u32 * ttr;
+ uae_u32 * ttr0 = datamode ? ®s.dtt0 : ®s.itt0;
+ uae_u32 * ttr1 = datamode ? ®s.dtt1 : ®s.itt1;
+
+ if ((*ttr1 & MMU_TTR_BIT_ENABLED) == 0)
+ ttr = ttr1;
+ else if ((*ttr0 & MMU_TTR_BIT_ENABLED) == 0)
+ ttr = ttr0;
+ else
+ return;
+
+ *ttr = baseaddr & MMU_TTR_LOGICAL_BASE;
+ *ttr |= ((baseaddr + size - 1) & MMU_TTR_LOGICAL_BASE) >> 8;
+ *ttr |= MMU_TTR_BIT_ENABLED;
+
+ write_log("MMU: map transparent mapping of %08x", *ttr);
+}
+
+/* check if an address matches a ttr */
+static int mmu_do_match_ttr(uae_u32 ttr, uaecptr addr, int super)
+{
+ if (ttr & MMU_TTR_BIT_ENABLED) { /* TTR enabled */
+ uae_u8 msb, mask;
+
+ msb = ((addr ^ ttr) & MMU_TTR_LOGICAL_BASE) >> 24;
+ mask = (ttr & MMU_TTR_LOGICAL_MASK) >> 16;
+
+ if (!(msb & ~mask)) {
+
+ if ((ttr & MMU_TTR_BIT_SFIELD_ENABLED) == 0) {
+ if (((ttr & MMU_TTR_BIT_SFIELD_SUPER) == 0) != (super == 0)) {
+ return TTR_NO_MATCH;
+ }
+ }
+
+ return (ttr & MMU_TTR_BIT_WRITE_PROTECT) ? TTR_NO_WRITE : TTR_OK_MATCH;
+ }
+ }
+ return TTR_NO_MATCH;
+}
+
+STATIC_INLINE int mmu_match_ttr(uaecptr addr, int super, int data)
+{
+ int res;
+
+ if (data) {
+ res = mmu_do_match_ttr(regs.dtt0, addr, super);
+ if (res != TTR_NO_MATCH)
+ res = mmu_do_match_ttr(regs.dtt1, addr, super);
+ } else {
+ res = mmu_do_match_ttr(regs.itt0, addr, super);
+ if (res != TTR_NO_MATCH)
+ res = mmu_do_match_ttr(regs.itt1, addr, super);
+ }
+ return res;
+}
+
+#if DEBUG
+/* {{{ mmu_dump_table */
+static void mmu_dump_table(const char * label, uaecptr root_ptr)
+{
+ DUNUSED(label);
+ const int ROOT_TABLE_SIZE = 128,
+ PTR_TABLE_SIZE = 128,
+ PAGE_TABLE_SIZE = 64,
+ ROOT_INDEX_SHIFT = 25,
+ PTR_INDEX_SHIFT = 18;
+ // const int PAGE_INDEX_SHIFT = 12;
+ int root_idx, ptr_idx, page_idx;
+ uae_u32 root_des, ptr_des, page_des;
+ uaecptr ptr_des_addr, page_addr,
+ root_log, ptr_log, page_log;
+
+ D(bug("%s: root=%lx", label, root_ptr));
+
+ for (root_idx = 0; root_idx < ROOT_TABLE_SIZE; root_idx++) {
+ root_des = phys_get_long(root_ptr + root_idx);
+
+ if ((root_des & 2) == 0)
+ continue; /* invalid */
+
+ D(bug("ROOT: %03d U=%d W=%d UDT=%02d", root_idx,
+ root_des & 8 ? 1 : 0,
+ root_des & 4 ? 1 : 0,
+ root_des & 3
+ ));
+
+ root_log = root_idx << ROOT_INDEX_SHIFT;
+
+ ptr_des_addr = root_des & MMU_ROOT_PTR_ADDR_MASK;
+
+ for (ptr_idx = 0; ptr_idx < PTR_TABLE_SIZE; ptr_idx++) {
+ struct {
+ uaecptr log, phys;
+ int start_idx, n_pages; /* number of pages covered by this entry */
+ uae_u32 match;
+ } page_info[PAGE_TABLE_SIZE];
+ int n_pages_used;
+
+ ptr_des = phys_get_long(ptr_des_addr + ptr_idx);
+ ptr_log = root_log | (ptr_idx << PTR_INDEX_SHIFT);
+
+ if ((ptr_des & 2) == 0)
+ continue; /* invalid */
+
+ page_addr = ptr_des & (regs.mmu_pagesize_8k ? MMU_PTR_PAGE_ADDR_MASK_8 : MMU_PTR_PAGE_ADDR_MASK_4);
+
+ n_pages_used = -1;
+ for (page_idx = 0; page_idx < PAGE_TABLE_SIZE; page_idx++) {
+
+ page_des = phys_get_long(page_addr + page_idx);
+ page_log = ptr_log | (page_idx << 2); // ??? PAGE_INDEX_SHIFT
+
+ switch (page_des & 3) {
+ case 0: /* invalid */
+ continue;
+ case 1: case 3: /* resident */
+ case 2: /* indirect */
+ if (n_pages_used == -1 || page_info[n_pages_used].match != page_des) {
+ /* use the next entry */
+ n_pages_used++;
+
+ page_info[n_pages_used].match = page_des;
+ page_info[n_pages_used].n_pages = 1;
+ page_info[n_pages_used].start_idx = page_idx;
+ page_info[n_pages_used].log = page_log;
+ } else {
+ page_info[n_pages_used].n_pages++;
+ }
+ break;
+ }
+ }
+
+ if (n_pages_used == -1)
+ continue;
+
+ D(bug(" PTR: %03d U=%d W=%d UDT=%02d", ptr_idx,
+ ptr_des & 8 ? 1 : 0,
+ ptr_des & 4 ? 1 : 0,
+ ptr_des & 3
+ ));
+
+
+ for (page_idx = 0; page_idx <= n_pages_used; page_idx++) {
+ page_des = page_info[page_idx].match;
+
+ if ((page_des & MMU_PDT_MASK) == 2) {
+ D(bug(" PAGE: %03d-%03d log=%08lx INDIRECT --> addr=%08lx",
+ page_info[page_idx].start_idx,
+ page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
+ page_info[page_idx].log,
+ page_des & MMU_PAGE_INDIRECT_MASK
+ ));
+
+ } else {
+ D(bug(" PAGE: %03d-%03d log=%08lx addr=%08lx UR=%02d G=%d U1/0=%d S=%d CM=%d M=%d U=%d W=%d",
+ page_info[page_idx].start_idx,
+ page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
+ page_info[page_idx].log,
+ page_des & (regs.mmu_pagesize_8k ? MMU_PAGE_ADDR_MASK_8 : MMU_PAGE_ADDR_MASK_4),
+ (page_des & (regs.mmu_pagesize_8k ? MMU_PAGE_UR_MASK_8 : MMU_PAGE_UR_MASK_4)) >> MMU_PAGE_UR_SHIFT,
+ page_des & MMU_DES_GLOBAL ? 1 : 0,
+ (page_des & MMU_TTR_UX_MASK) >> MMU_TTR_UX_SHIFT,
+ page_des & MMU_DES_SUPER ? 1 : 0,
+ (page_des & MMU_TTR_CACHE_MASK) >> MMU_TTR_CACHE_SHIFT,
+ page_des & MMU_DES_MODIFIED ? 1 : 0,
+ page_des & MMU_DES_USED ? 1 : 0,
+ page_des & MMU_DES_WP ? 1 : 0
+ ));
+ }
+ }
+ }
+
+ }
+}
+/* }}} */
+#endif
+
+/* {{{ mmu_dump_atc */
+void mmu_dump_atc(void)
+{
+ int i, j;
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < ATC_L2_SIZE; j++) {
+ if (atc_l2[i][j].tag == 0x8000)
+ continue;
+ write_log("ATC[%02d] G=%d TT=%d M=%d WP=%d VD=%d VI=%d tag=%08x --> phys=%08x",
+ j, atc_l2[i][j].global, atc_l2[i][j].tt, atc_l2[i][j].modified,
+ atc_l2[i][j].write_protect, atc_l2[i][j].valid_data, atc_l2[i][j].valid_inst,
+ atc_l2[i][j].tag, atc_l2[i][j].phys);
+ }
+ }
+}
+/* }}} */
+
+/* {{{ mmu_dump_tables */
+void mmu_dump_tables(void)
+{
+ write_log("URP: %08x SRP: %08x MMUSR: %x TC: %x", regs.urp, regs.srp, regs.mmusr, regs.tcr);
+ mmu_dump_ttr("DTT0", regs.dtt0);
+ mmu_dump_ttr("DTT1", regs.dtt1);
+ mmu_dump_ttr("ITT0", regs.itt0);
+ mmu_dump_ttr("ITT1", regs.itt1);
+ mmu_dump_atc();
+ //mmu_dump_table("SRP", regs.srp);
+}
+/* }}} */
+
+static uaecptr REGPARAM3 mmu_lookup_pagetable(uaecptr addr, int super, int write) REGPARAM;
+
+STATIC_INLINE int mmu_get_fc(int super, int data)
+{
+ return (super ? 4 : 0) | (data ? 1 : 2);
+}
+
+static void mmu_bus_error(uaecptr addr, int fc, int write, int size)
+{
+ uae_u16 ssw = 0;
+
+ ssw |= fc & MMU_SSW_TM; /* Copy TM */
+ switch (size) {
+ case sz_byte:
+ ssw |= MMU_SSW_SIZE_B;
+ break;
+ case sz_word:
+ ssw |= MMU_SSW_SIZE_W;
+ break;
+ case sz_long:
+ ssw |= MMU_SSW_SIZE_L;
+ break;
+ }
+
+ regs.wb3_status = write ? 0x80 | ssw : 0;
+ if (!write)
+ ssw |= MMU_SSW_RW;
+
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw = ssw | MMU_SSW_ATC;
+
+ write_log("BUS ERROR: fc=%d w=%d log=%08x ssw=%04x", fc, write, addr, ssw);
+
+ THROW(2);
+}
+
+/*
+ * Update the atc line for a given address by doing a mmu lookup.
+ */
+static uaecptr mmu_fill_atc_l2(uaecptr addr, int super, int data, int write,
+ struct mmu_atc_line *l)
+{
+ int res;
+ uae_u32 desc;
+
+ l->tag = ATC_TAG(addr);
+ l->hw = l->bus_fault = 0;
+
+ /* check ttr0 */
+ res = mmu_match_ttr(addr, super, data);
+ if (res != TTR_NO_MATCH) {
+ l->tt = 1;
+ if (data) {
+ l->valid_data = 1;
+ l->valid_inst = mmu_match_ttr(addr, super, 0) == res;
+ } else {
+ l->valid_inst = 1;
+ l->valid_data = mmu_match_ttr(addr, super, 1) == res;
+ }
+ l->global = 1;
+ l->modified = 1;
+ l->write_protect = (res == TTR_NO_WRITE);
+ l->phys = 0;
+
+ return 0;
+ }
+
+ l->tt = 0;
+ if (!regs.mmu_enabled) {
+ l->valid_data = l->valid_inst = 1;
+ l->global = 1;
+ l->modified = 1;
+ l->write_protect = 0;
+ l->phys = 0;
+ return 0;
+ }
+
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ desc = mmu_lookup_pagetable(addr, super, write);
+ write_log("translate: %x,%u,%u,%u -> %x", addr, super, write, data, desc);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ /* bus error during table search */
+ desc = 0;
+ goto fail;
+ }
+
+ if ((desc & 1) == 0 || (!super && desc & MMU_MMUSR_S)) {
+ fail:
+ l->valid_data = l->valid_inst = 0;
+ l->global = 0;
+ } else {
+ l->valid_data = l->valid_inst = 1;
+ if (regs.mmu_pagesize_8k)
+ l->phys = (desc & ~0x1fff) - (addr & ~0x1fff);
+ else
+ l->phys = (desc & ~0xfff) - (addr & ~0xfff);
+ l->global = (desc & MMU_MMUSR_G) != 0;
+ l->modified = (desc & MMU_MMUSR_M) != 0;
+ l->write_protect = (desc & MMU_MMUSR_W) != 0;
+ }
+
+ return desc;
+}
+
+STATIC_INLINE int
+mmu_fill_atc_l1(uaecptr addr, int super, int data, int write,
+ struct mmu_atc_line *l1)
+{
+ int idx = ATC_L2_INDEX(addr);
+ int tag = ATC_TAG(addr);
+ struct mmu_atc_line *l = &atc_l2[super][idx];
+ uaecptr phys_addr;
+
+ if (l->tag != tag) {
+ restart:
+ mmu_fill_atc_l2(addr, super, data, write, l);
+ }
+ if (!(data ? l->valid_data : l->valid_inst)) {
+ write_log("MMU: non-resident page (%x,%x,%x)!", addr, regs.pc, regs.fault_pc);
+ goto fail;
+ }
+ if (write) {
+ if (l->write_protect) {
+ write_log("MMU: write protected (via %s) %lx", l->tt ? "ttr" : "atc", addr);
+ goto fail;
+ }
+ if (!l->modified)
+ goto restart;
+ }
+ *l1 = *l;
+
+ phys_addr = addr + l1->phys;
+ if ((phys_addr & 0xfff00000) == 0x00f00000) {
+ l1->hw = 1;
+ goto fail;
+ }
+ if ((phys_addr & 0xfff00000) == 0xfff00000) {
+ l1->hw = 1;
+ l1->phys -= 0xff000000;
+ goto fail;
+ }
+
+ if (!test_ram_boundary(phys_addr, 1, super, write)) {
+ l1->bus_fault = 1;
+ goto fail;
+ }
+
+ return 1;
+
+fail:
+ l1->tag = ~l1->tag;
+ return 0;
+}
+
+uaecptr REGPARAM2 mmu_translate(uaecptr addr, int super, int data, int write)
+{
+ struct mmu_atc_line *l;
+
+ l = &atc_l2[super][ATC_L2_INDEX(addr)];
+ mmu_fill_atc_l2(addr, super, data, write, l);
+ if (!(data ? l->valid_data : l->valid_inst))
+ THROW(2);
+
+ return addr + l->phys;
+}
+
+/*
+ * Lookup the address by walking the page table and updating
+ * the page descriptors accordingly. Returns the found descriptor
+ * or produces a bus error.
+ */
+static uaecptr REGPARAM2 mmu_lookup_pagetable(uaecptr addr, int super, int write)
+{
+ uae_u32 desc, desc_addr, wp;
+ int i, indirect;
+
+ indirect = 0;
+ wp = 0;
+ desc = super ? regs.srp : regs.urp;
+
+ /* fetch root table descriptor */
+ i = (addr >> 23) & 0x1fc;
+ desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
+ desc = phys_get_long(desc_addr);
+ if ((desc & 2) == 0) {
+ write_log("MMU: invalid root descriptor for %lx", addr);
+ return 0;
+ }
+
+ wp |= desc;
+ if ((desc & MMU_DES_USED) == 0)
+ phys_put_long(desc_addr, desc | MMU_DES_USED);
+
+ /* fetch pointer table descriptor */
+ i = (addr >> 16) & 0x1fc;
+ desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
+ desc = phys_get_long(desc_addr);
+ if ((desc & 2) == 0) {
+ write_log("MMU: invalid ptr descriptor for %lx", addr);
+ return 0;
+ }
+ wp |= desc;
+ if ((desc & MMU_DES_USED) == 0)
+ phys_put_long(desc_addr, desc | MMU_DES_USED);
+
+ /* fetch page table descriptor */
+ if (regs.mmu_pagesize_8k) {
+ i = (addr >> 11) & 0x7c;
+ desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_8) | i;
+ } else {
+ i = (addr >> 10) & 0xfc;
+ desc_addr = (desc & MMU_PTR_PAGE_ADDR_MASK_4) | i;
+ }
+
+get_page_descriptor:
+ desc = phys_get_long(desc_addr);
+ if ((desc & 1) == 0) {
+ if ((desc & 2) == 0) {
+ write_log("MMU: invalid page descriptor log=%08lx desc=%08lx @%08lx", addr, desc, desc_addr);
+ return desc;
+ }
+ /* indirect */
+ if (indirect) {
+ write_log("MMU: double indirect descriptor log=%lx descriptor @ %lx", addr, desc_addr);
+ return desc;
+ }
+ wp |= desc;
+ if ((desc & MMU_DES_USED) == 0)
+ phys_put_long(desc_addr, desc | MMU_DES_USED);
+ desc_addr = desc & MMU_PAGE_INDIRECT_MASK;
+ indirect = 1;
+ goto get_page_descriptor;
+ }
+
+ desc |= wp & MMU_DES_WP;
+ if (write) {
+ if (desc & MMU_DES_WP) {
+ if ((desc & MMU_DES_USED) == 0) {
+ desc |= MMU_DES_USED;
+ phys_put_long(desc_addr, desc);
+ }
+ } else if ((desc & (MMU_DES_USED|MMU_DES_MODIFIED)) !=
+ (MMU_DES_USED|MMU_DES_MODIFIED)) {
+ desc |= MMU_DES_USED|MMU_DES_MODIFIED;
+ phys_put_long(desc_addr, desc);
+ }
+ } else {
+ if ((desc & MMU_DES_USED) == 0) {
+ desc |= MMU_DES_USED;
+ phys_put_long(desc_addr, desc);
+ }
+ }
+ return desc;
+}
+
+uae_u16 REGPARAM2 mmu_get_word_unaligned(uaecptr addr, int data)
+{
+ uae_u16 res;
+
+ res = (uae_u16)mmu_get_byte(addr, data, sz_word) << 8;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res |= mmu_get_byte(addr + 1, data, sz_word);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ return res;
+}
+
+uae_u32 mmu_get_long_unaligned(uaecptr addr, int data)
+{
+ uae_u32 res;
+
+ if (likely(!(addr & 1))) {
+ res = (uae_u32)mmu_get_word(addr, data, sz_long) << 16;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res |= mmu_get_word(addr + 2, data, sz_long);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ } else {
+ res = (uae_u32)mmu_get_byte(addr, data, sz_long) << 8;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res = (res | mmu_get_byte(addr + 1, data, sz_long)) << 8;
+ res = (res | mmu_get_byte(addr + 2, data, sz_long)) << 8;
+ res |= mmu_get_byte(addr + 3, data, sz_long);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ }
+ return res;
+}
+
+uae_u8 REGPARAM2 mmu_get_byte_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw)
+ return HWget_b(cl->phys + addr);
+ mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+ return 0;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
+ goto redo;
+
+ return do_get_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl));
+}
+
+uae_u16 REGPARAM2 mmu_get_word_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw)
+ return HWget_w(cl->phys + addr);
+ mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+ return 0;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
+ goto redo;
+
+ return do_get_mem_word((uae_u16 *)mmu_get_real_address(addr, cl));
+}
+
+uae_u32 REGPARAM2 mmu_get_long_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw)
+ return HWget_l(cl->phys + addr);
+ mmu_bus_error(addr, mmu_get_fc(super, data), 0, size);
+ return 0;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 0, cl))
+ goto redo;
+
+ return do_get_mem_long((uae_u32 *)mmu_get_real_address(addr, cl));
+}
+
+void REGPARAM2 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, int data)
+{
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ if (likely(!(addr & 1))) {
+ mmu_put_word(addr, val >> 16, data, sz_long);
+ mmu_put_word(addr + 2, val, data, sz_long);
+ } else {
+ mmu_put_byte(addr, val >> 24, data, sz_long);
+ mmu_put_byte(addr + 1, val >> 16, data, sz_long);
+ mmu_put_byte(addr + 2, val >> 8, data, sz_long);
+ mmu_put_byte(addr + 3, val, data, sz_long);
+ }
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.wb3_data = val;
+ if (regs.mmu_fault_addr != addr) {
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ }
+ THROW_AGAIN(prb);
+ }
+}
+
+void REGPARAM2 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, int data)
+{
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ mmu_put_byte(addr, val >> 8, data, sz_word);
+ mmu_put_byte(addr + 1, val, data, sz_word);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.wb3_data = val;
+ if (regs.mmu_fault_addr != addr) {
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ }
+ THROW_AGAIN(prb);
+ }
+}
+
+void REGPARAM2 mmu_put_byte_slow(uaecptr addr, uae_u8 val, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw) {
+ HWput_b(cl->phys + addr, val);
+ return;
+ }
+ regs.wb3_data = val;
+ mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+ return;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
+ goto redo;
+
+ do_put_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl), val);
+}
+
+void REGPARAM2 mmu_put_word_slow(uaecptr addr, uae_u16 val, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw) {
+ HWput_w(cl->phys + addr, val);
+ return;
+ }
+ regs.wb3_data = val;
+ mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+ return;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
+ goto redo;
+
+ do_put_mem_word((uae_u16 *)mmu_get_real_address(addr, cl), val);
+}
+
+void REGPARAM2 mmu_put_long_slow(uaecptr addr, uae_u32 val, int super, int data,
+ int size, struct mmu_atc_line *cl)
+{
+ uae_u32 tag = ATC_TAG(addr);
+
+ if (cl->tag == (uae_u16)~tag) {
+ redo:
+ if (cl->hw) {
+ HWput_l(cl->phys + addr, val);
+ return;
+ }
+ regs.wb3_data = val;
+ mmu_bus_error(addr, mmu_get_fc(super, data), 1, size);
+ return;
+ }
+
+ if (!mmu_fill_atc_l1(addr, super, data, 1, cl))
+ goto redo;
+
+ do_put_mem_long((uae_u32 *)mmu_get_real_address(addr, cl), val);
+}
+
+uae_u32 REGPARAM2 sfc_get_long(uaecptr addr)
+{
+ int super = (regs.sfc & 4) != 0;
+ int data = (regs.sfc & 3) != 2;
+ uae_u32 res;
+
+ if (likely(!is_unaligned(addr, 4)))
+ return mmu_get_user_long(addr, super, data, sz_long);
+
+ if (likely(!(addr & 1))) {
+ res = (uae_u32)mmu_get_user_word(addr, super, data, sz_long) << 16;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res |= mmu_get_user_word(addr + 2, super, data, sz_long);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ } else {
+ res = (uae_u32)mmu_get_user_byte(addr, super, data, sz_long) << 8;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res = (res | mmu_get_user_byte(addr + 1, super, data, sz_long)) << 8;
+ res = (res | mmu_get_user_byte(addr + 2, super, data, sz_long)) << 8;
+ res |= mmu_get_user_byte(addr + 3, super, data, sz_long);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ }
+ return res;
+}
+
+uae_u16 REGPARAM2 sfc_get_word(uaecptr addr)
+{
+ int super = (regs.sfc & 4) != 0;
+ int data = (regs.sfc & 3) != 2;
+ uae_u16 res;
+
+ if (likely(!is_unaligned(addr, 2)))
+ return mmu_get_user_word(addr, super, data, sz_word);
+
+ res = (uae_u16)mmu_get_user_byte(addr, super, data, sz_word) << 8;
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ res |= mmu_get_user_byte(addr + 1, super, data, sz_word);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ THROW_AGAIN(prb);
+ }
+ return res;
+}
+
+uae_u8 REGPARAM2 sfc_get_byte(uaecptr addr)
+{
+ int super = (regs.sfc & 4) != 0;
+ int data = (regs.sfc & 3) != 2;
+
+ return mmu_get_user_byte(addr, super, data, sz_byte);
+}
+
+void REGPARAM2 dfc_put_long(uaecptr addr, uae_u32 val)
+{
+ int super = (regs.dfc & 4) != 0;
+ int data = (regs.dfc & 3) != 2;
+
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ if (likely(!is_unaligned(addr, 4)))
+ mmu_put_user_long(addr, val, super, data, sz_long);
+ else if (likely(!(addr & 1))) {
+ mmu_put_user_word(addr, val >> 16, super, data, sz_long);
+ mmu_put_user_word(addr + 2, val, super, data, sz_long);
+ } else {
+ mmu_put_user_byte(addr, val >> 24, super, data, sz_long);
+ mmu_put_user_byte(addr + 1, val >> 16, super, data, sz_long);
+ mmu_put_user_byte(addr + 2, val >> 8, super, data, sz_long);
+ mmu_put_user_byte(addr + 3, val, super, data, sz_long);
+ }
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.wb3_data = val;
+ if (regs.mmu_fault_addr != addr) {
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ }
+ THROW_AGAIN(prb);
+ }
+}
+
+void REGPARAM2 dfc_put_word(uaecptr addr, uae_u16 val)
+{
+ int super = (regs.dfc & 4) != 0;
+ int data = (regs.dfc & 3) != 2;
+
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ if (likely(!is_unaligned(addr, 2)))
+ mmu_put_user_word(addr, val, super, data, sz_word);
+ else {
+ mmu_put_user_byte(addr, val >> 8, super, data, sz_word);
+ mmu_put_user_byte(addr + 1, val, super, data, sz_word);
+ }
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.wb3_data = val;
+ if (regs.mmu_fault_addr != addr) {
+ regs.mmu_fault_addr = addr;
+ regs.mmu_ssw |= MMU_SSW_MA;
+ }
+ THROW_AGAIN(prb);
+ }
+}
+
+void REGPARAM2 dfc_put_byte(uaecptr addr, uae_u8 val)
+{
+ int super = (regs.dfc & 4) != 0;
+ int data = (regs.dfc & 3) != 2;
+
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ mmu_put_user_byte(addr, val, super, data, sz_byte);
+ RESTORE_EXCEPTION;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ regs.wb3_data = val;
+ THROW_AGAIN(prb);
+ }
+}
+
+void mmu_op(uae_u32 opcode, struct regstruct *regs, uae_u16 extra)
+{
+ int super = (regs->dfc & 4) != 0;
+ DUNUSED(extra);
+ if ((opcode & 0xFE0) == 0x0500) {
+ int regno, glob;
+ //D(didflush = 0);
+ uae_u32 addr;
+ /* PFLUSH */
+ regno = opcode & 7;
+ glob = (opcode & 8) != 0;
+
+ if (opcode & 16) {
+ write_log("pflusha(%u,%u)", glob, regs->dfc);
+ mmu_flush_atc_all(glob);
+ } else {
+ addr = m68k_areg(regs, regno);
+ write_log("pflush(%u,%u,%x)", glob, regs->dfc, addr);
+ mmu_flush_atc(addr, super, glob);
+ }
+ flush_internals();
+#ifdef USE_JIT
+ flush_icache(0);
+#endif
+ } else if ((opcode & 0x0FD8) == 0x548) {
+ int write, regno;
+ uae_u32 addr;
+
+ regno = opcode & 7;
+ write = (opcode & 32) == 0;
+ addr = m68k_areg(regs, regno);
+ write_log("PTEST%c (A%d) %08x DFC=%d", write ? 'W' : 'R', regno, addr, regs->dfc);
+ mmu_flush_atc(addr, super, 1);
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ struct mmu_atc_line *l;
+ uae_u32 desc;
+ int data = (regs->dfc & 3) != 2;
+
+ l = &atc_l2[super][ATC_L2_INDEX(addr)];
+ desc = mmu_fill_atc_l2(addr, super, data, write, l);
+ if (!(data ? l->valid_data : l->valid_inst))
+ regs->mmusr = MMU_MMUSR_B;
+ else if (l->tt)
+ regs->mmusr = MMU_MMUSR_T | MMU_MMUSR_R;
+ else {
+ regs->mmusr = desc & (~0xfff|MMU_MMUSR_G|MMU_MMUSR_Ux|MMU_MMUSR_S|
+ MMU_MMUSR_CM|MMU_MMUSR_M|MMU_MMUSR_W);
+ regs->mmusr |= MMU_MMUSR_R;
+ }
+ }
+ CATCH(prb) {
+ regs->mmusr = MMU_MMUSR_B;
+ }
+ RESTORE_EXCEPTION;
+ write_log("PTEST result: mmusr %08x", regs->mmusr);
+ } else
+ op_illg (opcode, regs);
+}
+
+void REGPARAM2 mmu_flush_atc(uaecptr addr, int super, int global)
+{
+ struct mmu_atc_line *l;
+ int i, j;
+
+ l = atc_l1[super][0][0];
+ i = ATC_L1_INDEX(addr);
+ for (j = 0; j < 4; j++) {
+ if (global || !l[i].global)
+ l[i].tag = 0x8000;
+ l += ATC_L1_SIZE;
+ }
+ if (regs.mmu_pagesize_8k) {
+ i = ATC_L1_INDEX(addr) ^ 1;
+ for (j = 0; j < 4; j++) {
+ if (global || !l[i].global)
+ l[i].tag = 0x8000;
+ l += ATC_L1_SIZE;
+ }
+ }
+ l = atc_l2[super];
+ i = ATC_L2_INDEX(addr);
+ if (global || !l[i].global)
+ l[i].tag = 0x8000;
+ if (regs.mmu_pagesize_8k) {
+ i ^= 1;
+ if (global || !l[i].global)
+ l[i].tag = 0x8000;
+ }
+}
+
+void REGPARAM2 mmu_flush_atc_all(int global)
+{
+ struct mmu_atc_line *l;
+ unsigned int i;
+
+ l = atc_l1[0][0][0];
+ for (i = 0; i < sizeof(atc_l1) / sizeof(*l); l++, i++) {
+ if (global || !l->global)
+ l->tag = 0x8000;
+ }
+
+ l = atc_l2[0];
+ for (i = 0; i < sizeof(atc_l2) / sizeof(*l); l++, i++) {
+ if (global || !l->global)
+ l->tag = 0x8000;
+ }
+}
+
+void REGPARAM2 mmu_reset(void)
+{
+ mmu_flush_atc_all(1);
+
+ regs.urp = regs.srp = 0;
+ regs.itt0 = regs.itt0 = 0;
+ regs.dtt0 = regs.dtt0 = 0;
+ regs.mmusr = 0;
+}
+
+
+void REGPARAM2 mmu_set_tc(uae_u16 tcr)
+{
+ if (regs.tcr == tcr)
+ return;
+
+ regs.tcr = tcr;
+ regs.mmu_enabled = tcr & 0x8000 ? 1 : 0;
+ regs.mmu_pagesize_8k = tcr & 0x4000 ? 1 : 0;
+ mmu_flush_atc_all(1);
+
+ write_log("MMU: enabled=%d page8k=%d\n", regs.mmu_enabled, regs.mmu_pagesize_8k);
+}
+
+void REGPARAM2 mmu_set_super(int super)
+{
+ current_atc = &atc_l1[super];
+}
+
+#endif
#include "enforcer.h"
#endif
#include "gayle.h"
+#include "gfxfilter.h"
STATIC_INLINE int nocustom(void)
{
int v = color_reg_get (colentry, i);
if (v < 0 || v > 16777215)
continue;
- colentry->acolors[i] = CONVERT_RGB (v);
+ colentry->acolors[i] = getxcolor (v);
}
} else {
#endif
int v = color_reg_get (colentry, i);
if (v < 0 || v > 4095)
continue;
- colentry->acolors[i] = xcolors[v];
+ colentry->acolors[i] = getxcolor (v);
}
#ifdef AGA
}
}
}
+static void update_mirrors(void)
+{
+ aga_mode = (currprefs.chipset_mask & CSMASK_AGA) ? 1 : 0;
+ direct_rgb = aga_mode;
+}
/* display mode changed (lores, doubling etc..), recalculate everything */
void init_custom (void)
{
+ update_mirrors();
create_cycle_diagram_table ();
reset_drawing ();
init_hz ();
record_color_change (hpos, colreg, cval);
remembered_color_entry = -1;
current_colors.color_regs_aga[colreg] = cval;
- current_colors.acolors[colreg] = CONVERT_RGB (cval);
+ current_colors.acolors[colreg] = getxcolor (cval);
} else {
#endif
if (current_colors.color_regs_ecs[num] == v)
record_color_change (hpos, num, v);
remembered_color_entry = -1;
current_colors.color_regs_ecs[num] = v;
- current_colors.acolors[num] = xcolors[v];
+ current_colors.acolors[num] = getxcolor (v);
#ifdef AGA
}
#endif
lightpen_cx = lightpen_cy = -1;
if (! savestate_state) {
currprefs.chipset_mask = changed_prefs.chipset_mask;
- if ((currprefs.chipset_mask & CSMASK_AGA) == 0) {
+ update_mirrors();
+ if (!aga_mode) {
for (i = 0; i < 32; i++) {
current_colors.color_regs_ecs[i] = 0;
- current_colors.acolors[i] = xcolors[0];
+ current_colors.acolors[i] = getxcolor(0);
}
#ifdef AGA
} else {
for (i = 0; i < 256; i++) {
current_colors.color_regs_aga[i] = 0;
- current_colors.acolors[i] = CONVERT_RGB (zero);
+ current_colors.acolors[i] = getxcolor(0);
}
#endif
}
audio_reset ();
changed_prefs.chipset_mask = currprefs.chipset_mask = RL;
+ update_mirrors();
RW; /* 000 ? */
RW; /* 002 DMACONR */
RW; /* 004 VPOSR */
for (;;) {
char cmd, *inptr;
+ int v;
if (!debugger_active)
return;
update_debug_info();
console_out (">");
console_flush ();
- if (!console_get (input, MAX_LINEWIDTH))
+ v = console_get (input, MAX_LINEWIDTH);
+ if (v < 0)
+ return;
+ if (v == 0)
continue;
inptr = input;
cmd = next_char (&inptr);
#include "savestate.h"
int lores_factor, lores_shift;
+int aga_mode; /* mirror of chipset_mask & CSMASK_AGA */
+int direct_rgb;
/* The shift factor to apply when converting between Amiga coordinates and window
coordinates. Zero if the resolution is the same, positive if window coordinates
unlockscr ();
if (start <= stop)
flush_screen (start, stop);
- else if (currprefs.gfx_afullscreen && currprefs.gfx_vsync)
+ else if ((currprefs.gfx_afullscreen && currprefs.gfx_vsync) || currprefs.gfx_filter == 8)
flush_screen (0, 0); /* vsync mode */
}
if (idx >= 0)
uci->configoffset = idx;
} else {
- gayle_add_ide_unit (uci->controller - 1, uci->rootdir, uci->blocksize, uci->readonly);
+ gayle_add_ide_unit (uci->controller - 1, uci->rootdir, uci->blocksize, uci->readonly,
+ uci->devname, uci->sectors, uci->surfaces, uci->reserved,
+ uci->bootpri, uci->filesys);
}
}
filesys_addexternals();
DE0000 to DEFFFF 64 KB Motherboard resources
*/
-/* Gayle definitions from Linux driver */
-
-/*
- * Bases of the IDE interfaces
- */
+/* Gayle definitions from Linux drivers */
+
+/* PCMCIA stuff */
+
+#define GAYLE_RAM (0x600000+zTwoBase)
+#define GAYLE_RAMSIZE (0x400000)
+#define GAYLE_ATTRIBUTE (0xa00000+zTwoBase)
+#define GAYLE_ATTRIBUTESIZE (0x020000)
+#define GAYLE_IO (0xa20000+zTwoBase) /* 16bit and even 8bit registers */
+#define GAYLE_IOSIZE (0x010000)
+#define GAYLE_IO_8BITODD (0xa30000+zTwoBase) /* odd 8bit registers */
+/* offset for accessing odd IO registers */
+#define GAYLE_ODD (GAYLE_IO_8BITODD-GAYLE_IO-1)
+
+#define GAYLE_ADDRESS (0xda8000) /* gayle main registers base address */
+#define GAYLE_RESET (0xa40000) /* write 0x00 to start reset,
+ read 1 byte to stop reset */
+/* GAYLE_CARDSTATUS bit def */
+#define GAYLE_CS_CCDET 0x40 /* credit card detect */
+#define GAYLE_CS_BVD1 0x20 /* battery voltage detect 1 */
+#define GAYLE_CS_SC 0x20 /* credit card status change */
+#define GAYLE_CS_BVD2 0x10 /* battery voltage detect 2 */
+#define GAYLE_CS_DA 0x10 /* digital audio */
+#define GAYLE_CS_WR 0x08 /* write enable (1 == enabled) */
+#define GAYLE_CS_BSY 0x04 /* credit card busy */
+#define GAYLE_CS_IRQ 0x04 /* interrupt request */
+
+/* GAYLE_CONFIG bit def
+ (bit 0-1 for program voltage, bit 2-3 for access speed */
+#define GAYLE_CFG_0V 0x00
+#define GAYLE_CFG_5V 0x01
+#define GAYLE_CFG_12V 0x02
+
+#define GAYLE_CFG_100NS 0x08
+#define GAYLE_CFG_150NS 0x04
+#define GAYLE_CFG_250NS 0x00
+#define GAYLE_CFG_720NS 0x0c
+
+/* IDE stuff */
+
+/* Bases of the IDE interfaces */
#define GAYLE_BASE_4000 0xdd2020 /* A4000/A4000T */
#define GAYLE_BASE_1200 0xda0000 /* A1200/A600 and E-Matrix 530 */
-
+/* IDE drive registers */
#define IDE_DATA 0x00
#define IDE_ERROR 0x01 /* see err-bits */
#define IDE_NSECTOR 0x02 /* nr of sectors to read/write */
#define IDE_STATUS 0x07 /* see status-bits */
#define IDE_DEVCON 0x0406
#define IDE_DRVADDR 0x0407
-
/* STATUS bits */
#define IDE_STATUS_ERR 0x01
#define IDE_STATUS_IDX 0x02
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
+static uae_u32 gayle_attr_read(uaecptr addr)
+{
+ uae_u8 v = 0;
+ write_log("R: %x %x\n", addr, M68K_GETPC);
+ addr &= 262144 - 1;
+ switch (addr)
+ {
+ case 0:
+ v = 0x91;
+ break;
+ case 2:
+ v = 0x05;
+ break;
+ case 4:
+ v = 0x23;
+ break;
+ }
+ return v;
+}
+static void gayle_attr_write(uaecptr addr, uae_u32 v)
+{
+ write_log("W: %x=%x %x\n", addr, v, M68K_GETPC);
+ addr &= 262144 - 1;
+ if (addr == 0x40000) {
+ if (v)
+ write_log("GAYLE: Reset active\n");
+ else
+ write_log("GAYLE: Reset non-active\n");
+ }
+}
+
+static uae_u32 REGPARAM3 gayle_attr_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 gayle_attr_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 gayle_attr_bget (uaecptr) REGPARAM;
+static void REGPARAM3 gayle_attr_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 gayle_attr_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 gayle_attr_bput (uaecptr, uae_u32) REGPARAM;
+
+addrbank gayle_attr_bank = {
+ gayle_attr_lget, gayle_attr_wget, gayle_attr_bget,
+ gayle_attr_lput, gayle_attr_wput, gayle_attr_bput,
+ default_xlate, default_check, NULL, "Gayle PCMCIA attribute",
+ dummy_lgeti, dummy_wgeti, ABFLAG_IO
+};
+
+static uae_u32 REGPARAM2 gayle_attr_lget (uaecptr addr)
+{
+ uae_u32 v;
+#ifdef JIT
+ special_mem |= S_READ;
+#endif
+ v = gayle_attr_wget (addr) << 16;
+ v |= gayle_attr_wget (addr + 2);
+ return v;
+}
+static uae_u32 REGPARAM2 gayle_attr_wget (uaecptr addr)
+{
+ uae_u16 v;
+#ifdef JIT
+ special_mem |= S_READ;
+#endif
+ v = gayle_attr_bget (addr) << 8;
+ v |= gayle_attr_bget (addr + 1);
+ return v;
+}
+static uae_u32 REGPARAM2 gayle_attr_bget (uaecptr addr)
+{
+#ifdef JIT
+ special_mem |= S_READ;
+#endif
+ return gayle_attr_read (addr);
+}
+
+static void REGPARAM2 gayle_attr_lput (uaecptr addr, uae_u32 value)
+{
+#ifdef JIT
+ special_mem |= S_WRITE;
+#endif
+ gayle_attr_wput (addr, value >> 16);
+ gayle_attr_wput (addr + 2, value & 0xffff);
+}
+
+static void REGPARAM2 gayle_attr_wput (uaecptr addr, uae_u32 value)
+{
+#ifdef JIT
+ special_mem |= S_WRITE;
+#endif
+ gayle_attr_bput (addr, value >> 8);
+ gayle_attr_bput (addr + 1, value & 0xff);
+}
+
+static void REGPARAM2 gayle_attr_bput (uaecptr addr, uae_u32 value)
+{
+#ifdef JIT
+ special_mem |= S_WRITE;
+#endif
+ gayle_attr_write (addr, value);
+}
+
+
static int rl (uae_u8 *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
*psectorspertrack = spt;
}
-int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly)
+static void pl(uae_u8 *p, int off, uae_u32 v)
+{
+ p += off * 4;
+ p[0] = v >> 24;
+ p[1] = v >> 16;
+ p[2] = v >> 8;
+ p[3] = v >> 0;
+}
+
+static void rdb_crc(uae_u8 *p)
+{
+ uae_u32 sum;
+ int i, blocksize;
+
+ sum =0;
+ blocksize = rl (p + 1 * 4);
+ for (i = 0; i < blocksize; i++)
+ sum += rl (p + i * 4);
+ sum = -sum;
+ pl (p, 2, sum);
+}
+
+static void create_virtual_rdb(struct hardfiledata *hfd, uae_u32 dostype, int bootpri, char *filesys)
+{
+ uae_u8 *rdb, *part, *denv;
+ int cyl = hfd->heads * hfd->secspertrack;
+ int cyls = 262144 / (cyl * 512);
+ int size = cyl * cyls * 512;
+
+ rdb = xcalloc (size, 1);
+ hfd->virtual_rdb = rdb;
+ hfd->virtual_size = size;
+ part = rdb + 512;
+ pl(rdb, 0, 0x5244534b);
+ pl(rdb, 1, 64);
+ pl(rdb, 2, 0); // chksum
+ pl(rdb, 3, 0); // hostid
+ pl(rdb, 4, 512); // blockbytes
+ pl(rdb, 5, 0); // flags
+ pl(rdb, 6, -1); // badblock
+ pl(rdb, 7, 1); // part
+ pl(rdb, 8, -1); // fs
+ pl(rdb, 9, -1); // driveinit
+ pl(rdb, 10, -1); // reserved
+ pl(rdb, 11, -1); // reserved
+ pl(rdb, 12, -1); // reserved
+ pl(rdb, 13, -1); // reserved
+ pl(rdb, 14, -1); // reserved
+ pl(rdb, 15, -1); // reserved
+ pl(rdb, 16, hfd->nrcyls);
+ pl(rdb, 17, hfd->secspertrack);
+ pl(rdb, 18, hfd->heads);
+ pl(rdb, 19, 0); // interleave
+ pl(rdb, 20, 0); // park
+ pl(rdb, 21, -1); // res
+ pl(rdb, 22, -1); // res
+ pl(rdb, 23, -1); // res
+ pl(rdb, 24, 0); // writeprecomp
+ pl(rdb, 25, 0); // reducedwrite
+ pl(rdb, 26, 0); // steprate
+ pl(rdb, 27, -1); // res
+ pl(rdb, 28, -1); // res
+ pl(rdb, 29, -1); // res
+ pl(rdb, 30, -1); // res
+ pl(rdb, 31, -1); // res
+ pl(rdb, 32, 0); // rdbblockslo
+ pl(rdb, 33, cyl * cyls); // rdbblockshi
+ pl(rdb, 34, cyls); // locyl
+ pl(rdb, 35, hfd->nrcyls + cyls); // hicyl
+ pl(rdb, 36, cyl); // cylblocks
+ pl(rdb, 37, 0); // autopark
+ pl(rdb, 38, 2); // highrdskblock
+ pl(rdb, 39, -1); // res
+ strcpy (rdb + 40 * 4, hfd->vendor_id);
+ strcpy (rdb + 42 * 4, hfd->product_id);
+ strcpy (rdb + 46 * 4, "UAE");
+ rdb_crc(rdb);
+
+ pl(part, 0, 0x50415254);
+ pl(part, 1, 64);
+ pl(part, 2, 0);
+ pl(part, 3, 0);
+ pl(part, 4, -1);
+ pl(part, 5, 1); // bootable
+ pl(part, 6, -1);
+ pl(part, 7, -1);
+ pl(part, 8, 0); // devflags
+ part[9 * 4] = strlen(hfd->device_name);
+ strcpy (part + 9 * 4 + 1, hfd->device_name);
+
+ denv = part + 128;
+ pl(denv, 0, 80);
+ pl(denv, 1, 512 / 4);
+ pl(denv, 2, 0); // secorg
+ pl(denv, 3, hfd->heads);
+ pl(denv, 4, hfd->blocksize / 512);
+ pl(denv, 5, hfd->secspertrack);
+ pl(denv, 6, hfd->reservedblocks);
+ pl(denv, 7, 0); // prealloc
+ pl(denv, 8, 0); // interleave
+ pl(denv, 9, cyls); // lowcyl
+ pl(denv, 10, hfd->nrcyls + cyls - 1);
+ pl(denv, 11, 50);
+ pl(denv, 12, 0);
+ pl(denv, 13, 0x00ffffff);
+ pl(denv, 14, 0x7ffffffe);
+ pl(denv, 15, bootpri);
+ pl(denv, 16, dostype);
+ rdb_crc(part);
+
+ hfd->size += size;
+ hfd->size2 += size;
+
+}
+
+int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly,
+ char *devname, int sectors, int surfaces, int reserved,
+ int bootpri, char *filesys)
{
struct ide_hdf *ide;
if (!hdf_open(&ide->hfd, path))
return -1;
ide->path = my_strdup(path);
- write_log("IDE%d initialized ('%s')\n", ch, path);
+ ide->hfd.heads = surfaces;
+ ide->hfd.reservedblocks = reserved;
+ ide->hfd.secspertrack = sectors;
+ if (devname)
+ strcpy (ide->hfd.device_name, devname);
getchs2(&ide->hfd, &ide->cyls, &ide->heads, &ide->secspertrack);
ide->cyls_def = ide->cyls;
ide->secspertrack_def = ide->secspertrack;
ide->heads_def = ide->heads;
+ if (ide->hfd.heads && ide->hfd.secspertrack) {
+ uae_u8 buf[512] = { 0 };
+ hdf_read(&ide->hfd, buf, 0, 512);
+ if (buf[0] != 0 && memcmp(buf, "RDSK", 4)) {
+ ide->hfd.nrcyls = (ide->hfd.size / blocksize) / (sectors * surfaces);
+ create_virtual_rdb(&ide->hfd, rl (buf), bootpri, filesys);
+ while (ide->hfd.nrcyls * surfaces * sectors > ide->cyls_def * ide->secspertrack_def * ide->heads_def) {
+ ide->cyls_def++;
+ }
+ }
+ }
ide->size = ide->hfd.size;
- write_log("CHS=%d,%d,%d\n", ide->cyls, ide->heads, ide->secspertrack);
+ write_log("IDE%d ('%s'), CHS=%d,%d,%d\n", ch, path, ide->cyls, ide->heads, ide->secspertrack);
ide->status = 0;
ide->data_offset = 0;
ide->data_size = 0;
ide_feat2 = restore_u8();
ide_error = restore_u8();
ide_devcon = restore_u8();
- gayle_add_ide_unit (num, path, blocksize, readonly);
+ gayle_add_ide_unit (num, path, blocksize, readonly, 0, 0, 0, 0, 0, 0);
xfree(path);
return src;
}
#include "options.h"
#include "custom.h"
#include "xwin.h"
+#include "gfxfilter.h"
#include <math.h>
return (alpha & ((1 << bits) - 1)) << shift;
}
-#if 0
-static void colormodify (int *r, int *g, int *b)
-{
- double h, l, s;
-
- RGBToHLS (*r, *g, *b, &h, &l, &s);
-
- h = h + currprefs.gfx_hue / 10.0;
- if (h > 359) h = 359;
- if (h < 0) h = 0;
- s = s + currprefs.gfx_saturation / 30.0;
- if (s > 99) s = 99;
- if (s < 0) s = 0;
- l = l + currprefs.gfx_luminance / 30.0;
- l = (l - currprefs.gfx_contrast / 30.0) / (100 - 2 * currprefs.gfx_contrast / 30.0) * 100;
- l = pow (l / 100.0, (currprefs.gfx_gamma + 1000) / 1000.0) * 100.0;
- if (l > 99) l = 99;
- if (l < 0) l = 0;
- HLSToRGB (h, l, s, r, g, b);
-}
-#endif
-
-
static float video_gamma(float value, float gamma, float bri, float con)
{
double factor;
return ret;
}
-static int pal_scanlineshade = 667;
-
static uae_u32 gamma[256 * 3];
+static int lf, hf;
static void video_calc_gammatable(void)
{
int i;
- float bri, con, gam, scn, v;
+ float bri, con, gam, v;
uae_u32 vi;
- uae_u32 gamma_fac[256 * 3];
bri = ((float)(currprefs.gfx_luminance))
* (128.0f / 1000.0f);
con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
- gam = ((float)(currprefs.gfx_gamma + 1000 )) / 1000.0f;
- scn = ((float)(pal_scanlineshade)) / 1000.0f;
+ gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f;
+
+ lf = 64 * currprefs.gfx_filter_blur / 1000;
+ hf = 256 - lf * 2;
for (i = 0; i < (256 * 3); i++) {
v = video_gamma((float)(i - 256), gam, bri, con);
vi = i & 0xff;
gamma[i] = vi;
-
- vi = (uae_u32)(v * scn);
- if (vi > 255)
- vi = 255;
- gamma_fac[i] = vi;
}
}
+static uae_u32 limit256(double v)
+{
+ v = v * (double)(currprefs.gfx_filter_contrast + 1000) / 1000.0 + currprefs.gfx_filter_luminance / 10.0;
+ if (v < 0)
+ v = 0;
+ if (v > 255)
+ v = 255;
+ return ((uae_u32)v) & 0xff;
+}
+static uae_u32 limit256rb(double v)
+{
+ v *= (double)(currprefs.gfx_filter_saturation + 1000) / 1000.0;
+ if (v < -128)
+ v = -128;
+ if (v > 127)
+ v = 127;
+ return ((uae_u32)v) & 0xff;
+}
+static double get_y(int r, int g, int b)
+{
+ return 0.2989f*r + 0.5866f*g + 0.1145f*b;
+}
+static uae_u32 get_yh(int r, int g, int b)
+{
+ return limit256(get_y(r, g, b) * hf / 256);
+}
+static uae_u32 get_yl(int r, int g, int b)
+{
+ return limit256(get_y(r, g, b) * lf / 256);
+}
+static uae_u32 get_cb(int r, int g, int b)
+{
+ return limit256rb(-0.168736f*r - 0.331264f*g + 0.5f*b);
+}
+static uae_u32 get_cr(int r, int g, int b)
+{
+ return limit256rb(0.5f*r - 0.418688f*g - 0.081312f*b);
+}
+
+extern uae_s32 tyhrgb[262144];
+extern uae_s32 tylrgb[262144];
+extern uae_s32 tcbrgb[262144];
+extern uae_s32 tcrrgb[262144];
void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap)
{
int r = ((i >> 8) << 4) | (i >> 8);
int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f);
int b = ((i & 0xf) << 4) | (i & 0x0f);
- r = gamma[r + j];
- g = gamma[g + j];
- b = gamma[b + j];
- xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha (alpha, aw, as);
- if (byte_swap) {
- if (bpp <= 16)
- xcolors[i] = bswap_16 (xcolors[i]);
- else
- xcolors[i] = bswap_32 (xcolors[i]);
- }
- if (bpp <= 16) {
- /* Fill upper 16 bits of each colour value
- * with a copy of the colour. */
- xcolors[i] |= xcolors[i] * 0x00010001;
+ if (usedfilter && usedfilter->yuv && !(currprefs.chipset_mask & CSMASK_AGA)) {
+ xcolors[i] = (get_yh(r, g, b) << 24) | (get_yl(r, g, b) << 16) | (get_cb(r, g, b) << 8) | (get_cr(r, g, b) << 0);
+ } else {
+ r = gamma[r + j];
+ g = gamma[g + j];
+ b = gamma[b + j];
+ xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha (alpha, aw, as);
+ if (byte_swap) {
+ if (bpp <= 16)
+ xcolors[i] = bswap_16 (xcolors[i]);
+ else
+ xcolors[i] = bswap_32 (xcolors[i]);
+ }
+ if (bpp <= 16) {
+ /* Fill upper 16 bits of each colour value
+ * with a copy of the colour. */
+ xcolors[i] |= xcolors[i] * 0x00010001;
+ }
}
}
#ifdef AGA
xbluecolors [i] = xbluecolors [i] * 0x00010001;
}
}
+ /* create AGA RGB 6:6:6 YUV-filter tables */
+ if (usedfilter && usedfilter->yuv && (currprefs.chipset_mask & CSMASK_AGA)) {
+ for (i = 0; i < 262144; i++) {
+ uae_u32 r, g, b;
+ r = ((i >> 12) & 0x3f) << 2;
+ r = doColor(gamma[r + 256], rw, 0);
+ g = ((i >> 6) & 0x3f) << 2;
+ g = doColor(gamma[g + 256], gw, 0);
+ b = ((i >> 0) & 0x3f) << 2;
+ b = doColor(gamma[b + 256], bw, 0);
+ tyhrgb[i] = get_yh (r, g, b) * 256 * 256;
+ tylrgb[i] = get_yl (r, g, b) * 256 * 256;
+ tcbrgb[i] = ((uae_s8)get_cb (r, g, b)) * 256;
+ tcrrgb[i] = ((uae_s8)get_cr (r, g, b)) * 256;
+ }
+ }
#endif
xredcolor_b = rw;
--- /dev/null
+/*
+ * cpummu.h - MMU emulation
+ *
+ * Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
+ *
+ * Inspired by UAE MMU patch
+ *
+ * This file is part of the ARAnyM project which builds a new and powerful
+ * TOS/FreeMiNT compatible virtual machine running on almost any hardware.
+ *
+ * ARAnyM is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ARAnyM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with ARAnyM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef CPUMMU_H
+#define CPUMMU_H
+
+#define SAVE_EXCEPTION
+#define RESTORE_EXCEPTION
+#define TRY(x)
+#define CATCH(x)
+#define THROW(x)
+#define THROW_AGAIN(x)
+#define likely(x) x
+
+#define MMU_TEST_PTEST 1
+#define MMU_TEST_VERBOSE 2
+#define MMU_TEST_FORCE_TABLE_SEARCH 4
+#define MMU_TEST_NO_BUSERR 8
+
+extern void mmu_dump_tables(void);
+
+#define MMU_TTR_LOGICAL_BASE 0xff000000
+#define MMU_TTR_LOGICAL_MASK 0x00ff0000
+#define MMU_TTR_BIT_ENABLED (1 << 15)
+#define MMU_TTR_BIT_SFIELD_ENABLED (1 << 14)
+#define MMU_TTR_BIT_SFIELD_SUPER (1 << 13)
+#define MMU_TTR_SFIELD_SHIFT 13
+#define MMU_TTR_UX_MASK ((1 << 9) | (1 << 8))
+#define MMU_TTR_UX_SHIFT 8
+#define MMU_TTR_CACHE_MASK ((1 << 6) | (1 << 5))
+#define MMU_TTR_CACHE_SHIFT 5
+#define MMU_TTR_BIT_WRITE_PROTECT (1 << 2)
+
+#define MMU_UDT_MASK 3
+#define MMU_PDT_MASK 3
+
+#define MMU_DES_WP 4
+#define MMU_DES_USED 8
+
+/* page descriptors only */
+#define MMU_DES_MODIFIED 16
+#define MMU_DES_SUPER (1 << 7)
+#define MMU_DES_GLOBAL (1 << 10)
+
+#define MMU_ROOT_PTR_ADDR_MASK 0xfffffe00
+#define MMU_PTR_PAGE_ADDR_MASK_8 0xffffff80
+#define MMU_PTR_PAGE_ADDR_MASK_4 0xffffff00
+
+#define MMU_PAGE_INDIRECT_MASK 0xfffffffc
+#define MMU_PAGE_ADDR_MASK_8 0xffffe000
+#define MMU_PAGE_ADDR_MASK_4 0xfffff000
+#define MMU_PAGE_UR_MASK_8 ((1 << 12) | (1 << 11))
+#define MMU_PAGE_UR_MASK_4 (1 << 11)
+#define MMU_PAGE_UR_SHIFT 11
+
+#define MMU_MMUSR_ADDR_MASK 0xfffff000
+#define MMU_MMUSR_B (1 << 11)
+#define MMU_MMUSR_G (1 << 10)
+#define MMU_MMUSR_U1 (1 << 9)
+#define MMU_MMUSR_U0 (1 << 8)
+#define MMU_MMUSR_Ux (MMU_MMUSR_U1 | MMU_MMUSR_U0)
+#define MMU_MMUSR_S (1 << 7)
+#define MMU_MMUSR_CM ((1 << 6) | ( 1 << 5))
+#define MMU_MMUSR_M (1 << 4)
+#define MMU_MMUSR_W (1 << 2)
+#define MMU_MMUSR_T (1 << 1)
+#define MMU_MMUSR_R (1 << 0)
+
+/* special status word (access error stack frame) */
+#define MMU_SSW_TM 0x0007
+#define MMU_SSW_TT 0x0018
+#define MMU_SSW_SIZE 0x0060
+#define MMU_SSW_SIZE_B 0x0020
+#define MMU_SSW_SIZE_W 0x0040
+#define MMU_SSW_SIZE_L 0x0000
+#define MMU_SSW_RW 0x0100
+#define MMU_SSW_LK 0x0200
+#define MMU_SSW_ATC 0x0400
+#define MMU_SSW_MA 0x0800
+
+#define TTR_I0 4
+#define TTR_I1 5
+#define TTR_D0 6
+#define TTR_D1 7
+
+#define TTR_NO_MATCH 0
+#define TTR_NO_WRITE 1
+#define TTR_OK_MATCH 2
+
+struct mmu_atc_line {
+ uae_u16 tag;
+ unsigned tt : 1;
+ unsigned valid_data : 1;
+ unsigned valid_inst : 1;
+ unsigned global : 1;
+ unsigned modified : 1;
+ unsigned write_protect : 1;
+ unsigned hw : 1;
+ unsigned bus_fault : 1;
+ uaecptr phys;
+};
+
+/*
+ * We don't need to store the whole logical address in the atc cache, as part of
+ * it is encoded as index into the cache. 14 bits of the address are stored in
+ * the tag, this means at least 6 bits must go into the index. The upper two
+ * bits of the tag define the type of data in the atc line:
+ * - 00: a normal memory address
+ * - 11: invalid memory address or hardware access
+ * (generated via ~ATC_TAG(addr) in the slow path)
+ * - 10: empty atc line
+ */
+
+#define ATC_TAG_SHIFT 18
+#define ATC_TAG(addr) ((uae_u32)(addr) >> ATC_TAG_SHIFT)
+
+
+#define ATC_L1_SIZE_LOG 8
+#define ATC_L1_SIZE (1 << ATC_L1_SIZE_LOG)
+
+#define ATC_L1_INDEX(addr) (((addr) >> 12) % ATC_L1_SIZE)
+
+/*
+ * first level atc cache
+ * indexed by [super][data][rw][idx]
+ */
+
+typedef struct mmu_atc_line mmu_atc_l1_array[2][2][ATC_L1_SIZE];
+extern mmu_atc_l1_array atc_l1[2];
+extern mmu_atc_l1_array *current_atc;
+
+#define ATC_L2_SIZE_LOG 12
+#define ATC_L2_SIZE (1 << ATC_L2_SIZE_LOG)
+
+#define ATC_L2_INDEX(addr) ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
+
+extern struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
+
+/*
+ * lookup address in the level 1 atc cache,
+ * the data and write arguments are constant in the common,
+ * thus allows gcc to generate a constant offset.
+ */
+STATIC_INLINE int mmu_lookup(uaecptr addr, int data, int write,
+ struct mmu_atc_line **cl)
+{
+ addr >>= 12;
+ *cl = &(*current_atc)[data][write][addr % ATC_L1_SIZE];
+ return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
+}
+
+/*
+ * similiar to mmu_user_lookup, but for the use of the moves instruction
+ */
+STATIC_INLINE int mmu_user_lookup(uaecptr addr, int super, int data,
+ int write, struct mmu_atc_line **cl)
+{
+ addr >>= 12;
+ *cl = &atc_l1[super][data][write][addr % ATC_L1_SIZE];
+ return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
+}
+
+extern uae_u16 REGPARAM3 mmu_get_word_unaligned(uaecptr addr, int data) REGPARAM;
+extern uae_u32 REGPARAM3mmu_get_long_unaligned(uaecptr addr, int data) REGPARAM;
+
+extern uae_u8 REGPARAM3 mmu_get_byte_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+extern uae_u16 REGPARAM3 mmu_get_word_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+extern uae_u32 REGPARAM3 mmu_get_long_slow(uaecptr addr, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+
+extern void REGPARAM3 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, int data) REGPARAM;
+extern void REGPARAM3 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, int data) REGPARAM;
+
+extern void REGPARAM3 mmu_put_byte_slow(uaecptr addr, uae_u8 val, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+extern void REGPARAM3 mmu_put_word_slow(uaecptr addr, uae_u16 val, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+extern void REGPARAM3 mmu_put_long_slow(uaecptr addr, uae_u32 val, int super, int data,
+ int size, struct mmu_atc_line *cl) REGPARAM;
+
+extern void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode);
+
+STATIC_INLINE void mmu_set_ttr(int regno, uae_u32 val)
+{
+ uae_u32 * ttr;
+ switch(regno) {
+ case TTR_I0: ttr = ®s.itt0; break;
+ case TTR_I1: ttr = ®s.itt1; break;
+ case TTR_D0: ttr = ®s.dtt0; break;
+ case TTR_D1: ttr = ®s.dtt1; break;
+ default: abort();
+ }
+ *ttr = val;
+}
+
+STATIC_INLINE void mmu_set_mmusr(uae_u32 val)
+{
+ regs.mmusr = val;
+}
+
+STATIC_INLINE void mmu_set_root_pointer(int regno, uae_u32 val)
+{
+ val &= MMU_ROOT_PTR_ADDR_MASK;
+ switch (regno) {
+ case 0x806:
+ regs.urp = val;
+ break;
+ case 0x807:
+ regs.srp = val;
+ break;
+ default:
+ abort();
+ }
+}
+
+#define FC_DATA (regs.s ? 5 : 1)
+#define FC_INST (regs.s ? 6 : 2)
+
+extern uaecptr REGPARAM3 mmu_translate(uaecptr addr, int super, int data, int write);
+
+extern uae_u32 REGPARAM3 sfc_get_long(uaecptr addr) REGPARAM;
+extern uae_u16 REGPARAM3 sfc_get_word(uaecptr addr) REGPARAM;
+extern uae_u8 REGPARAM3 sfc_get_byte(uaecptr addr) REGPARAM;
+extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
+extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
+extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
+
+extern void REGPARAM3 mmu_flush_atc(uaecptr addr, int super, int global) REGPARAM;
+extern void REGPARAM3 mmu_flush_atc_all(int global) REGPARAM;
+
+extern void REGPARAM3 mmu_reset(void) REGPARAM;
+extern void REGPARAM3 mmu_set_tc(uae_u16 tc) REGPARAM;
+extern void REGPARAM3 mmu_set_super(int super) REGPARAM;
+
+
+STATIC_INLINE int test_ram_boundary(uaecptr a, int b, int c, int d) { return 1; }
+STATIC_INLINE void check_ram_boundary(uaecptr a, int b, int c) { }
+STATIC_INLINE int phys_valid_address(uaecptr a,int b, int c) { return 1; }
+
+
+
+STATIC_INLINE uae_u32 phys_get_long(uaecptr addr)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ read_page) <= ARAM_PAGE_MASK))
+ return do_get_mem_long((uae_u32*)(addr + read_offset));
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) return HWget_l(addr);
+#endif
+ check_ram_boundary(addr, 4, false);
+ uae_u32 * const m = (uae_u32 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ read_page = addr;
+ read_offset = (uintptr)m - (uintptr)addr;
+#endif
+ return do_get_mem_long(m);
+}
+
+STATIC_INLINE uae_u32 phys_get_word(uaecptr addr)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ read_page) <= ARAM_PAGE_MASK))
+ return do_get_mem_word((uae_u16*)(addr + read_offset));
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) return HWget_w(addr);
+#endif
+ check_ram_boundary(addr, 2, false);
+ uae_u16 * const m = (uae_u16 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ read_page = addr;
+ read_offset = (uintptr)m - (uintptr)addr;
+#endif
+ return do_get_mem_word(m);
+}
+
+STATIC_INLINE uae_u32 phys_get_byte(uaecptr addr)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ read_page) <= ARAM_PAGE_MASK))
+ return do_get_mem_byte((uae_u8*)(addr + read_offset));
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) return HWget_b(addr);
+#endif
+ check_ram_boundary(addr, 1, false);
+ uae_u8 * const m = (uae_u8 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ read_page = addr;
+ read_offset = (uintptr)m - (uintptr)addr;
+#endif
+ return do_get_mem_byte(m);
+}
+
+STATIC_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ write_page) <= ARAM_PAGE_MASK)) {
+ do_put_mem_long((uae_u32*)(addr + write_offset), l);
+ return;
+ }
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) {
+ HWput_l(addr, l);
+ return;
+ }
+#endif
+ check_ram_boundary(addr, 4, true);
+ uae_u32 * const m = (uae_u32 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ write_page = addr;
+ write_offset = (uintptr)m - (uintptr)addr;
+#endif
+ do_put_mem_long(m, l);
+}
+
+STATIC_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ write_page) <= ARAM_PAGE_MASK)) {
+ do_put_mem_word((uae_u16*)(addr + write_offset), w);
+ return;
+ }
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) {
+ HWput_w(addr, w);
+ return;
+ }
+#endif
+ check_ram_boundary(addr, 2, true);
+ uae_u16 * const m = (uae_u16 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ write_page = addr;
+ write_offset = (uintptr)m - (uintptr)addr;
+#endif
+ do_put_mem_word(m, w);
+}
+
+STATIC_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
+{
+#if ARAM_PAGE_CHECK
+ if (((addr ^ write_page) <= ARAM_PAGE_MASK)) {
+ do_put_mem_byte((uae_u8*)(addr + write_offset), b);
+ return;
+ }
+#endif
+#ifndef HW_SIGSEGV
+ addr = addr < 0xff000000 ? addr : addr & 0x00ffffff;
+ if ((addr & 0xfff00000) == 0x00f00000) {
+ HWput_b(addr, b);
+ return;
+ }
+#endif
+ check_ram_boundary(addr, 1, true);
+ uae_u8 * const m = (uae_u8 *)phys_get_real_address(addr);
+#if ARAM_PAGE_CHECK
+ write_page = addr;
+ write_offset = (uintptr)m - (uintptr)addr;
+#endif
+ do_put_mem_byte(m, b);
+}
+
+#ifdef FULLMMU
+STATIC_INLINE int is_unaligned(uaecptr addr, int size)
+{
+ return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & 0x1000);
+}
+
+STATIC_INLINE uae_u8 *mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl)
+{
+ return do_get_real_address(cl->phys + addr);
+}
+
+STATIC_INLINE uae_u32 mmu_get_long(uaecptr addr, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 0, &cl)))
+ return do_get_mem_long((uae_u32 *)mmu_get_real_address(addr, cl));
+ return mmu_get_long_slow(addr, regs.s, data, size, cl);
+}
+
+STATIC_INLINE uae_u32 get_long(uaecptr addr)
+{
+ if (unlikely(is_unaligned(addr, 4)))
+ return mmu_get_long_unaligned(addr, 1);
+ return mmu_get_long(addr, 1, sz_long);
+}
+
+STATIC_INLINE uae_u16 mmu_get_word(uaecptr addr, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 0, &cl)))
+ return do_get_mem_word((uae_u16 *)mmu_get_real_address(addr, cl));
+ return mmu_get_word_slow(addr, regs.s, data, size, cl);
+}
+
+STATIC_INLINE uae_u16 get_word(uaecptr addr)
+{
+ if (unlikely(is_unaligned(addr, 2)))
+ return mmu_get_word_unaligned(addr, 1);
+ return mmu_get_word(addr, 1, sz_word);
+}
+
+STATIC_INLINE uae_u8 mmu_get_byte(uaecptr addr, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 0, &cl)))
+ return do_get_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl));
+ return mmu_get_byte_slow(addr, regs.s, data, size, cl);
+}
+
+STATIC_INLINE uae_u8 get_byte(uaecptr addr)
+{
+ return mmu_get_byte(addr, 1, sz_byte);
+}
+
+STATIC_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 1, &cl)))
+ do_put_mem_long((uae_u32 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_long_slow(addr, val, regs.s, data, size, cl);
+}
+
+STATIC_INLINE void put_long(uaecptr addr, uae_u32 val)
+{
+ if (unlikely(is_unaligned(addr, 4)))
+ mmu_put_long_unaligned(addr, val, 1);
+ else
+ mmu_put_long(addr, val, 1, sz_long);
+}
+
+STATIC_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 1, &cl)))
+ do_put_mem_word((uae_u16 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_word_slow(addr, val, regs.s, data, size, cl);
+}
+
+STATIC_INLINE void put_word(uaecptr addr, uae_u16 val)
+{
+ if (unlikely(is_unaligned(addr, 2)))
+ mmu_put_word_unaligned(addr, val, 1);
+ else
+ mmu_put_word(addr, val, 1, sz_word);
+}
+
+STATIC_INLINE void mmu_put_byte(uaecptr addr, uae_u8 val, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_lookup(addr, data, 1, &cl)))
+ do_put_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_byte_slow(addr, val, regs.s, data, size, cl);
+}
+
+STATIC_INLINE void put_byte(uaecptr addr, uae_u8 val)
+{
+ mmu_put_byte(addr, val, 1, sz_byte);
+}
+
+STATIC_INLINE uae_u8 *get_real_address(uaecptr addr, int write, int sz)
+{
+ (void)sz;
+ return phys_get_real_address(mmu_translate(addr, regs.s, 1, write));
+}
+
+STATIC_INLINE uae_u32 mmu_get_user_long(uaecptr addr, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
+ return do_get_mem_long((uae_u32 *)mmu_get_real_address(addr, cl));
+ return mmu_get_long_slow(addr, super, data, size, cl);
+}
+
+STATIC_INLINE uae_u16 mmu_get_user_word(uaecptr addr, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
+ return do_get_mem_word((uae_u16 *)mmu_get_real_address(addr, cl));
+ return mmu_get_word_slow(addr, super, data, size, cl);
+}
+
+STATIC_INLINE uae_u8 mmu_get_user_byte(uaecptr addr, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
+ return do_get_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl));
+ return mmu_get_byte_slow(addr, super, data, size, cl);
+}
+
+STATIC_INLINE void mmu_put_user_long(uaecptr addr, uae_u32 val, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
+ do_put_mem_long((uae_u32 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_long_slow(addr, val, super, data, size, cl);
+}
+
+STATIC_INLINE void mmu_put_user_word(uaecptr addr, uae_u16 val, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
+ do_put_mem_word((uae_u16 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_word_slow(addr, val, super, data, size, cl);
+}
+
+STATIC_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, int super, int data, int size)
+{
+ struct mmu_atc_line *cl;
+
+ if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
+ do_put_mem_byte((uae_u8 *)mmu_get_real_address(addr, cl), val);
+ else
+ mmu_put_byte_slow(addr, val, super, data, size, cl);
+}
+
+STATIC_INLINE int valid_address(uaecptr addr, int write, int sz)
+{
+ SAVE_EXCEPTION;
+ TRY(prb) {
+ (void)sz;
+ check_ram_boundary(mmu_translate(addr, regs.s, 1, (write ? 1 : 0)), sz, write);
+ RESTORE_EXCEPTION;
+ return true;
+ }
+ CATCH(prb) {
+ RESTORE_EXCEPTION;
+ return false;
+ }
+}
+
+#else
+
+#define get_long(a) phys_get_long(a)
+#define get_word(a) phys_get_word(a)
+#define get_byte(a) phys_get_byte(a)
+#define put_long(a,b) phys_put_long(a,b)
+#define put_word(a,b) phys_put_word(a,b)
+#define put_byte(a,b) phys_put_byte(a,b)
+#define get_real_address(a,w,s) phys_get_real_address(a)
+
+#define valid_address(a,w,s) phys_valid_address(a,w,s)
+#endif
+
+STATIC_INLINE void flush_internals(void)
+{
+#if ARAM_PAGE_CHECK
+ pc_page = 0xeeeeeeee;
+ read_page = 0xeeeeeeee;
+ write_page = 0xeeeeeeee;
+#endif
+}
+
+
+#endif
#define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
extern int lores_factor, lores_shift, sprite_width, interlace_seen;
+extern int aga_mode, direct_rgb;
STATIC_INLINE int coord_hw_to_window_x (int x)
{
STATIC_INLINE xcolnr getxcolor (int c)
{
#ifdef AGA
- if (currprefs.chipset_mask & CSMASK_AGA)
+ if (direct_rgb)
return CONVERT_RGB(c);
else
#endif
STATIC_INLINE int color_reg_get (struct color_entry *ce, int c)
{
#ifdef AGA
- if (currprefs.chipset_mask & CSMASK_AGA)
+ if (aga_mode)
return ce->color_regs_aga[c];
else
#endif
STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v)
{
#ifdef AGA
- if (currprefs.chipset_mask & CSMASK_AGA)
+ if (aga_mode)
ce->color_regs_aga[c] = v;
else
#endif
STATIC_INLINE int color_reg_cmp (struct color_entry *ce1, struct color_entry *ce2)
{
#ifdef AGA
- if (currprefs.chipset_mask & CSMASK_AGA)
+ if (aga_mode)
return memcmp (ce1->color_regs_aga, ce2->color_regs_aga, sizeof (uae_u32) * 256);
else
#endif
STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *src)
{
#ifdef AGA
- if (currprefs.chipset_mask & CSMASK_AGA)
+ if (aga_mode)
/* copy acolors and color_regs_aga */
memcpy (dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32);
else
uae_u64 size2;
uae_u64 offset2;
int warned;
+ uae_u8 *virtual_rdb;
+ uae_u64 virtual_size;
};
#define FILESYS_VIRTUAL 0
extern void gayle_reset(int);
extern void mbdmac_hsync(void);
-extern int gayle_add_ide_unit(int, char*, int, int);
+extern int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly,
+ char *devname, int sectors, int surfaces, int reserved,
+ int bootpri, char *filesys);
extern void gayle_free_ide_units(void);
extern void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd);
extern void S2X_free (void);
+extern void PAL_init (void);
+extern void PAL_1x1_32(uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, int height);
+extern void PAL_1x1_AGA_32(uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, int height);
+extern void PAL_1x1_16(uae_u32 *src, int pitchs, uae_u16 *trg, int pitcht, int width, int height);
+extern void PAL_1x1_AGA_16(uae_u32 *src, int pitchs, uae_u16 *trg, int pitcht, int width, int height);
+
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned long uint32;
#define UAE_FILTER_SUPEREAGLE 5
#define UAE_FILTER_SUPER2XSAI 6
#define UAE_FILTER_2XSAI 7
-#define UAE_FILTER_HQ 8
+#define UAE_FILTER_PAL 8
+#define UAE_FILTER_HQ 9
#define UAE_FILTER_MODE_16 16
#define UAE_FILTER_MODE_16_16 16
struct uae_filter
{
- int type;
+ int type, yuv;
char *name, *cfgname;
int x[5];
};
extern addrbank gfxmem_bank, gfxmem_bankx;
extern addrbank gayle_bank;
extern addrbank gayle2_bank;
+extern addrbank gayle_attr_bank;
extern addrbank mbres_bank;
extern addrbank akiko_bank;
extern addrbank mbdmac_bank;
uae_u32 fpcr,fpsr, fpiar;
uae_u32 fpsr_highbyte;
#endif
+#ifndef CPUEMU_68000_ONLY
+ uae_u32 cacr, caar;
+ uae_u32 itt0, itt1, dtt0, dtt1;
+ uae_u32 tcr, mmusr, urp, srp, buscr;
+
+ uae_u32 mmu_fslw, mmu_fault_addr;
+ uae_u16 mmu_ssw;
+ uae_u32 wb3_data;
+ uae_u16 wb3_status;
+ int mmu_enabled;
+ int mmu_pagesize_8k;
+#endif
uae_u32 pcr;
uae_u32 spcflags;
int gfx_pfullscreen;
int gfx_xcenter;
int gfx_ycenter;
- int gfx_hue, gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
+ int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
+ int color_mode;
int gfx_filter;
int gfx_filter_scanlines;
int gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
int gfx_filter_horiz_offset, gfx_filter_vert_offset;
int gfx_filter_filtermode;
- int color_mode;
+ int gfx_filter_noise, gfx_filter_blur;
+ int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
int immediate_blits;
unsigned int chipset_mask;
}
if (currprefs.cs_ide) {
map_banks (&gayle_bank, 0xD8, 6, 0);
- if(currprefs.cs_ide == 1)
+ if(currprefs.cs_ide == 1) {
map_banks (&gayle2_bank, 0xDD, 2, 0);
- else if (currprefs.cs_ide == 2)
+ // map_banks (&gayle_attr_bank, 0xA0, 8, 0); only if PCMCIA card inserted */
+ } else if (currprefs.cs_ide == 2) {
map_banks (&gayle_bank, 0xDD, 2, 0);
+ }
}
if (currprefs.cs_rtc)
map_banks (&clock_bank, 0xDC, 1, 0);
}
#endif
-static uae_u32 caar, cacr, itt0, itt1, dtt0, dtt1, tcr, mmusr, urp, srp, buscr;
-
static void set_cpu_caches(void)
{
#ifdef JIT
if (currprefs.cpu_model < 68040) {
- set_cache_state(cacr & 1);
- if (cacr & 0x08) {
- cacr &= ~0x08;
+ set_cache_state(regs.cacr & 1);
+ if (regs.cacr & 0x08) {
+ regs.cacr &= ~0x08;
flush_icache(1);
}
} else {
- set_cache_state(cacr & 0x8000);
+ set_cache_state(regs.cacr & 0x8000);
}
#endif
}
cacr_mask = 0x80008000;
else if (currprefs.cpu_model == 68060)
cacr_mask = 0xf8e0e000;
- cacr = *regp & cacr_mask;
+ regs.cacr = *regp & cacr_mask;
set_cpu_caches();
}
break;
/* 68040/060 only */
- case 3: tcr = *regp & (currprefs.cpu_model == 68060 ? 0xfffe : 0xc000);
+ case 3: regs.tcr = *regp & (currprefs.cpu_model == 68060 ? 0xfffe : 0xc000);
break;
/* no differences between 68040 and 68060 */
- case 4: itt0 = *regp & 0xffffe364; break;
- case 5: itt1 = *regp & 0xffffe364; break;
- case 6: dtt0 = *regp & 0xffffe364; break;
- case 7: dtt1 = *regp & 0xffffe364; break;
+ case 4: regs.itt0 = *regp & 0xffffe364; break;
+ case 5: regs.itt1 = *regp & 0xffffe364; break;
+ case 6: regs.dtt0 = *regp & 0xffffe364; break;
+ case 7: regs.dtt1 = *regp & 0xffffe364; break;
/* 68060 only */
- case 8: buscr = *regp & 0xf0000000; break;
+ case 8: regs.buscr = *regp & 0xf0000000; break;
case 0x800: regs.usp = *regp; break;
case 0x801: regs.vbr = *regp; break;
- case 0x802: caar = *regp & 0xfc; break;
+ case 0x802: regs.caar = *regp & 0xfc; break;
case 0x803: regs.msp = *regp; if (regs.m == 1) m68k_areg(®s, 7) = regs.msp; break;
case 0x804: regs.isp = *regp; if (regs.m == 0) m68k_areg(®s, 7) = regs.isp; break;
/* 68040 only */
- case 0x805: mmusr = *regp; break;
+ case 0x805: regs.mmusr = *regp; break;
/* 68040/060 */
- case 0x806: urp = *regp; break;
- case 0x807: srp = *regp; break;
+ case 0x806: regs.urp = *regp; break;
+ case 0x807: regs.srp = *regp; break;
/* 68060 only */
case 0x808:
{
case 1: *regp = regs.dfc; break;
case 2:
{
- uae_u32 v = cacr;
+ uae_u32 v = regs.cacr;
uae_u32 cacr_mask = 0;
if (currprefs.cpu_model == 68020)
cacr_mask = 0x00000003;
*regp = v & cacr_mask;
}
break;
- case 3: *regp = tcr; break;
- case 4: *regp = itt0; break;
- case 5: *regp = itt1; break;
- case 6: *regp = dtt0; break;
- case 7: *regp = dtt1; break;
- case 8: *regp = buscr; break;
+ case 3: *regp = regs.tcr; break;
+ case 4: *regp = regs.itt0; break;
+ case 5: *regp = regs.itt1; break;
+ case 6: *regp = regs.dtt0; break;
+ case 7: *regp = regs.dtt1; break;
+ case 8: *regp = regs.buscr; break;
case 0x800: *regp = regs.usp; break;
case 0x801: *regp = regs.vbr; break;
- case 0x802: *regp = caar; break;
+ case 0x802: *regp = regs.caar; break;
case 0x803: *regp = regs.m == 1 ? m68k_areg(®s, 7) : regs.msp; break;
case 0x804: *regp = regs.m == 0 ? m68k_areg(®s, 7) : regs.isp; break;
- case 0x805: *regp = mmusr; break;
- case 0x806: *regp = urp; break;
- case 0x807: *regp = srp; break;
+ case 0x805: *regp = regs.mmusr; break;
+ case 0x806: *regp = regs.urp; break;
+ case 0x807: *regp = regs.srp; break;
case 0x808: *regp = regs.pcr; break;
default:
regs.fp_result = 1;
regs.irc = 0xffff;
#endif
- caar = cacr = 0;
- itt0 = itt1 = dtt0 = dtt1 = 0;
- tcr = mmusr = urp = srp = buscr = 0;
+ regs.caar = regs.cacr = 0;
+ regs.itt0 = regs.itt1 = regs.dtt0 = regs.dtt1 = 0;
+ regs.tcr = regs.mmusr = regs.urp = regs.srp = regs.buscr = 0;
/* 68060 FPU is not compatible with 68040,
* 68060 accelerators' boot ROM disables the FPU
*/
#endif
if ((opcode & 0xFE0) == 0x0500) {
/* PFLUSH */
- mmusr = 0;
+ regs->mmusr = 0;
#ifdef MMUOP_DEBUG
write_log ("PFLUSH @$%lx\n", m68k_getpc(regs));
#endif
switch (regno) {
case 0: return regs.sfc;
case 1: return regs.dfc;
- case 2: return cacr;
- case 3: return tcr;
- case 4: return itt0;
- case 5: return itt1;
- case 6: return dtt0;
- case 7: return dtt1;
- case 8: return buscr;
+ case 2: return regs.cacr;
+ case 3: return regs.tcr;
+ case 4: return regs.itt0;
+ case 5: return regs.itt1;
+ case 6: return regs.dtt0;
+ case 7: return regs.dtt1;
+ case 8: return regs.buscr;
case 0x800: return regs.usp;
case 0x801: return regs.vbr;
- case 0x802: return caar;
+ case 0x802: return regs.caar;
case 0x803: return regs.msp;
case 0x804: return regs.isp;
- case 0x805: return mmusr;
- case 0x806: return urp;
- case 0x807: return srp;
+ case 0x805: return regs.mmusr;
+ case 0x806: return regs.urp;
+ case 0x807: return regs.srp;
case 0x808: return regs.pcr;
default: return 0;
}
regs.vbr = restore_u32 ();
}
if (model >= 68020) {
- caar = restore_u32 ();
- cacr = restore_u32 ();
+ regs.caar = restore_u32 ();
+ regs.cacr = restore_u32 ();
regs.msp = restore_u32 ();
/* A500 speed in 68020 mode isn't too logical.. */
if (changed_prefs.m68k_speed == 0)
restore_u32();
}
if (model >= 68040) {
- itt0 = restore_u32();
- itt1 = restore_u32();
- dtt0 = restore_u32();
- dtt1 = restore_u32();
- tcr = restore_u32();
- urp = restore_u32();
- srp = restore_u32();
+ regs.itt0 = restore_u32();
+ regs.itt1 = restore_u32();
+ regs.dtt0 = restore_u32();
+ regs.dtt1 = restore_u32();
+ regs.tcr = restore_u32();
+ regs.urp = restore_u32();
+ regs.srp = restore_u32();
}
if (model >= 68060) {
- buscr = restore_u32();
+ regs.buscr = restore_u32();
regs.pcr = restore_u32();
}
if (flags & 0x80000000) {
save_u32 (regs.vbr); /* VBR */
}
if(model >= 68020) {
- save_u32 (caar); /* CAAR */
- save_u32 (cacr); /* CACR */
+ save_u32 (regs.caar); /* CAAR */
+ save_u32 (regs.cacr); /* CACR */
save_u32 (regs.msp); /* MSP */
}
if(model >= 68030) {
save_u32 (0); /* TT1 */
}
if(model >= 68040) {
- save_u32 (itt0); /* ITT0 */
- save_u32 (itt1); /* ITT1 */
- save_u32 (dtt0); /* DTT0 */
- save_u32 (dtt1); /* DTT1 */
- save_u32 (tcr); /* TCR */
- save_u32 (urp); /* URP */
- save_u32 (srp); /* SRP */
+ save_u32 (regs.itt0); /* ITT0 */
+ save_u32 (regs.itt1); /* ITT1 */
+ save_u32 (regs.dtt0); /* DTT0 */
+ save_u32 (regs.dtt1); /* DTT1 */
+ save_u32 (regs.tcr); /* TCR */
+ save_u32 (regs.urp); /* URP */
+ save_u32 (regs.srp); /* SRP */
}
if(model >= 68060) {
- save_u32 (buscr); /* BUSCR */
+ save_u32 (regs.buscr); /* BUSCR */
save_u32 (regs.pcr); /* PCR */
}
khz = -1;
while ((ret = GetMessage(&msg, NULL, 0, 0)) != 0) {
if (!debugger_active || ret == -1) {
- return 0;
+ return -1;
} else if (!IsWindow(hDbgWnd) || !TranslateAccelerator(hDbgWnd, dbgaccel, &msg) || !IsDialogMessage(hDbgWnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
hdf_close (hfd);
hfd->cache = VirtualAlloc (NULL, CACHE_SIZE, MEM_COMMIT, PAGE_READWRITE);
hfd->cache_valid = 0;
+ hfd->virtual_size = 0;
+ hfd->virtual_rdb = NULL;
if (!hfd->cache) {
write_log ("VirtualAlloc(%d) failed, error %d\n", CACHE_SIZE, GetLastError());
return 0;
hfd->handle_valid = 0;
if (hfd->cache)
VirtualFree (hfd->cache, 0, MEM_RELEASE);
+ xfree(hfd->virtual_rdb);
+ hfd->virtual_rdb = 0;
+ hfd->virtual_size = 0;
hfd->cache = 0;
hfd->cache_valid = 0;
}
gui_message ("hd: memory corruption detected in seek");
abort ();
}
- if (offset >= hfd->size) {
+ if (offset >= hfd->size - hfd->virtual_size) {
gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->size);
abort ();
}
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d < %I64d)", pos, hfd->offset);
abort ();
}
- if (pos >= hfd->offset + hfd->size || pos >= hfd->offset + hfd->size + len) {
+ if (pos >= hfd->offset + hfd->size - hfd->virtual_size || pos >= hfd->offset + hfd->size + len - hfd->virtual_size) {
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->size, len);
abort ();
}
return len;
}
hfd->cache_offset = offset;
- if (offset + CACHE_SIZE > hfd->offset + hfd->size)
- hfd->cache_offset = hfd->offset + hfd->size - CACHE_SIZE;
+ if (offset + CACHE_SIZE > hfd->offset + (hfd->size - hfd->virtual_size))
+ hfd->cache_offset = hfd->offset + (hfd->size - hfd->virtual_size) - CACHE_SIZE;
hdf_seek (hfd, hfd->cache_offset);
poscheck (hfd, CACHE_SIZE);
if (hfd->handle_valid == HDF_HANDLE_WIN32)
{
int got = 0;
uae_u8 *p = buffer;
+
+ if (offset < hfd->virtual_size) {
+ uae_u64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
+ if (!hfd->virtual_rdb)
+ return 0;
+ memcpy (buffer, hfd->virtual_rdb + offset, len2);
+ return len2;
+ }
+ offset -= hfd->virtual_size;
while (len > 0) {
int maxlen = len > CACHE_SIZE ? CACHE_SIZE : len;
int ret = hdf_read_2(hfd, p, offset, maxlen);
{
int got = 0;
uae_u8 *p = buffer;
+ if (offset < hfd->virtual_size)
+ return len;
+ offset -= hfd->virtual_size;
while (len > 0) {
int maxlen = len > CACHE_SIZE ? CACHE_SIZE : len;
int ret = hdf_write_2(hfd, p, offset, maxlen);
--- /dev/null
+//hq2x filter demo program
+//----------------------------------------------------------
+//Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
+
+//This program is free software; you can redistribute it and/or
+//modify it under the terms of the GNU Lesser General Public
+//License as published by the Free Software Foundation; either
+//version 2.1 of the License, or (at your option) any later version.
+//
+//This program is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public
+//License along with this program; if not, write to the Free Software
+//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+#include <stdio.h>
+
+static int LUT16to32[65536];
+static int RGBtoYUV[65536];
+static int YUV1, YUV2;
+const int Ymask = 0x00FF0000;
+const int Umask = 0x0000FF00;
+const int Vmask = 0x000000FF;
+const int trY = 0x00300000;
+const int trU = 0x00000700;
+const int trV = 0x00000006;
+
+inline void Interp1(unsigned char * pc, int c1, int c2)
+{
+ *((int*)pc) = (c1*3+c2) >> 2;
+}
+
+inline void Interp2(unsigned char * pc, int c1, int c2, int c3)
+{
+ *((int*)pc) = (c1*2+c2+c3) >> 2;
+}
+
+inline void Interp5(unsigned char * pc, int c1, int c2)
+{
+ *((int*)pc) = (c1+c2) >> 1;
+}
+
+inline void Interp6(unsigned char * pc, int c1, int c2, int c3)
+{
+ //*((int*)pc) = (c1*5+c2*2+c3)/8;
+
+ *((int*)pc) = ((((c1 & 0x00FF00)*5 + (c2 & 0x00FF00)*2 + (c3 & 0x00FF00) ) & 0x0007F800) +
+ (((c1 & 0xFF00FF)*5 + (c2 & 0xFF00FF)*2 + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
+}
+
+inline void Interp7(unsigned char * pc, int c1, int c2, int c3)
+{
+ //*((int*)pc) = (c1*6+c2+c3)/8;
+
+ *((int*)pc) = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x0007F800) +
+ (((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
+}
+
+inline void Interp9(unsigned char * pc, int c1, int c2, int c3)
+{
+ //*((int*)pc) = (c1*2+(c2+c3)*3)/8;
+
+ *((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*3 ) & 0x0007F800) +
+ (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*3 ) & 0x07F807F8)) >> 3;
+}
+
+inline void Interp10(unsigned char * pc, int c1, int c2, int c3)
+{
+ //*((int*)pc) = (c1*14+c2+c3)/16;
+
+ *((int*)pc) = ((((c1 & 0x00FF00)*14 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x000FF000) +
+ (((c1 & 0xFF00FF)*14 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x0FF00FF0)) >> 4;
+}
+
+
+#define PIXEL00_0 *((int*)(pOut)) = c[5];
+#define PIXEL00_10 Interp1(pOut, c[5], c[1]);
+#define PIXEL00_11 Interp1(pOut, c[5], c[4]);
+#define PIXEL00_12 Interp1(pOut, c[5], c[2]);
+#define PIXEL00_20 Interp2(pOut, c[5], c[4], c[2]);
+#define PIXEL00_21 Interp2(pOut, c[5], c[1], c[2]);
+#define PIXEL00_22 Interp2(pOut, c[5], c[1], c[4]);
+#define PIXEL00_60 Interp6(pOut, c[5], c[2], c[4]);
+#define PIXEL00_61 Interp6(pOut, c[5], c[4], c[2]);
+#define PIXEL00_70 Interp7(pOut, c[5], c[4], c[2]);
+#define PIXEL00_90 Interp9(pOut, c[5], c[4], c[2]);
+#define PIXEL00_100 Interp10(pOut, c[5], c[4], c[2]);
+#define PIXEL01_0 *((int*)(pOut+4)) = c[5];
+#define PIXEL01_10 Interp1(pOut+4, c[5], c[3]);
+#define PIXEL01_11 Interp1(pOut+4, c[5], c[2]);
+#define PIXEL01_12 Interp1(pOut+4, c[5], c[6]);
+#define PIXEL01_20 Interp2(pOut+4, c[5], c[2], c[6]);
+#define PIXEL01_21 Interp2(pOut+4, c[5], c[3], c[6]);
+#define PIXEL01_22 Interp2(pOut+4, c[5], c[3], c[2]);
+#define PIXEL01_60 Interp6(pOut+4, c[5], c[6], c[2]);
+#define PIXEL01_61 Interp6(pOut+4, c[5], c[2], c[6]);
+#define PIXEL01_70 Interp7(pOut+4, c[5], c[2], c[6]);
+#define PIXEL01_90 Interp9(pOut+4, c[5], c[2], c[6]);
+#define PIXEL01_100 Interp10(pOut+4, c[5], c[2], c[6]);
+#define PIXEL10_0 *((int*)(pOut+BpL)) = c[5];
+#define PIXEL10_10 Interp1(pOut+BpL, c[5], c[7]);
+#define PIXEL10_11 Interp1(pOut+BpL, c[5], c[8]);
+#define PIXEL10_12 Interp1(pOut+BpL, c[5], c[4]);
+#define PIXEL10_20 Interp2(pOut+BpL, c[5], c[8], c[4]);
+#define PIXEL10_21 Interp2(pOut+BpL, c[5], c[7], c[4]);
+#define PIXEL10_22 Interp2(pOut+BpL, c[5], c[7], c[8]);
+#define PIXEL10_60 Interp6(pOut+BpL, c[5], c[4], c[8]);
+#define PIXEL10_61 Interp6(pOut+BpL, c[5], c[8], c[4]);
+#define PIXEL10_70 Interp7(pOut+BpL, c[5], c[8], c[4]);
+#define PIXEL10_90 Interp9(pOut+BpL, c[5], c[8], c[4]);
+#define PIXEL10_100 Interp10(pOut+BpL, c[5], c[8], c[4]);
+#define PIXEL11_0 *((int*)(pOut+BpL+4)) = c[5];
+#define PIXEL11_10 Interp1(pOut+BpL+4, c[5], c[9]);
+#define PIXEL11_11 Interp1(pOut+BpL+4, c[5], c[6]);
+#define PIXEL11_12 Interp1(pOut+BpL+4, c[5], c[8]);
+#define PIXEL11_20 Interp2(pOut+BpL+4, c[5], c[6], c[8]);
+#define PIXEL11_21 Interp2(pOut+BpL+4, c[5], c[9], c[8]);
+#define PIXEL11_22 Interp2(pOut+BpL+4, c[5], c[9], c[6]);
+#define PIXEL11_60 Interp6(pOut+BpL+4, c[5], c[8], c[6]);
+#define PIXEL11_61 Interp6(pOut+BpL+4, c[5], c[6], c[8]);
+#define PIXEL11_70 Interp7(pOut+BpL+4, c[5], c[6], c[8]);
+#define PIXEL11_90 Interp9(pOut+BpL+4, c[5], c[6], c[8]);
+#define PIXEL11_100 Interp10(pOut+BpL+4, c[5], c[6], c[8]);
+
+
+
+inline bool Diff(unsigned int w1, unsigned int w2)
+{
+ YUV1 = RGBtoYUV[w1];
+ YUV2 = RGBtoYUV[w2];
+ return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
+ ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
+ ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
+}
+
+void hq2x_32( unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int BpL )
+{
+ int i, j, k;
+ int prevline, nextline;
+ int w[10];
+ int c[10];
+
+ // +----+----+----+
+ // | | | |
+ // | w1 | w2 | w3 |
+ // +----+----+----+
+ // | | | |
+ // | w4 | w5 | w6 |
+ // +----+----+----+
+ // | | | |
+ // | w7 | w8 | w9 |
+ // +----+----+----+
+
+ for (j=0; j<Yres; j++)
+ {
+ if (j>0) prevline = -Xres*2; else prevline = 0;
+ if (j<Yres-1) nextline = Xres*2; else nextline = 0;
+
+ for (i=0; i<Xres; i++)
+ {
+ w[2] = *((unsigned short*)(pIn + prevline));
+ w[5] = *((unsigned short*)pIn);
+ w[8] = *((unsigned short*)(pIn + nextline));
+
+ if (i>0)
+ {
+ w[1] = *((unsigned short*)(pIn + prevline - 2));
+ w[4] = *((unsigned short*)(pIn - 2));
+ w[7] = *((unsigned short*)(pIn + nextline - 2));
+ }
+ else
+ {
+ w[1] = w[2];
+ w[4] = w[5];
+ w[7] = w[8];
+ }
+
+ if (i<Xres-1)
+ {
+ w[3] = *((unsigned short*)(pIn + prevline + 2));
+ w[6] = *((unsigned short*)(pIn + 2));
+ w[9] = *((unsigned short*)(pIn + nextline + 2));
+ }
+ else
+ {
+ w[3] = w[2];
+ w[6] = w[5];
+ w[9] = w[8];
+ }
+
+ int pattern = 0;
+ int flag = 1;
+
+ YUV1 = RGBtoYUV[w[5]];
+
+ for (k=1; k<=9; k++)
+ {
+ if (k==5) continue;
+
+ if ( w[k] != w[5] )
+ {
+ YUV2 = RGBtoYUV[w[k]];
+ if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
+ ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
+ ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
+ pattern |= flag;
+ }
+ flag <<= 1;
+ }
+
+ for (k=1; k<=9; k++)
+ c[k] = LUT16to32[w[k]];
+
+ switch (pattern)
+ {
+ case 0:
+ case 1:
+ case 4:
+ case 32:
+ case 128:
+ case 5:
+ case 132:
+ case 160:
+ case 33:
+ case 129:
+ case 36:
+ case 133:
+ case 164:
+ case 161:
+ case 37:
+ case 165:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 2:
+ case 34:
+ case 130:
+ case 162:
+ {
+ PIXEL00_22
+ PIXEL01_21
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 16:
+ case 17:
+ case 48:
+ case 49:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 64:
+ case 65:
+ case 68:
+ case 69:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_21
+ PIXEL11_22
+ break;
+ }
+ case 8:
+ case 12:
+ case 136:
+ case 140:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 3:
+ case 35:
+ case 131:
+ case 163:
+ {
+ PIXEL00_11
+ PIXEL01_21
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 6:
+ case 38:
+ case 134:
+ case 166:
+ {
+ PIXEL00_22
+ PIXEL01_12
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 20:
+ case 21:
+ case 52:
+ case 53:
+ {
+ PIXEL00_20
+ PIXEL01_11
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 144:
+ case 145:
+ case 176:
+ case 177:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ PIXEL10_20
+ PIXEL11_12
+ break;
+ }
+ case 192:
+ case 193:
+ case 196:
+ case 197:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_21
+ PIXEL11_11
+ break;
+ }
+ case 96:
+ case 97:
+ case 100:
+ case 101:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_12
+ PIXEL11_22
+ break;
+ }
+ case 40:
+ case 44:
+ case 168:
+ case 172:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ PIXEL10_11
+ PIXEL11_20
+ break;
+ }
+ case 9:
+ case 13:
+ case 137:
+ case 141:
+ {
+ PIXEL00_12
+ PIXEL01_20
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 18:
+ case 50:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 80:
+ case 81:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 72:
+ case 76:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 10:
+ case 138:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 66:
+ {
+ PIXEL00_22
+ PIXEL01_21
+ PIXEL10_21
+ PIXEL11_22
+ break;
+ }
+ case 24:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 7:
+ case 39:
+ case 135:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 148:
+ case 149:
+ case 180:
+ {
+ PIXEL00_20
+ PIXEL01_11
+ PIXEL10_20
+ PIXEL11_12
+ break;
+ }
+ case 224:
+ case 228:
+ case 225:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 41:
+ case 169:
+ case 45:
+ {
+ PIXEL00_12
+ PIXEL01_20
+ PIXEL10_11
+ PIXEL11_20
+ break;
+ }
+ case 22:
+ case 54:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 208:
+ case 209:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 104:
+ case 108:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 11:
+ case 139:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 19:
+ case 51:
+ {
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL00_11
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL00_60
+ PIXEL01_90
+ }
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 146:
+ case 178:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ PIXEL11_12
+ }
+ else
+ {
+ PIXEL01_90
+ PIXEL11_61
+ }
+ PIXEL10_20
+ break;
+ }
+ case 84:
+ case 85:
+ {
+ PIXEL00_20
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL01_11
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL01_60
+ PIXEL11_90
+ }
+ PIXEL10_21
+ break;
+ }
+ case 112:
+ case 113:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL10_12
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL10_61
+ PIXEL11_90
+ }
+ break;
+ }
+ case 200:
+ case 204:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ PIXEL11_11
+ }
+ else
+ {
+ PIXEL10_90
+ PIXEL11_60
+ }
+ break;
+ }
+ case 73:
+ case 77:
+ {
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL00_12
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL00_61
+ PIXEL10_90
+ }
+ PIXEL01_20
+ PIXEL11_22
+ break;
+ }
+ case 42:
+ case 170:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ PIXEL10_11
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL10_60
+ }
+ PIXEL01_21
+ PIXEL11_20
+ break;
+ }
+ case 14:
+ case 142:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ PIXEL01_12
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL01_61
+ }
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 67:
+ {
+ PIXEL00_11
+ PIXEL01_21
+ PIXEL10_21
+ PIXEL11_22
+ break;
+ }
+ case 70:
+ {
+ PIXEL00_22
+ PIXEL01_12
+ PIXEL10_21
+ PIXEL11_22
+ break;
+ }
+ case 28:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 152:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 194:
+ {
+ PIXEL00_22
+ PIXEL01_21
+ PIXEL10_21
+ PIXEL11_11
+ break;
+ }
+ case 98:
+ {
+ PIXEL00_22
+ PIXEL01_21
+ PIXEL10_12
+ PIXEL11_22
+ break;
+ }
+ case 56:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 25:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 26:
+ case 31:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 82:
+ case 214:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 88:
+ case 248:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 74:
+ case 107:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 27:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_10
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 86:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_21
+ PIXEL11_10
+ break;
+ }
+ case 216:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ PIXEL10_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 106:
+ {
+ PIXEL00_10
+ PIXEL01_21
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 30:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 210:
+ {
+ PIXEL00_22
+ PIXEL01_10
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 120:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_10
+ break;
+ }
+ case 75:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ PIXEL10_10
+ PIXEL11_22
+ break;
+ }
+ case 29:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ PIXEL10_22
+ PIXEL11_21
+ break;
+ }
+ case 198:
+ {
+ PIXEL00_22
+ PIXEL01_12
+ PIXEL10_21
+ PIXEL11_11
+ break;
+ }
+ case 184:
+ {
+ PIXEL00_21
+ PIXEL01_22
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 99:
+ {
+ PIXEL00_11
+ PIXEL01_21
+ PIXEL10_12
+ PIXEL11_22
+ break;
+ }
+ case 57:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 71:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_21
+ PIXEL11_22
+ break;
+ }
+ case 156:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 226:
+ {
+ PIXEL00_22
+ PIXEL01_21
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 60:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 195:
+ {
+ PIXEL00_11
+ PIXEL01_21
+ PIXEL10_21
+ PIXEL11_11
+ break;
+ }
+ case 102:
+ {
+ PIXEL00_22
+ PIXEL01_12
+ PIXEL10_12
+ PIXEL11_22
+ break;
+ }
+ case 153:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 58:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 83:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 92:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 202:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ PIXEL01_21
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ PIXEL11_11
+ break;
+ }
+ case 78:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ PIXEL11_22
+ break;
+ }
+ case 154:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 114:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 89:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 90:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 55:
+ case 23:
+ {
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL00_11
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL00_60
+ PIXEL01_90
+ }
+ PIXEL10_20
+ PIXEL11_21
+ break;
+ }
+ case 182:
+ case 150:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ PIXEL11_12
+ }
+ else
+ {
+ PIXEL01_90
+ PIXEL11_61
+ }
+ PIXEL10_20
+ break;
+ }
+ case 213:
+ case 212:
+ {
+ PIXEL00_20
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL01_11
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL01_60
+ PIXEL11_90
+ }
+ PIXEL10_21
+ break;
+ }
+ case 241:
+ case 240:
+ {
+ PIXEL00_20
+ PIXEL01_22
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL10_12
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL10_61
+ PIXEL11_90
+ }
+ break;
+ }
+ case 236:
+ case 232:
+ {
+ PIXEL00_21
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ PIXEL11_11
+ }
+ else
+ {
+ PIXEL10_90
+ PIXEL11_60
+ }
+ break;
+ }
+ case 109:
+ case 105:
+ {
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL00_12
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL00_61
+ PIXEL10_90
+ }
+ PIXEL01_20
+ PIXEL11_22
+ break;
+ }
+ case 171:
+ case 43:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ PIXEL10_11
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL10_60
+ }
+ PIXEL01_21
+ PIXEL11_20
+ break;
+ }
+ case 143:
+ case 15:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ PIXEL01_12
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL01_61
+ }
+ PIXEL10_22
+ PIXEL11_20
+ break;
+ }
+ case 124:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_10
+ break;
+ }
+ case 203:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ PIXEL10_10
+ PIXEL11_11
+ break;
+ }
+ case 62:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 211:
+ {
+ PIXEL00_11
+ PIXEL01_10
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 118:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_12
+ PIXEL11_10
+ break;
+ }
+ case 217:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ PIXEL10_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 110:
+ {
+ PIXEL00_10
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 155:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_10
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 188:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 185:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 61:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 157:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 103:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_12
+ PIXEL11_22
+ break;
+ }
+ case 227:
+ {
+ PIXEL00_11
+ PIXEL01_21
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 230:
+ {
+ PIXEL00_22
+ PIXEL01_12
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 199:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_21
+ PIXEL11_11
+ break;
+ }
+ case 220:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 158:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 234:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ PIXEL01_21
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_11
+ break;
+ }
+ case 242:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 59:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 121:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 87:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 79:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ PIXEL11_22
+ break;
+ }
+ case 122:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 94:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 218:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 91:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 229:
+ {
+ PIXEL00_20
+ PIXEL01_20
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 167:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_20
+ PIXEL11_20
+ break;
+ }
+ case 173:
+ {
+ PIXEL00_12
+ PIXEL01_20
+ PIXEL10_11
+ PIXEL11_20
+ break;
+ }
+ case 181:
+ {
+ PIXEL00_20
+ PIXEL01_11
+ PIXEL10_20
+ PIXEL11_12
+ break;
+ }
+ case 186:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 115:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 93:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 206:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ PIXEL11_11
+ break;
+ }
+ case 205:
+ case 201:
+ {
+ PIXEL00_12
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_10
+ }
+ else
+ {
+ PIXEL10_70
+ }
+ PIXEL11_11
+ break;
+ }
+ case 174:
+ case 46:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_10
+ }
+ else
+ {
+ PIXEL00_70
+ }
+ PIXEL01_12
+ PIXEL10_11
+ PIXEL11_20
+ break;
+ }
+ case 179:
+ case 147:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_10
+ }
+ else
+ {
+ PIXEL01_70
+ }
+ PIXEL10_20
+ PIXEL11_12
+ break;
+ }
+ case 117:
+ case 116:
+ {
+ PIXEL00_20
+ PIXEL01_11
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_10
+ }
+ else
+ {
+ PIXEL11_70
+ }
+ break;
+ }
+ case 189:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 231:
+ {
+ PIXEL00_11
+ PIXEL01_12
+ PIXEL10_12
+ PIXEL11_11
+ break;
+ }
+ case 126:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_10
+ break;
+ }
+ case 219:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_10
+ PIXEL10_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 125:
+ {
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL00_12
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL00_61
+ PIXEL10_90
+ }
+ PIXEL01_11
+ PIXEL11_10
+ break;
+ }
+ case 221:
+ {
+ PIXEL00_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL01_11
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL01_60
+ PIXEL11_90
+ }
+ PIXEL10_10
+ break;
+ }
+ case 207:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ PIXEL01_12
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL01_61
+ }
+ PIXEL10_10
+ PIXEL11_11
+ break;
+ }
+ case 238:
+ {
+ PIXEL00_10
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ PIXEL11_11
+ }
+ else
+ {
+ PIXEL10_90
+ PIXEL11_60
+ }
+ break;
+ }
+ case 190:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ PIXEL11_12
+ }
+ else
+ {
+ PIXEL01_90
+ PIXEL11_61
+ }
+ PIXEL10_11
+ break;
+ }
+ case 187:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ PIXEL10_11
+ }
+ else
+ {
+ PIXEL00_90
+ PIXEL10_60
+ }
+ PIXEL01_10
+ PIXEL11_12
+ break;
+ }
+ case 243:
+ {
+ PIXEL00_11
+ PIXEL01_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL10_12
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL10_61
+ PIXEL11_90
+ }
+ break;
+ }
+ case 119:
+ {
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL00_11
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL00_60
+ PIXEL01_90
+ }
+ PIXEL10_12
+ PIXEL11_10
+ break;
+ }
+ case 237:
+ case 233:
+ {
+ PIXEL00_12
+ PIXEL01_20
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ PIXEL11_11
+ break;
+ }
+ case 175:
+ case 47:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ PIXEL01_12
+ PIXEL10_11
+ PIXEL11_20
+ break;
+ }
+ case 183:
+ case 151:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_20
+ PIXEL11_12
+ break;
+ }
+ case 245:
+ case 244:
+ {
+ PIXEL00_20
+ PIXEL01_11
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 250:
+ {
+ PIXEL00_10
+ PIXEL01_10
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 123:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_10
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_10
+ break;
+ }
+ case 95:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_10
+ PIXEL11_10
+ break;
+ }
+ case 222:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 252:
+ {
+ PIXEL00_21
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 249:
+ {
+ PIXEL00_12
+ PIXEL01_22
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 235:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_21
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ PIXEL11_11
+ break;
+ }
+ case 111:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_22
+ break;
+ }
+ case 63:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_11
+ PIXEL11_21
+ break;
+ }
+ case 159:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_22
+ PIXEL11_12
+ break;
+ }
+ case 215:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_21
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 246:
+ {
+ PIXEL00_22
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 254:
+ {
+ PIXEL00_10
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 253:
+ {
+ PIXEL00_12
+ PIXEL01_11
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 251:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ PIXEL01_10
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 239:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ PIXEL01_12
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ PIXEL11_11
+ break;
+ }
+ case 127:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_20
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_20
+ }
+ PIXEL11_10
+ break;
+ }
+ case 191:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_11
+ PIXEL11_12
+ break;
+ }
+ case 223:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_20
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_10
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_20
+ }
+ break;
+ }
+ case 247:
+ {
+ PIXEL00_11
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ PIXEL10_12
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ case 255:
+ {
+ if (Diff(w[4], w[2]))
+ {
+ PIXEL00_0
+ }
+ else
+ {
+ PIXEL00_100
+ }
+ if (Diff(w[2], w[6]))
+ {
+ PIXEL01_0
+ }
+ else
+ {
+ PIXEL01_100
+ }
+ if (Diff(w[8], w[4]))
+ {
+ PIXEL10_0
+ }
+ else
+ {
+ PIXEL10_100
+ }
+ if (Diff(w[6], w[8]))
+ {
+ PIXEL11_0
+ }
+ else
+ {
+ PIXEL11_100
+ }
+ break;
+ }
+ }
+ pIn+=2;
+ pOut+=8;
+ }
+ pOut+=BpL;
+ }
+}
+
+void HQ2X_Init(void)
+{
+ int i, j, k, r, g, b, Y, u, v;
+
+ for (i=0; i<65536; i++)
+ LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
+
+ for (i=0; i<32; i++)
+ for (j=0; j<64; j++)
+ for (k=0; k<32; k++)
+ {
+ r = i << 3;
+ g = j << 2;
+ b = k << 3;
+ Y = (r + g + b) >> 2;
+ u = 128 + ((r - b) >> 2);
+ v = 128 + ((-r + 2*g -b)>>3);
+ RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
+ }
+}
if (specialpressed ())
code = AKS_STATEREWIND;
break;
- case DIK_ESCAPE:
- bleh();
- break;
}
}
#define IDC_AVIOUTPUT_FRAME 1624
#define IDC_OPENGLSL 1624
#define IDC_FILTERSL 1624
+#define IDC_FILTERXL 1624
#define IDC_OPENGLSLR 1625
#define IDC_FILTERSLR 1625
#define IDC_OPENGLSLV 1626
#define IDC_INPUTDEADZONE 1630
#define IDC_OPENGLSL2 1630
#define IDC_FILTERSL2 1630
+#define IDC_FILTERXTRA 1630
#define IDC_INPUTCOPY 1631
#define IDC_OPENGLSL2V 1631
#define IDC_FILTERPRESETS 1631
#define IDC_DF1TEXTQ 1688
#define IDC_FILTERSL2V 1691
#define IDC_FILTERSLV 1692
+#define IDC_FILTERXLV 1692
#define IDC_FILTERVOV 1693
#define IDC_FILTERHOV 1694
#define IDC_CONFIGLINK 1694
#define IDC_DBG_MEMDOWNFAST 1758
#define IDC_DBG_MEMTOPC 1759
#define IDC_DBG_MEMUPFAST 1760
-#define IDC_DISPLAYADJUSTRESET 1761
+#define IDC_DA_RESET 1761
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 253
#define _APS_NEXT_COMMAND_VALUE 40026
-#define _APS_NEXT_CONTROL_VALUE 1762
+#define _APS_NEXT_CONTROL_VALUE 1761
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
#define IDC_AVIOUTPUT_AUDIO 1614
#define IDC_INPUTCOPYFROM 1614
#define IDC_AVIOUTPUT_VIDEO_CODEC 1615
-#define IDC_OPENGLENABLE 1615
#define IDC_INPUTDEVICEDISABLE 1615
#define IDC_AVIOUTPUT_ACTIVATED 1615
#define IDC_FILTERENABLE 1615
#define IDC_AVIOUTPUT_AUDIO_CODEC 1616
-#define IDC_OPENGLHZ 1616
#define IDC_INPUTAMIGACNT 1616
#define IDC_FILTERHZ 1616
#define IDC_SAMPLERIPPER_ACTIVATED 1616
#define IDC_AVIOUTPUT_BORDER_TRIM 1617
-#define IDC_OPENGLVZ 1617
#define IDC_FILTERVZ 1617
#define IDC_INPREC_RECORD 1617
#define IDC_AVIOUTPUT_AUDIO_STATIC 1618
-#define IDC_OPENGLHO 1618
#define IDC_FILTERHO 1618
#define IDC_AVIOUTPUT_VIDEO_STATIC 1619
-#define IDC_OPENGLVO 1619
#define IDC_FILTERVO 1619
#define IDC_AVIOUTPUT_8BIT 1620
-#define IDC_OPENGLHZV 1620
#define IDC_INPREC_PLAY 1620
#define IDC_AVIOUTPUT_24BIT 1621
-#define IDC_OPENGLVZV 1621
#define IDC_AVIOUTPUT_WIDTH 1622
-#define IDC_OPENGLHOV 1622
#define IDC_AVIOUTPUT_HEIGHT 1623
-#define IDC_OPENGLVOV 1623
#define IDC_AVIOUTPUT_FRAME 1624
-#define IDC_OPENGLSL 1624
-#define IDC_FILTERSL 1624
-#define IDC_OPENGLSLR 1625
+#define IDC_FILTERXL 1624
#define IDC_FILTERSLR 1625
-#define IDC_OPENGLSLV 1626
#define IDC_FILTERHZMULT 1626
-#define IDC_OPENGLBITS 1627
-#define IDC_OPENGLMODE 1627
#define IDC_FILTERMODE 1627
-#define IDC_OPENGLFILTER 1628
#define IDC_FILTERFILTER 1628
-#define IDC_OPENGLDEFAULT 1629
#define IDC_FILTERDEFAULT 1629
+#define IDC_FILTERXTRA 1630
#define IDC_INPUTDEADZONE 1630
-#define IDC_OPENGLSL2 1630
-#define IDC_FILTERSL2 1630
#define IDC_INPUTCOPY 1631
-#define IDC_OPENGLSL2V 1631
#define IDC_FILTERPRESETS 1631
#define IDC_SCREENSHOT 1632
#define IDC_INPUTSWAP 1632
#define IDC_FILTERPRESETDELETE 1634
#define IDC_HARDDRIVE 1635
#define IDC_INACTIVE_PRI 1635
-#define IDC_FILTERSLR3 1635
#define IDC_FILTERVZMULT 1635
#define IDC_SOUNDPRIMARY 1636
#define IDC_MINIMIZED_PRI 1636
#define IDC_DF1WPQ 1686
#define IDC_EJECT1Q 1687
#define IDC_DF1TEXTQ 1688
-#define IDC_FILTERSL2V 1691
-#define IDC_FILTERSLV 1692
+#define IDC_FILTERXLV 1692
#define IDC_FILTERVOV 1693
#define IDC_FILTERHOV 1694
#define IDC_CONFIGLINK 1694
RTEXT "Vert. position:",-1,5,103,55,10,SS_CENTERIMAGE
CONTROL "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,99,151,19
EDITTEXT IDC_FILTERVOV,253,101,34,12,ES_CENTER | ES_READONLY
- RTEXT "Scanlines:",-1,27,133,57,10,SS_CENTERIMAGE
- CONTROL "Slider1",IDC_FILTERSL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,94,126,157,19
- EDITTEXT IDC_FILTERSLV,253,128,34,12,ES_CENTER | ES_READONLY
- COMBOBOX IDC_FILTERSLR,56,146,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
- CONTROL "Slider1",IDC_FILTERSL2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,94,146,157,19
- EDITTEXT IDC_FILTERSL2V,253,151,34,12,ES_CENTER | ES_READONLY
+ RTEXT "Extra settings:",-1,27,133,57,10,SS_CENTERIMAGE
+ CONTROL "Slider1",IDC_FILTERXL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,157,151,19
+ EDITTEXT IDC_FILTERXLV,253,159,34,12,ES_CENTER | ES_READONLY
+ COMBOBOX IDC_FILTERSLR,253,130,33,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Presets",-1,0,187,296,36
COMBOBOX IDC_FILTERPRESETS,8,201,119,150,CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Load",IDC_FILTERPRESETLOAD,132,200,47,14
COMBOBOX IDC_FILTERHZMULT,67,43,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_FILTERVZMULT,67,63,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
CONTROL "Autoscale",IDC_FILTERAUTORES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,26,168,63,10
+ COMBOBOX IDC_FILTERXTRA,105,130,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
END
IDD_HARDDRIVE DIALOGEX 0, 0, 380, 66
IDS_PRI_BELOWNORMAL "Below Normal"
IDS_PRI_LOW "Low"
IDS_OLDRTGLIBRARY "The installed LIBS:Picasso96/rtg.library (%d.%d) file needs to be updated.\nA newer version is included in the ""Amiga Programs"" directory of the WinUAE distribution archive.\nThe new library fixes graphics problems and increases performance."
- IDS_DEFAULT_AF2005 "Amiga Forever"
+ IDS_DEFAULT_AF2005 "WinUAE default (new) / Amiga Forever"
IDS_DEFAULT_AF "Amiga Forever (old)"
- IDS_DEFAULT_WINUAE "WinUAE default"
+ IDS_DEFAULT_WINUAE "WinUAE default (old)"
END
STRINGTABLE
#include "sysconfig.h"
#include "sysdeps.h"
+#include "options.h"
#include "filter.h"
+#include "custom.h"
-uae_u32 gamma_red[256 * 3];
-uae_u32 gamma_grn[256 * 3];
-uae_u32 gamma_blu[256 * 3];
+#include <math.h>
-uae_u32 gamma_red_fac[256 * 3];
-uae_u32 gamma_grn_fac[256 * 3];
-uae_u32 gamma_blu_fac[256 * 3];
+static uae_s32 line_yuv_0[4096 * 3];
+static uae_s32 line_yuv_1[4096 * 3];
+static uae_u32 randomtable[4096];
+static uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256];
+static uae_u32 *predc, *pgrec, *pbluc;
+static int randomoffset, randomshift;
+static int xx1, xx2, xx3, pal_noise_mask, scanlinelevel;
-uae_u32 color_red[256];
-uae_u32 color_grn[256];
-uae_u32 color_blu[256];
+uae_s32 tyhrgb[262144];
+uae_s32 tylrgb[262144];
+uae_s32 tcbrgb[262144];
+uae_s32 tcrrgb[262144];
-static float video_gamma(float value, float gamma, float bri, float con)
+void PAL_init(void)
{
- double factor;
- float ret;
+ int i;
+ for (i = 0; i < 4096; i++)
+ randomtable[i] = rand() | (rand() << 15);
+ for (i = 0; i < 256; i++) {
+ redc[0 * 256 + i] = xredcolors[0];
+ grec[0 * 256 + i] = xgreencolors[0];
+ bluc[0 * 256 + i] = xbluecolors[0];
+ redc[1 * 256 + i] = xredcolors[i];
+ grec[1 * 256 + i] = xgreencolors[i];
+ bluc[1 * 256 + i] = xbluecolors[i];
+ redc[2 * 256 + i] = xredcolors[255];
+ grec[2 * 256 + i] = xgreencolors[255];
+ bluc[2 * 256 + i] = xbluecolors[255];
+ }
+ predc = &redc[1 * 256];
+ pgrec = &grec[1 * 256];
+ pbluc = &bluc[1 * 256];
- value += bri;
- value *= con;
+ if (currprefs.gfx_lores) {
+ xx1 = 1;
+ xx2 = 2;
+ xx3 = 3;
+ } else {
+ xx1 = 2;
+ xx2 = 5;
+ xx3 = 7;
+ }
+ pal_noise_mask = (1 << (currprefs.gfx_filter_noise * 7 / 100)) - 1;
+ scanlinelevel = 128 - currprefs.gfx_filter_scanlines * 128 / 100;
+}
- if (value <= 0.0f)
- return 0.0f;
+#define mm 256 * 256
+#define sat 256
+STATIC_INLINE int zyh(uae_u32 v)
+{
+ return ((v >> 24) & 0xff) * mm;
+}
+STATIC_INLINE int zyl(uae_u32 v)
+{
+ return ((v >> 16) & 0xff) * mm;
+}
+STATIC_INLINE int zcb(uae_u32 v)
+{
+ return ((int)((uae_s8)(v >> 8))) * sat;
+}
+STATIC_INLINE int zcr(uae_u32 v)
+{
+ return ((int)((uae_s8)(v >> 0))) * sat;
+}
- factor = pow(255.0f, 1.0f - gamma);
- ret = (float)(factor * pow(value, gamma));
+STATIC_INLINE uae_u32 STRIPRGB(uae_u32 v)
+{
+ return ((v & 0x0000fc) >> 2) | ((v & 0x00fc00) >> 4) | ((v & 0xfc0000) >> 6);
+}
+STATIC_INLINE int zyhRGB(uae_u32 v)
+{
+ return tyhrgb[STRIPRGB(v)];
+}
+STATIC_INLINE int zylRGB(uae_u32 v)
+{
+ return tylrgb[STRIPRGB(v)];
+}
+STATIC_INLINE int zcbRGB(uae_u32 v)
+{
+ return tcbrgb[STRIPRGB(v)];
+}
+STATIC_INLINE int zcrRGB(uae_u32 v)
+{
+ return tcrrgb[STRIPRGB(v)];
+}
+
+void PAL_1x1_32(uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, int height)
+{
+ const uae_u32 *tmpsrc;
+ uae_u32 *tmptrg;
+ uae_s32 *lineptr0;
+ uae_s32 *lineptr1;
+ uae_s32 *line;
+ uae_s32 *linepre;
+ unsigned int x, y, wstart, wfast, wend, wint;
+ int l, u, v;
+ int red, grn, blu;
+ int xt = 0;
+ int yt = 0;
+ int xs = 0;
+ int ys = 0;
+
+ pitchs /= sizeof (*trg);
+ pitcht /= sizeof (*trg);
+
+ src = src + pitchs * ys + xs - 2;
+ trg = trg + pitcht * yt + xt;
+ if (width < 8) {
+ wstart = width;
+ wfast = 0;
+ wend = 0;
+ } else {
+ /* alignment: 8 pixels*/
+ wstart = (unsigned int)(8 - ((unsigned long)trg & 7));
+ wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
+ wend = (width - wstart) & 0x07; /* do not forget the rest*/
+ }
+ wint = width + 5;
+ lineptr0 = line_yuv_0;
+ lineptr1 = line_yuv_1;
- if (ret < 0.0f)
- ret = 0.0f;
+ tmpsrc = src - pitchs;
+ line = lineptr0;
+ for (x = 0; x < wint; x++) {
+ uae_u32 cl0, cl1, cl2, cl3;
- return ret;
+ cl0 = tmpsrc[0];
+ cl1 = tmpsrc[xx1];
+ cl2 = tmpsrc[xx2];
+ cl3 = tmpsrc[xx3];
+ line[0] = 0;
+ line[1] = zcb(cl0) + zcb(cl1) + zcb(cl2) + zcb(cl3);
+ line[2] = zcr(cl0) + zcr(cl1) + zcr(cl2) + zcr(cl3);
+ tmpsrc++;
+ line += 3;
+ }
+
+ for (y = 0; y < height; y++) {
+ int scn = (y & 1) ? scanlinelevel : 128;
+ randomshift = rand() & 15;
+ randomoffset = rand() & 2047;
+
+ tmpsrc = src;
+ tmptrg = trg;
+
+ line = lineptr0;
+ lineptr0 = lineptr1;
+ lineptr1 = line;
+
+ tmpsrc = src;
+ line = lineptr0;
+ for (x = 0; x < wint; x++) {
+ int r = (randomtable[randomoffset++] >> randomshift) & pal_noise_mask;
+ uae_u32 cl0, cl1, cl2, cl3;
+ cl0 = tmpsrc[0];
+ cl1 = tmpsrc[xx1];
+ cl2 = tmpsrc[xx2];
+ cl3 = tmpsrc[xx3];
+ line[0] = (zyl(cl1) + zyh(cl2) * (scn - r) / 128 + zyl(cl3)) / 256; /* 1/4 + 1/2 + 1/4 */
+ line[1] = zcb(cl0) + zcb(cl1) + zcb(cl2) + zcb(cl3);
+ line[2] = zcr(cl0) + zcr(cl1) + zcr(cl2) + zcr(cl3);
+ tmpsrc++;
+ line += 3;
+ }
+
+ line = lineptr0;
+ linepre = lineptr1;
+ for (x = 0; x < (wfast << 3) + wend + wstart; x++) {
+
+ l = line[0];
+ u = (line[1] + linepre[1]) / 8;
+ v = (line[2] + linepre[2]) / 8;
+ line += 3;
+ linepre += 3;
+
+ red = (v + l) / 256;
+ blu = (u + l) / 256;
+ grn = (l * 256 - 50 * u - 130 * v) / (256 * 256);
+ *tmptrg++ = predc[red] | pgrec[grn] | pbluc[blu];
+ }
+
+ src += pitchs;
+ trg += pitcht;
+ }
}
-static int color_brightness = 1000;
-static int color_contrast = 1000;
-static int color_gamma = 1000;
-static int pal_scanlineshade = 667;
-static void video_calc_gammatable(void)
+void PAL_1x1_AGA_32(uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, int height)
{
- int i;
- float bri, con, gam, scn, v;
- uae_u32 vi;
-
- bri = ((float)(color_brightness - 1000))
- * (128.0f / 1000.0f);
- con = ((float)(color_contrast )) / 1000.0f;
- gam = ((float)(color_gamma )) / 1000.0f;
- scn = ((float)(pal_scanlineshade)) / 1000.0f;
-
- for (i = 0; i < (256 * 3); i++) {
- v = video_gamma((float)(i - 256), gam, bri, con);
-
- vi = (uae_u32)v;
- if (vi > 255)
- vi = 255;
- gamma_red[i] = color_red[vi];
- gamma_grn[i] = color_grn[vi];
- gamma_blu[i] = color_blu[vi];
-
- vi = (uae_u32)(v * scn);
- if (vi > 255)
- vi = 255;
- gamma_red_fac[i] = color_red[vi];
- gamma_grn_fac[i] = color_grn[vi];
- gamma_blu_fac[i] = color_blu[vi];
+ const uae_u32 *tmpsrc;
+ uae_u32 *tmptrg;
+ uae_s32 *lineptr0;
+ uae_s32 *lineptr1;
+ uae_s32 *line;
+ uae_s32 *linepre;
+ unsigned int x, y, wstart, wfast, wend, wint;
+ int l, u, v;
+ int red, grn, blu;
+ int xt = 0;
+ int yt = 0;
+ int xs = 0;
+ int ys = 0;
+
+ pitchs /= sizeof (*trg);
+ pitcht /= sizeof (*trg);
+
+ src = src + pitchs * ys + xs - 2;
+ trg = trg + pitcht * yt + xt;
+ if (width < 8) {
+ wstart = width;
+ wfast = 0;
+ wend = 0;
+ } else {
+ /* alignment: 8 pixels*/
+ wstart = (unsigned int)(8 - ((unsigned long)trg & 7));
+ wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
+ wend = (width - wstart) & 0x07; /* do not forget the rest*/
}
-}
\ No newline at end of file
+ wint = width + 5;
+ lineptr0 = line_yuv_0;
+ lineptr1 = line_yuv_1;
+
+ tmpsrc = src - pitchs;
+ line = lineptr0;
+ for (x = 0; x < wint; x++) {
+ uae_u32 cl0, cl1, cl2, cl3;
+
+ cl0 = tmpsrc[0];
+ cl1 = tmpsrc[xx1];
+ cl2 = tmpsrc[xx2];
+ cl3 = tmpsrc[xx3];
+ line[0] = 0;
+ line[1] = zcbRGB(cl0) + zcbRGB(cl1) + zcbRGB(cl2) + zcbRGB(cl3);
+ line[2] = zcrRGB(cl0) + zcrRGB(cl1) + zcrRGB(cl2) + zcrRGB(cl3);
+ tmpsrc++;
+ line += 3;
+ }
+
+ for (y = 0; y < height; y++) {
+ int scn = (y & 1) ? scanlinelevel : 128;
+ randomshift = rand() & 15;
+ randomoffset = rand() & 2047;
+
+ tmpsrc = src;
+ tmptrg = trg;
+
+ line = lineptr0;
+ lineptr0 = lineptr1;
+ lineptr1 = line;
+
+ tmpsrc = src;
+ line = lineptr0;
+ for (x = 0; x < wint; x++) {
+ int r = (randomtable[randomoffset++] >> randomshift) & pal_noise_mask;
+ uae_u32 cl0, cl1, cl2, cl3;
+ cl0 = tmpsrc[0];
+ cl1 = tmpsrc[xx1];
+ cl2 = tmpsrc[xx2];
+ cl3 = tmpsrc[xx3];
+ line[0] = (zylRGB(cl1) + zyhRGB(cl2) * (scn - r) / 128 + zylRGB(cl3)) / 256; /* 1/4 + 1/2 + 1/4 */
+ line[1] = zcbRGB(cl0) + zcbRGB(cl1) + zcbRGB(cl2) + zcbRGB(cl3);
+ line[2] = zcrRGB(cl0) + zcrRGB(cl1) + zcrRGB(cl2) + zcrRGB(cl3);
+ tmpsrc++;
+ line += 3;
+ }
+
+ line = lineptr0;
+ linepre = lineptr1;
+ for (x = 0; x < (wfast << 3) + wend + wstart; x++) {
+
+ l = line[0];
+ u = (line[1] + linepre[1]) / 8;
+ v = (line[2] + linepre[2]) / 8;
+ line += 3;
+ linepre += 3;
+
+ red = (v + l) / 256;
+ blu = (u + l) / 256;
+ grn = (l * 256 - 50 * u - 130 * v) / (256 * 256);
+ *tmptrg++ = predc[red] | pgrec[grn] | pbluc[blu];
+ }
+
+ src += pitchs;
+ trg += pitcht;
+ }
+}
#define SCSIEMU /* uaescsi.device emulation */
#define UAESERIAL /* uaeserial.device emulation */
#define FPUEMU /* FPU emulation */
+#define MMUEMU
#define CPUEMU_0 /* generic 680x0 emulation */
#define CPUEMU_11 /* 68000+prefetch emulation */
#define CPUEMU_12 /* cycle-exact cpu&blitter */
char start_path_data[MAX_DPATH];
char start_path_exe[MAX_DPATH];
char start_path_af[MAX_DPATH];
+char start_path_new[MAX_DPATH];
char help_file[MAX_DPATH];
int af_path_2005, af_path_old, winuae_path;
}
if (WINUAEBETA > 0)
strcat (txt, BetaStr);
+#ifdef WINUAEEXTRA
+ if (strlen(WINUAEEXTRA) > 0) {
+ strcat (txt, " ");
+ strcat (txt, WINUAEEXTRA);
+ }
+#endif
if (txt2[0]) {
strcat (txt, " - ");
strcat (txt, txt2);
strcpy (tmp, ".\\");
else
strcpy (tmp, start_path_data);
+ if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES) {
+ char tmp2[MAX_DPATH];
+ strcpy (tmp2, tmp);
+ strcat (tmp2, "rom");
+ if (GetFileAttributes(tmp2) != INVALID_FILE_ATTRIBUTES) {
+ strcpy (tmp, tmp2);
+ } else {
+ strcpy (tmp2, tmp);
+ strcpy (tmp2, "roms");
+ if (GetFileAttributes(tmp2) != INVALID_FILE_ATTRIBUTES)
+ strcpy (tmp, tmp2);
+ }
+ }
}
if (af_path_2005) {
- strcpy (tmp, start_path_af);
- strcat (tmp, "System\\rom");
+ char tmp2[MAX_DPATH];
+ strcpy (tmp2, start_path_af);
+ strcat (tmp2, "System\\rom");
+ if (GetFileAttributes(tmp2) != INVALID_FILE_ATTRIBUTES) {
+ strcpy (tmp, tmp2);
+ } else {
+ strcpy (tmp, start_path_new);
+ strcat (tmp, "WinUAE\\roms");
+ }
} else if (af_path_old) {
- strcpy (tmp, start_path_exe);
- strcat (tmp, "..\\shared\\rom");
+ char tmp2[MAX_DPATH];
+ strcpy (tmp2, start_path_exe);
+ strcat (tmp2, "..\\shared\\rom");
+ if (GetFileAttributes(tmp2) != INVALID_FILE_ATTRIBUTES)
+ strcpy (tmp, tmp2);
}
}
fixtrailing (tmp);
strcat (tmp2, "Amiga Files\\");
strcpy (tmp, tmp2);
strcat(tmp, "WinUAE");
+ strcpy(start_path_new, tmp2);
v = GetFileAttributes(tmp);
if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
if (start_data == 0) {
}
start_data = 1;
}
- af_path_2005 = 1;
+ af_path_2005 = 2;
}
}
}
sprintf(s, "WinUAE %d.%d.%d (%d.%02d.%02d)",
UAEMAJOR, UAEMINOR, UAESUBREV, GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE));
#endif
+#ifdef WINUAEEXTRA
+ if(strlen(WINUAEEXTRA) > 0) {
+ strcat (s, " ");
+ strcat (s, WINUAEEXTRA);
+ }
+#endif
}
static int multi_display = 1;
continue;
}
if (i + 1 < argc) {
- char *np = argv[++i];
+ char *np = argv[i + 1];
if (!strcmp (arg, "-affinity")) {
cpu_affinity = getval (np);
+ i++;
if (cpu_affinity == 0)
cpu_affinity = original_affinity;
SetThreadAffinityMask(GetCurrentThread(), cpu_affinity);
continue;
}
if (!strcmp (arg, "-datapath")) {
+ i++;
strcpy(start_path_data, np);
start_data = 1;
continue;
}
if (!strcmp (arg, "-maxmem")) {
+ i++;
max_allowed_mman = getval (np);
continue;
}
if (!strcmp (arg, "-soundmodeskip")) {
+ i++;
sound_mode_skip = getval (np);
continue;
}
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 7
+#define WINUAEBETA 8
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 4, 12)
+#define WINUAEDATE MAKEBD(2007, 4, 20)
+//#define WINUAEEXTRA ""
#define IHF_WINDOWHIDDEN 6
#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
extern HINSTANCE hInst;
extern int win_x_diff, win_y_diff;
extern int af_path_2005, af_path_old, winuae_path;
-extern char start_path_af[MAX_DPATH];
+extern char start_path_af[MAX_DPATH], start_path_new[MAX_DPATH];
extern void sleep_millis (int ms);
extern void sleep_millis_busy (int ms);
#ifdef GFXFILTER
#include "options.h"
+#include "custom.h"
#include "xwin.h"
#include "dxwrap.h"
#include "win32.h"
struct uae_filter uaefilters[] =
{
- { UAE_FILTER_NULL, "Null filter", "null",
+ { UAE_FILTER_NULL, 0, "Null filter", "null",
{ 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 } },
- { UAE_FILTER_DIRECT3D, "Direct3D", "direct3d", 1, 0, 0, 0, 0 },
+ { UAE_FILTER_DIRECT3D, 0, "Direct3D", "direct3d", 1, 0, 0, 0, 0 },
- { UAE_FILTER_OPENGL, "OpenGL", "opengl", 1, 0, 0, 0, 0 },
+ { UAE_FILTER_OPENGL, 0, "OpenGL", "opengl", 1, 0, 0, 0, 0 },
- { UAE_FILTER_SCALE2X, "Scale2X", "scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0 },
+ { UAE_FILTER_SCALE2X, 0, "Scale2X", "scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0 },
-// { UAE_FILTER_HQ, "hq", "hq", 0, 0, UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_32 },
+// { UAE_FILTER_HQ, 0, "hq", "hq", 0, 0, UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_32 },
- { UAE_FILTER_SUPEREAGLE, "SuperEagle", "supereagle", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
+ { UAE_FILTER_SUPEREAGLE, 0, "SuperEagle", "supereagle", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
- { UAE_FILTER_SUPER2XSAI, "Super2xSaI", "super2xsai", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
+ { UAE_FILTER_SUPER2XSAI, 0, "Super2xSaI", "super2xsai", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
- { UAE_FILTER_2XSAI, "2xSaI", "2xsai", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
+ { UAE_FILTER_2XSAI, 0, "2xSaI", "2xsai", 0, 0, UAE_FILTER_MODE_16_16, 0, 0 },
+
+ { UAE_FILTER_PAL, 1, "PAL", "pal", 0, UAE_FILTER_MODE_32_32, 0, 0, 0 },
{ 0 }
{
Init_2xSaI (rb, gb, bb, rs, gs, bs);
hq_init (rb, gb, bb, rs, gs, bs);
+ PAL_init ();
bufmem_ptr = 0;
}
LPDIRECTDRAWSURFACE7 dds;
DDSURFACEDESC2 desc;
- sptr = gfxvidinfo.bufmem;
+ sptr = gfxvidinfo.bufmem
+ - ((dst_width - amiga_width) / 2) * (amiga_depth / 8)
+ - ((dst_height - amiga_height) / 2) * gfxvidinfo.rowbytes;
endsptr = gfxvidinfo.realbufmem + (amiga_height - 1) * 3 * gfxvidinfo.rowbytes;
v = currprefs.gfx_filter ? currprefs.gfx_filter_horiz_offset : 0;
ok = 1;
}
+ } else if (usedfilter->type == UAE_FILTER_PAL) { /* 32/1X */
+
+ if (amiga_depth == 32 && dst_depth == 32) {
+ if (currprefs.chipset_mask & CSMASK_AGA)
+ PAL_1x1_AGA_32((uae_u32*)sptr, gfxvidinfo.rowbytes, (uae_u32*)dptr, pitch, aw, ah);
+ else
+ PAL_1x1_32((uae_u32*)sptr, gfxvidinfo.rowbytes, (uae_u32*)dptr, pitch, aw, ah);
+ ok = 1;
+ }
+
} else { /* null */
if (amiga_depth == dst_depth) {
{ -1, FALSE, NULL, NULL }
};
-static void SetupRichText( HWND hDlg, urlinfo *url )
+static void SetupRichText(HWND hDlg, urlinfo *url)
{
CHARFORMAT CharFormat;
CharFormat.cbSize = sizeof (CharFormat);
- SetDlgItemText( hDlg, url->id, url->display );
- SendDlgItemMessage( hDlg, url->id, EM_GETCHARFORMAT, 0, (LPARAM)&CharFormat );
+ SetDlgItemText(hDlg, url->id, url->display);
+ SendDlgItemMessage(hDlg, url->id, EM_GETCHARFORMAT, 0, (LPARAM)&CharFormat);
CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR;
CharFormat.dwEffects = url->state ? CFE_UNDERLINE : 0;
CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
- CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION );
- strcpy( CharFormat.szFaceName, "Tahoma" );
- SendDlgItemMessage( hDlg, url->id, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CharFormat );
- SendDlgItemMessage( hDlg, url->id, EM_SETBKGNDCOLOR, 0, GetSysColor( COLOR_3DFACE ) );
+ CharFormat.crTextColor = GetSysColor(COLOR_ACTIVECAPTION);
+ strcpy(CharFormat.szFaceName, "Tahoma" );
+ SendDlgItemMessage(hDlg, url->id, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CharFormat);
+ SendDlgItemMessage(hDlg, url->id, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_3DFACE));
}
-static void url_handler(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
+static void url_handler(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int last_rectangle = -1;
int i;
for (i = 0; urls[i].id >= 0; i++)
{
RECT rect;
- GetWindowRect( GetDlgItem( hDlg, urls[i].id), &rect );
- ScreenToClient( hDlg, (POINT *) &rect );
- ScreenToClient( hDlg, (POINT *) &(rect.right) );
- if( PtInRect( &rect, point ) )
+ GetWindowRect(GetDlgItem(hDlg, urls[i].id), &rect);
+ ScreenToClient(hDlg, (POINT*)&rect);
+ ScreenToClient(hDlg, (POINT*)&rect.right);
+ if(PtInRect(&rect, point))
{
- if( msg == WM_LBUTTONDOWN )
+ if(msg == WM_LBUTTONDOWN)
{
ShellExecute (NULL, NULL, urls[i].url , NULL, NULL, SW_SHOWNORMAL);
- SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
+ SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
else
{
- if( ( i != last_rectangle ) )
+ if(i != last_rectangle)
{
// try and load the system hand (Win2000+)
m_hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND) );
// retry with our fallback hand
m_hCursor = LoadCursor(hInst, MAKEINTRESOURCE(IDC_MYHAND) );
}
- SetCursor( m_hCursor );
+ SetCursor(m_hCursor);
urls[i].state = TRUE;
- SetupRichText( hDlg, &urls[i] );
+ SetupRichText(hDlg, &urls[i]);
- if( last_rectangle != -1 )
+ if(last_rectangle != -1)
{
urls[last_rectangle].state = FALSE;
- SetupRichText( hDlg, &urls[last_rectangle] );
+ SetupRichText(hDlg, &urls[last_rectangle]);
}
}
}
}
}
- if( !found && last_rectangle >= 0 )
+ if(!found && last_rectangle >= 0)
{
- SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
+ SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
urls[last_rectangle].state = FALSE;
- SetupRichText( hDlg, &urls[last_rectangle] );
+ SetupRichText(hDlg, &urls[last_rectangle]);
last_rectangle = -1;
}
}
} else {
strcpy (pathmode, "AF2005");
path_type = 2005;
- strcpy (start_path_data, start_path_af);
+ strcpy (start_path_data, start_path_new);
}
if (hWinUAEKey)
RegSetValueEx (hWinUAEKey, "PathMode", 0, REG_SZ, (CONST BYTE *)pathmode, strlen(pathmode) + 1);
{
int *p;
SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Luminance");
+ SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Brightness");
SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Contrast");
SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Gamma");
if (da_mode_selected == CB_ERR)
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE2");
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE3");
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, 0, 0);
- ew (hDlg, IDC_HDF_CONTROLLER, is_hdf_rdb());
SendDlgItemMessage(hDlg, IDC_HF_TYPE, CB_RESETCONTENT, 0, 0);
WIN32GUI_LoadUIString (IDS_HF_FS_CUSTOM, tmp, sizeof (tmp));
SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)"OFS/FFS/RDB");
static int scanlineratios[] = { 1,1,1,2,1,3, 2,1,2,2,2,3, 3,1,3,2,3,3, 0,0 };
static int scanlineindexes[100];
-static int filterpreset = 0;
+static int filterpreset_selected = -1, filterpreset_builtin = -1;
static void enable_for_hw3ddlg (HWND hDlg)
{
int v = workprefs.gfx_filter ? TRUE : FALSE;
- int vv = FALSE, vv2 = FALSE;
+ int vv = FALSE, vv2 = FALSE, vv3 = FALSE;
struct uae_filter *uf;
int i;
}
if (v && (uf->x[0] || uf->x[1] || uf->x[2] || uf->x[3] || uf->x[4]))
vv = TRUE;
- if (v && uf->x[0])
+ if (v && (uf->x[0] || uf->yuv))
vv2 = TRUE;
+ if (v && (uf->x[0] && !uf->yuv))
+ vv3 = TRUE;
ew (hDlg, IDC_FILTERENABLE, TRUE);
ew (hDlg, IDC_FILTERMODE, v);
CheckDlgButton(hDlg, IDC_FILTERENABLE, v);
ew (hDlg, IDC_FILTERVZMULT, vv && !vv2);
ew (hDlg, IDC_FILTERHO, v);
ew (hDlg, IDC_FILTERVO, v);
- ew (hDlg, IDC_FILTERSLR, vv2);
- ew (hDlg, IDC_FILTERSL, vv2);
- ew (hDlg, IDC_FILTERSL2, vv2);
+ ew (hDlg, IDC_FILTERSLR, vv3);
+ ew (hDlg, IDC_FILTERXL, vv2);
+ ew (hDlg, IDC_FILTERXLV, vv2);
+ ew (hDlg, IDC_FILTERXTRA, vv2);
ew (hDlg, IDC_FILTERDEFAULT, v);
ew (hDlg, IDC_FILTERFILTER, vv);
ew (hDlg, IDC_FILTERAUTORES, vv && !vv2);
- ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset > 0);
- ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset > 0);
+ ew (hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0);
+ ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0);
+ ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
}
static void makefilter(char *s, int x, int flags)
static char *filtermultnames[] = { "1x", "2x", "4x", "6x", "8x", NULL };
static int filtermults[] = { 1000, 500, 250, 167, 125 };
+struct filterxtra {
+ char *label;
+ int *varw, *varc;
+ int min, max, step;
+};
+static struct filterxtra *filter_extra, *filter_selected;
+
+static struct filterxtra filter_pal_extra[] =
+{
+ "Brightness", &workprefs.gfx_filter_luminance, &currprefs.gfx_filter_luminance, -1000, 1000, 10,
+ "Contrast", &workprefs.gfx_filter_contrast, &currprefs.gfx_filter_contrast, -1000, 1000, 10,
+ "Saturation", &workprefs.gfx_filter_saturation, &currprefs.gfx_filter_saturation, -1000, 1000, 10,
+ "Gamma", &workprefs.gfx_gamma, &currprefs.gfx_gamma, -1000, 1000, 10,
+ "Scanlines", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 1,
+ "Blurriness", &workprefs.gfx_filter_blur, &currprefs.gfx_filter_blur,0, 2000, 10,
+ "Noise", &workprefs.gfx_filter_noise, &currprefs.gfx_filter_noise,0, 100, 10,
+ NULL
+};
+static struct filterxtra filter_3d_extra[] =
+{
+ "Scanline transparency", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10,
+ "Scanline level", &workprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlinelevel, 0, 100, 10,
+ NULL
+};
+static int *filtervars[] = {
+ &workprefs.gfx_filter, &workprefs.gfx_filter_filtermode,
+ &workprefs.gfx_filter_vert_zoom, &workprefs.gfx_filter_horiz_zoom,
+ &workprefs.gfx_filter_vert_zoom_mult, &workprefs.gfx_filter_horiz_zoom_mult,
+ &workprefs.gfx_filter_vert_offset, &workprefs.gfx_filter_horiz_offset,
+ &workprefs.gfx_filter_scanlines, &workprefs.gfx_filter_scanlinelevel, &workprefs.gfx_filter_scanlineratio,
+ &workprefs.gfx_lores, &workprefs.gfx_linedbl, &workprefs.gfx_correct_aspect,
+ &workprefs.gfx_xcenter, &workprefs.gfx_ycenter,
+ &workprefs.gfx_filter_luminance, &workprefs.gfx_filter_contrast, &workprefs.gfx_filter_saturation,
+ &workprefs.gfx_filter_gamma, &workprefs.gfx_filter_blur, &workprefs.gfx_filter_noise,
+ NULL
+ };
+
+struct filterpreset {
+ char *name;
+ int conf[22];
+};
+static struct filterpreset filterpresets[] =
+{
+ { "PAL example", 8, 0, 0, 0, 1000, 1000, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 300, 30 },
+ { NULL }
+};
+
static void values_to_hw3ddlg (HWND hDlg)
{
char txt[100], tmp[100];
SendDlgItemMessage(hDlg, IDC_FILTERHO, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 1);
- SendDlgItemMessage(hDlg, IDC_FILTERSL, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000));
- SendDlgItemMessage(hDlg, IDC_FILTERSL, TBM_SETPAGESIZE, 0, 1);
- SendDlgItemMessage(hDlg, IDC_FILTERSL2, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000));
- SendDlgItemMessage(hDlg, IDC_FILTERSL2, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_RESETCONTENT, 0, 0L);
uf = &uaefilters[0];
}
SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_SETCURSEL, fltnum, 0);
+ filter_extra = NULL;
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L);
if (uf->x[0]) {
WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt));
sprintf (tmp, txt, 32);
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
modenum = 4;
+ filter_extra = filter_3d_extra;
} else {
modenum = 0;
for (i = 1; i <= 4; i++) {
modenum++;
}
}
+ if (uf->yuv) {
+ filter_extra = filter_pal_extra;
+ }
}
+ SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000));
+ SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, 1);
+ if (filter_extra) {
+ int idx2 = -1;
+ int idx = SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_GETCURSEL, 0, 0L);
+ if (idx == CB_ERR)
+ idx = -1;
+ SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_RESETCONTENT, 0, 0L);
+ for (i = 0; filter_extra[i].label; i++) {
+ if (filter_selected == &filter_extra[i] && idx < 0)
+ idx2 = i;
+ SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_ADDSTRING, 0, (LPARAM)filter_extra[i].label);
+ }
+ if (idx2 >= 0)
+ filter_selected = &filter_extra[idx2];
+ else if (idx >= 0)
+ filter_selected = &filter_extra[idx];
+ else
+ filter_selected = &filter_extra[0];
+ SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_SETCURSEL, filter_selected - &filter_extra[0], 0);
+ SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG (filter_selected->min, filter_selected->max));
+ SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, filter_selected->step);
+ if (filter_selected) {
+ SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPOS, TRUE, *(filter_selected->varw));
+ SetDlgItemInt (hDlg, IDC_FILTERXLV, *(filter_selected->varw), TRUE);
+ }
+ }
+
if (workprefs.gfx_filter_filtermode >= modenum)
workprefs.gfx_filter_filtermode = 0;
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_SETCURSEL, workprefs.gfx_filter_filtermode, 0);
j = 0;
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_RESETCONTENT, 0, 0L);
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)"");
+ for (i = 0; filterpresets[i].name; i++) {
+ char tmp[MAX_DPATH];
+ sprintf(tmp, "* %s", filterpresets[i].name);
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
+ }
if (hWinUAEKey) {
RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_READ, NULL, &fkey, NULL);
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
idx++;
}
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_SETCURSEL, filterpreset, 0);
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_SETCURSEL, filterpreset_selected, 0);
RegCloseKey (fkey);
}
}
SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, workprefs.gfx_filter_vert_zoom);
SendDlgItemMessage (hDlg, IDC_FILTERHO, TBM_SETPOS, TRUE, workprefs.gfx_filter_horiz_offset);
SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETPOS, TRUE, workprefs.gfx_filter_vert_offset);
- SendDlgItemMessage (hDlg, IDC_FILTERSL, TBM_SETPOS, TRUE, workprefs.gfx_filter_scanlines);
- SendDlgItemMessage (hDlg, IDC_FILTERSL2, TBM_SETPOS, TRUE, workprefs.gfx_filter_scanlinelevel);
SetDlgItemInt (hDlg, IDC_FILTERHZV, workprefs.gfx_filter_horiz_zoom, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE);
- SetDlgItemInt (hDlg, IDC_FILTERSLV, workprefs.gfx_filter_scanlines, TRUE);
- SetDlgItemInt (hDlg, IDC_FILTERSL2V, workprefs.gfx_filter_scanlinelevel, TRUE);
}
static void values_from_hw3ddlg (HWND hDlg)
static void filter_preset (HWND hDlg, WPARAM wParam)
{
- int ok, err, load;
+ int ok, err, load, i, builtin, userfilter;
char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
DWORD outsize;
- HKEY fkey;
- struct uae_prefs *p = &workprefs;
+ HKEY fkey = NULL;
LRESULT item;
load = 0;
ok = 0;
- if (!hWinUAEKey)
- return;
- RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
- if (!fkey)
- return;
+ for (builtin = 0; filterpresets[builtin].name; builtin++);
+ if (hWinUAEKey) {
+ RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE,
+ KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+ }
item = SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETCURSEL, 0, 0);
tmp1[0] = 0;
if (item != CB_ERR) {
- filterpreset = (int)item;
+ filterpreset_selected = (int)item;
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp1);
} else {
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)item, (LPARAM)tmp1);
+ filterpreset_selected = -1;
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof tmp1, (LPARAM)tmp1);
+ }
+ userfilter = 0;
+ filterpreset_builtin = -1;
+ if (filterpreset_selected < 0 || filterpreset_selected == 0) {
+ userfilter = -1;
+ } else if (filterpreset_selected > builtin) {
+ userfilter = filterpreset_selected - builtin;
+ } else {
+ filterpreset_builtin = filterpreset_selected - 1;
}
- outsize = sizeof (tmp2);
- if (tmp1[0] && RegQueryValueEx (fkey, tmp1, NULL, NULL, tmp2, &outsize) == ERROR_SUCCESS)
+
+ if (filterpreset_builtin < 0) {
+ outsize = sizeof (tmp2);
+ if (tmp1[0] && fkey && RegQueryValueEx (fkey, tmp1, NULL, NULL, tmp2, &outsize) == ERROR_SUCCESS)
+ ok = 1;
+ } else {
+ char *p = tmp2;
+ for (i = 0; filtervars[i]; i++) {
+ if (i > 0) {
+ strcat (p, ",");
+ p++;
+ }
+ sprintf (p, "%d", filterpresets[filterpreset_builtin].conf[i]);
+ p += strlen(p);
+ }
ok = 1;
-
- if (wParam == IDC_FILTERPRESETSAVE) {
- sprintf (tmp2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
- p->gfx_filter, p->gfx_filter_filtermode,
- p->gfx_filter_vert_zoom, p->gfx_filter_horiz_zoom,
- p->gfx_filter_vert_zoom_mult, p->gfx_filter_horiz_zoom_mult,
- p->gfx_filter_vert_offset, p->gfx_filter_horiz_offset,
- p->gfx_filter_scanlines, p->gfx_filter_scanlinelevel, p->gfx_filter_scanlineratio,
- p->gfx_lores, p->gfx_linedbl, p->gfx_correct_aspect,
- p->gfx_xcenter, p->gfx_ycenter);
+ }
+
+ if (wParam == IDC_FILTERPRESETSAVE && userfilter && fkey) {
+ char *p = tmp2;
+ for (i = 0; filtervars[i]; i++) {
+ if (i > 0) {
+ strcat (p, ",");
+ p++;
+ }
+ sprintf (p, "%d", *(filtervars[i]));
+ p += strlen(p);
+ }
if (ok == 0) {
tmp1[0] = 0;
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof (tmp1), (LPARAM)tmp1);
if (tmp1[0] == 0)
goto end;
}
- RegSetValueEx (fkey, tmp1, 0, REG_SZ, (CONST BYTE *)&tmp2, strlen (tmp2) + 1);
+ if (fkey)
+ RegSetValueEx (fkey, tmp1, 0, REG_SZ, (CONST BYTE *)&tmp2, strlen (tmp2) + 1);
values_to_hw3ddlg (hDlg);
}
if (ok) {
- if (wParam == IDC_FILTERPRESETDELETE) {
+ if (wParam == IDC_FILTERPRESETDELETE && userfilter && fkey) {
err = RegDeleteValue (fkey, tmp1);
values_to_hw3ddlg (hDlg);
} else if (wParam == IDC_FILTERPRESETLOAD) {
strcat (s, ",");
t = strchr (s, ',');
*t++ = 0;
- p->gfx_filter = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_filtermode = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_vert_zoom = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_horiz_zoom = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_vert_zoom_mult = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_horiz_zoom_mult = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_vert_offset = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_horiz_offset = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_scanlines = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_scanlinelevel = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_filter_scanlineratio = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_lores = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_linedbl = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_correct_aspect = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_xcenter = atol (s);
- s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0;
- p->gfx_ycenter = atol (s);
+ for (i = 0; filtervars[i]; i++) {
+ *(filtervars[i]) = atol(s);
+ s = t;
+ t = strchr (s, ',');
+ if (!t)
+ break;
+ *t++ = 0;
+ }
}
}
end:
- RegCloseKey (fkey);
+ if (fkey)
+ RegCloseKey (fkey);
if (load) {
values_to_hw3ddlg (hDlg);
SendMessage (hDlg, WM_HSCROLL, 0, 0);
if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) {
switch (LOWORD (wParam))
{
+ case IDC_FILTERXTRA:
+ values_to_hw3ddlg (hDlg);
+ break;
case IDC_FILTERPRESETS:
filter_preset (hDlg, LOWORD (wParam));
break;
currprefs.gfx_filter_vert_zoom = workprefs.gfx_filter_vert_zoom = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERVZ), TBM_GETPOS, 0, 0 );
currprefs.gfx_filter_horiz_offset = workprefs.gfx_filter_horiz_offset = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
- currprefs.gfx_filter_scanlines = workprefs.gfx_filter_scanlines = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERSL), TBM_GETPOS, 0, 0);
- currprefs.gfx_filter_scanlinelevel = workprefs.gfx_filter_scanlinelevel = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERSL2), TBM_GETPOS, 0, 0);
+ if (filter_selected) {
+ int *pw = filter_selected->varw;
+ int *pc = filter_selected->varc;
+ int v = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERXL), TBM_GETPOS, 0, 0);
+ if (v < filter_selected->min)
+ v = filter_selected->min;
+ if (v > filter_selected->max)
+ v = filter_selected->max;
+ *pw = v;
+ *pc = v;
+ SetDlgItemInt (hDlg, IDC_FILTERXLV, v, TRUE);
+ }
SetDlgItemInt (hDlg, IDC_FILTERHZV, workprefs.gfx_filter_horiz_zoom, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE);
- SetDlgItemInt (hDlg, IDC_FILTERSLV, workprefs.gfx_filter_scanlines, TRUE);
- SetDlgItemInt (hDlg, IDC_FILTERSL2V, workprefs.gfx_filter_scanlinelevel, TRUE);
+ init_colors();
+ notice_new_xcolors();
+ reset_drawing();
updatedisplayarea ();
WIN32GFX_WindowMove ();
break;
if (WINUAEBETA > 0 && GetWindowText (dhwnd, tmp, sizeof (tmp)) > 0) {
strcat (tmp, BetaStr);
+#ifdef WINUAEEXTRA
+ if (strlen(WINUAEEXTRA) > 0) {
+ strcat (tmp, " ");
+ strcat (tmp, WINUAEEXTRA);
+ }
+#endif
SetWindowText (dhwnd, tmp);
}
ShowWindow (dhwnd, SW_SHOW);
RelativePath="..\..\cpuemu_12.c"
>
</File>
+ <File
+ RelativePath="..\..\cpummu.c"
+ >
+ </File>
<File
RelativePath="..\..\cpustbl.c"
>
RelativePath="..\resources\drive_startup.wav"
>
</File>
+ <File
+ RelativePath="..\resources\resource"
+ >
+ </File>
<File
RelativePath="..\resources\resource.h"
>
+Beta 8:
+
+- very long CDTV CD reads don't freeze anymore (overflow in CD
+ speed varible)
+- added "PAL" filter. It is based on Vice C64 PAL filter with some
+ changes like scanlines in 1x-mode and noise. Simulates blurry
+ composite/RF signal. 32bit color depth only. NOTE: filter + AGA
+ enabled = RGB 6:6:6 internal color space only. (compromise between
+ speed+memory usage and image quality)
+- command line parameter was skipped if previous parameter was
+ win32-specific or it needed numeric parameter(s). (b7)
+- IDE partition (non-RDB) hardfile support (no custom filesystem
+ supported yet) NOTE: virtual RDB is read-only, all write attempts
+ to RDB area are silently ignored, no errors returned.
+- non-3D filter improved default centering
+- replaced GUI scanline sliders with more flexible extra parameters
+ settings. Added built-in filter preset support (single PAL filter
+ example currently)
+
Beta 7:
- hardfile reset routine randomly read non-existing memory (b4)
- HRTMon IDE commands work now in A600 configuration.
- HD onscreen led write color fixed in IDE mode
- 4/6 channel modes should really work with Emu10K based cards..
- (I can always hope..)
+ (I can always hope..) EDIT: It did work!
- USP and ISP registers are back in debugger
- brightness/contrast/gamma setting added to display panel
(not working in real time yet)
{
struct asyncreq *ar = get_async_request (dev, request, 1);
if (!ar) {
- write_log ("%s:d: abort sync but no request %x found!\n", getdevname(), dev->unit, request);
+ write_log ("%s:%d: abort sync but no request %x found!\n", getdevname(), dev->unit, request);
return;
}
if (log_uaeserial)