This commit is contained in:
Toni Wilen 2016-02-07 15:44:13 +02:00
parent d07c2a5619
commit cb7201ded0
33 changed files with 1960 additions and 1596 deletions

View File

@ -21,6 +21,7 @@
#include "debug.h"
#include "threaddep/thread.h"
#include "native2amiga.h"
#include "inputdevice.h"
/* Commonly used autoconfig strings */
@ -31,11 +32,11 @@ uaecptr EXPANSION_bootcode, EXPANSION_nullfunc;
/* ROM tag area memory access */
uaecptr rtarea_base = RTAREA_DEFAULT;
HANDLE hardware_trap_event[RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE];
uae_sem_t hardware_trap_event[RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE];
static uaecptr rt_trampoline_ptr, trap_entry;
extern volatile uae_atomic hwtrap_waiting;
extern int filesystem_state;
extern volatile int trap_mode;
DECLARE_MEMORY_FUNCTIONS(rtarea);
addrbank rtarea_bank = {
@ -58,7 +59,7 @@ static void hwtrap_check_int(void)
static bool istrapwait(void)
{
for (int i = 0; i < RTAREA_TRAP_DATA_NUM; i++) {
for (int i = 0; i < RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM; i++) {
uae_u8 *data = rtarea_bank.baseaddr + RTAREA_TRAP_DATA + i * RTAREA_TRAP_DATA_SLOT_SIZE;
uae_u8 *status = rtarea_bank.baseaddr + RTAREA_TRAP_STATUS + i * RTAREA_TRAP_STATUS_SIZE;
if (get_long_host(data + RTAREA_TRAP_DATA_TASKWAIT) && status[3] && status[2] >= 0x80) {
@ -86,13 +87,13 @@ bool rethink_traps(void)
static bool rtarea_trap_data(uaecptr addr)
{
if (addr >= RTAREA_TRAP_DATA && addr < RTAREA_TRAP_DATA + RTAREA_TRAP_DATA_SIZE)
if (addr >= RTAREA_TRAP_DATA && addr < RTAREA_TRAP_DATA + (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM) * RTAREA_TRAP_DATA_SLOT_SIZE)
return true;
return false;
}
static bool rtarea_trap_status(uaecptr addr)
{
if (addr >= RTAREA_TRAP_STATUS && addr < RTAREA_TRAP_STATUS + RTAREA_TRAP_DATA_NUM * RTAREA_TRAP_STATUS_SIZE)
if (addr >= RTAREA_TRAP_STATUS && addr < RTAREA_TRAP_STATUS + (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM) * RTAREA_TRAP_STATUS_SIZE)
return true;
return false;
}
@ -130,7 +131,7 @@ static uae_u32 REGPARAM2 rtarea_bget (uaecptr addr)
int trap_slot = addr2 / RTAREA_TRAP_STATUS_SIZE;
if (trap_offset == 0) {
// 0 = busy wait, 1 = Wait()
rtarea_bank.baseaddr[addr] = filesystem_state ? 1 : 0;
rtarea_bank.baseaddr[addr] = trap_mode ? 1 : 0;
}
} else if (addr == RTAREA_INTREQ + 0) {
rtarea_bank.baseaddr[addr] = atomic_bit_test_and_reset(&uae_int_requested, 0);
@ -163,6 +164,9 @@ static void REGPARAM2 rtarea_bput (uaecptr addr, uae_u32 value)
if (!rtarea_write(addr))
return;
rtarea_bank.baseaddr[addr] = value;
if (addr == RTAREA_INTREQ + 3) {
mousehack_wakeup();
}
if (!rtarea_trap_status(addr))
return;
addr -= RTAREA_TRAP_STATUS;
@ -178,8 +182,7 @@ static void REGPARAM2 rtarea_bput (uaecptr addr, uae_u32 value)
atomic_dec(&hwtrap_waiting);
if (v == 0x01 || v == 0x02) {
// signal call_hardware_trap_back()
// FIXME: OS specific code!
SetEvent(hardware_trap_event[trap_slot]);
uae_sem_post(&hardware_trap_event[trap_slot]);
}
}
}
@ -215,8 +218,9 @@ static void REGPARAM2 rtarea_lput (uaecptr addr, uae_u32 value)
void rtarea_reset(void)
{
memset(rtarea_bank.baseaddr + RTAREA_TRAP_DATA, 0, RTAREA_TRAP_DATA_SIZE);
memset(rtarea_bank.baseaddr + RTAREA_TRAP_STATUS, 0, RTAREA_TRAP_STATUS_SIZE * RTAREA_TRAP_DATA_NUM);
memset(rtarea_bank.baseaddr + RTAREA_TRAP_DATA, 0, RTAREA_TRAP_DATA_SLOT_SIZE * (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM));
memset(rtarea_bank.baseaddr + RTAREA_TRAP_STATUS, 0, RTAREA_TRAP_STATUS_SIZE * (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM));
trap_reset();
}
/* some quick & dirty code to fill in the rt area and save me a lot of
@ -400,7 +404,7 @@ void rtarea_init(void)
write_log(_T("TRAP_ENTRY = %08x\n"), trap_entry);
for (int i = 0; i < RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE; i++) {
hardware_trap_event[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
uae_sem_init(&hardware_trap_event[i], 0, 0);
}
#endif

View File

@ -1097,7 +1097,7 @@ void scsi_atapi_fixup_post (uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 *
static void scsi_atapi_fixup_inquiry (struct amigascsi *as)
{
uae_u8 *scsi_data = as->data;
uae_u8 *scsi_data = as->data_h;
uae_u32 scsi_len = as->len;
uae_u8 *scsi_cmd = as->cmd;
uae_u8 cmd;
@ -2073,7 +2073,7 @@ static int execscsicmd_direct (int unitnum, int type, struct amigascsi *as)
int replylen = 0;
memcpy (cmd, as->cmd, as->cmd_len);
scsi_datap = scsi_datap_org = as->len ? as->data : 0;
scsi_datap = scsi_datap_org = as->len ? as->data_h : 0;
if (as->sense_len > 32)
as->sense_len = 32;
@ -2135,7 +2135,7 @@ int sys_command_scsi_direct_native (int unitnum, int type, struct amigascsi *as)
return ret;
}
int sys_command_scsi_direct (int unitnum, int type, uaecptr acmd)
int sys_command_scsi_direct(TrapContext *ctx, int unitnum, int type, uaecptr acmd)
{
int ret, i;
struct amigascsi as = { 0 };
@ -2148,7 +2148,7 @@ int sys_command_scsi_direct (int unitnum, int type, uaecptr acmd)
bank = &get_mem_bank (ap);
if (!bank || !bank->check(ap, as.len))
return IOERR_BADADDRESS;
as.data = bank->xlateaddr (ap);
as.data_h = bank->xlateaddr (ap);
ap = get_long (acmd + 12);
as.cmd_len = get_word (acmd + 16);

View File

@ -45,9 +45,12 @@ struct sockd {
static long curruniqid = 65536;
static struct sockd *sockdata;
uae_u32 strncpyha (uae_u32 dst, const uae_char *src, int size)
uae_u32 strncpyha(TrapContext *ctx, uae_u32 dst, const uae_char *src, int size)
{
uae_u32 res = dst;
if (trap_is_indirect()) {
trap_put_string(ctx, src, dst, size);
} else {
if (!addr_valid(_T("strncpyha"), dst, size))
return res;
while (size--) {
@ -55,38 +58,50 @@ uae_u32 strncpyha (uae_u32 dst, const uae_char *src, int size)
if (!*src++)
return res;
}
}
return res;
}
uae_u32 addstr (uae_u32 * dst, const TCHAR *src)
uae_u32 addstr(TrapContext *ctx, uae_u32 * dst, const TCHAR *src)
{
uae_u32 res = *dst;
int len;
char *s = ua(src);
len = strlen(s) + 1;
if (trap_is_indirect()) {
trap_put_bytes(ctx, dst, res, len);
} else {
strcpyha_safe (*dst, s);
}
(*dst) += len;
xfree (s);
return res;
}
uae_u32 addstr_ansi (uae_u32 * dst, const uae_char *src)
uae_u32 addstr_ansi(TrapContext *ctx, uae_u32 * dst, const uae_char *src)
{
uae_u32 res = *dst;
int len;
len = strlen (src) + 1;
if (trap_is_indirect()) {
trap_put_bytes(ctx, dst, res, len);
} else {
strcpyha_safe (*dst, src);
}
(*dst) += len;
return res;
}
uae_u32 addmem (uae_u32 * dst, const uae_char *src, int len)
uae_u32 addmem(TrapContext *ctx, uae_u32 * dst, const uae_char *src, int len)
{
uae_u32 res = *dst;
if (!src)
return 0;
if (trap_is_indirect()) {
trap_put_bytes(ctx, src, res, len);
} else {
memcpyha_safe (*dst, (uae_u8*)src, len);
}
(*dst) += len;
return res;
@ -1663,14 +1678,14 @@ static uae_u32 REGPARAM2 bsdsocklib_init(TrapContext *ctx)
}
for (i = 0; i < (int) (number_sys_error); i++)
errnotextptrs[i] = addstr (&tmp1, errortexts[i]);
errnotextptrs[i] = addstr(ctx, &tmp1, errortexts[i]);
for (i = 0; i < (int) (number_host_error); i++)
herrnotextptrs[i] = addstr (&tmp1, herrortexts[i]);
herrnotextptrs[i] = addstr(ctx, &tmp1, herrortexts[i]);
for (i = 0; i < (int) (number_sana2io_error); i++)
sana2iotextptrs[i] = addstr (&tmp1, sana2io_errlist[i]);
sana2iotextptrs[i] = addstr(ctx, &tmp1, sana2io_errlist[i]);
for (i = 0; i < (int) (number_sana2wire_error); i++)
sana2wiretextptrs[i] = addstr (&tmp1, sana2wire_errlist[i]);
strErrptr = addstr (&tmp1, strErr);
sana2wiretextptrs[i] = addstr(ctx, &tmp1, sana2wire_errlist[i]);
strErrptr = addstr(ctx, &tmp1, strErr);
#if 0
/* @@@ someone please implement a proper interrupt handler setup here :) */
@ -1769,8 +1784,11 @@ uaecptr bsdlib_startup (TrapContext *ctx, uaecptr resaddr)
trap_put_word(ctx, resaddr + 0x0, 0x4AFC);
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
trap_put_word(ctx, resaddr + 0xA, 0x8004); /* RTF_AUTOINIT, RT_VERSION */
trap_put_word(ctx, resaddr + 0xC, 0x0970); /* NT_LIBRARY, RT_PRI */
if (kickstart_version >= 37) {
trap_put_long(ctx, resaddr + 0xA, 0x84040900 | AFTERDOS_PRI); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
} else {
trap_put_long(ctx, resaddr + 0xA, 0x80040905); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
}
trap_put_long(ctx, resaddr + 0xE, res_name);
trap_put_long(ctx, resaddr + 0x12, res_id);
trap_put_long(ctx, resaddr + 0x16, res_init);

View File

@ -81,7 +81,7 @@ int consolehook_activate (void)
return console_emulation;
}
void consolehook_ret (uaecptr condev, uaecptr oldbeginio)
void consolehook_ret(TrapContext *ctx, uaecptr condev, uaecptr oldbeginio)
{
beginio = oldbeginio;
write_log (_T("console.device at %08X\n"), condev);
@ -89,28 +89,36 @@ void consolehook_ret (uaecptr condev, uaecptr oldbeginio)
uae_start_thread (_T("consolereader"), console_thread, NULL, NULL);
}
uaecptr consolehook_beginio (uaecptr request)
uaecptr consolehook_beginio(TrapContext *ctx, uaecptr request)
{
uae_u32 io_data = get_long (request + 40); // 0x28
uae_u32 io_length = get_long (request + 36); // 0x24
uae_u32 io_actual = get_long (request + 32); // 0x20
uae_u32 io_offset = get_long (request + 44); // 0x2c
uae_u16 cmd = get_word (request + 28);
uae_u32 io_data = trap_get_long(ctx, request + 40); // 0x28
uae_u32 io_length = trap_get_long(ctx, request + 36); // 0x24
uae_u32 io_actual = trap_get_long(ctx, request + 32); // 0x20
uae_u32 io_offset = trap_get_long(ctx, request + 44); // 0x2c
uae_u16 cmd = trap_get_word(ctx, request + 28);
if (cmd == CMD_WRITE) {
TCHAR *buf;
const char *src = (char*)get_real_address (io_data);
int len = io_length;
if (io_length == -1)
len = strlen (src);
char *dbuf;
TCHAR *buf;
if (len == -1) {
dbuf = xmalloc(char, MAX_DPATH);
trap_get_string(ctx, dbuf, io_data, MAX_DPATH);
len = strlen(dbuf);
} else {
dbuf = xmalloc(char, len);
trap_get_bytes(ctx, dbuf, io_data, len);
}
buf = xmalloc(TCHAR, len + 1);
au_copy (buf, len, src);
au_copy(buf, len, dbuf);
buf[len] = 0;
f_out(stdout, _T("%s"), buf);
xfree(buf);
xfree(dbuf);
} else if (cmd == CMD_READ) {
write_log (_T("%08x: CMD=%d LEN=%d OFF=%d ACT=%d\n"), request, cmd, io_length, io_offset, io_actual);
}
return beginio;
}

View File

@ -32,6 +32,7 @@ AllocMem = -198
FreeMem = -210
TRAP_DATA_NUM = 4
TRAP_DATA_SEND_NUM = 1
TRAP_DATA = $4000
TRAP_DATA_SIZE = $8000
@ -50,6 +51,11 @@ TRAP_STATUS_STATUS = 3
TRAP_DATA_DATA = 4
RTAREA_SYSBASE = $3FFC
RTAREA_GFXBASE = $3FF8
RTAREA_INTBASE = $3FF4
RTAREA_INTXY = $3FF0
RTAREA_MOUSEHACK = $3E00
RTAREA_TRAPTASK = $FFF4
RTAREA_EXTERTASK = $FFF8
@ -90,7 +96,7 @@ startjmp:
dc.l bootcode-start ;5 32
dc.l setup_exter-start ;6 36
dc.l bcplwrapper-start ;7 40
dc.l clipboard_init-start ;8 44
dc.l afterdos-start ;8 44
dc.l hwtrap_install-start ;9 48
dc.l hwtrap_entry-start ; 10 52
@ -122,76 +128,30 @@ bcpl_start:
dc.l 2
bcpl_end:
residenthack
movem.l d0-d2/a0-a2/a6,-(sp)
move.w #$FF38,d0
moveq #17,d1
bsr.w getrtbase
jsr (a0)
tst.l d0
beq.s .rsh
afterdos:
movem.l d2-d7/a2-a6,-(sp)
move.l 4.w,a6
cmp.w #37,20(a6)
bcs.s .rsh
moveq #residentcodeend-residentcodestart,d0
move.l d0,d2
moveq #1,d1
jsr AllocMem(a6)
tst.l d0
beq.s .rsh
move.l d0,a2
lea gfxlibname(pc),a1
moveq #0,d0
jsr -$0228(a6) ;OpenLibrary
move.l d0,d1
move.w #RTAREA_GFXBASE,d0
bsr.w getrtbase
move.l d1,(a0)
lea intlibname(pc),a1
moveq #0,d0
jsr -$0228(a6) ;OpenLibrary
move.l d0,d1
move.w #RTAREA_INTBASE,d0
bsr.w getrtbase
move.l d1,(a0)
move.l a2,a0
lea residentcodestart(pc),a1
.cp1
move.l (a1)+,(a0)+
subq.l #4,d2
bne.s .cp1
jsr -$0078(a6) ;Disable
move.l a6,a1
move.w #-$48,a0 ;InitCode
move.l a2,d0
jsr -$01a4(a6) ;SetFunction
move.l d0,residentcodejump2-residentcodestart+2(a2)
lea myafterdos(pc),a0
move.l a0,residentcodejump1-residentcodestart+2(a2)
jsr -$27C(a6) ;CacheClearU
jsr -$007e(a6) ;Enable
.rsh
movem.l (sp)+,d0-d2/a0-a2/a6
rts
myafterdos
move.l (sp),a0
move.l 2(a0),a0
move.l a0,-(sp)
jsr (a0) ;jump to original InitCode
move.l (sp)+,a0
addq.l #4,sp ;remove return address
movem.l d0-d7/a1-a6,-(sp)
move.l a6,a1
move.l a0,d0
move.w #-$48,a0 ;InitCode
jsr -$01a4(a6) ;SetFunction (restore original)
bsr.w clipboard_init
bsr.w consolehook
movem.l (sp)+,d0-d7/a1-a6
rts ;return directly to caller
cnop 0,4
residentcodestart:
btst #2,d0 ;RTF_AFTERDOS?
beq.s resjump
residentcodejump1
jsr $f00000
resjump
residentcodejump2
jmp $f00000
cnop 0,4
residentcodeend:
movem.l (sp)+,d2-d7/a2-a6
moveq #0,d0
rts
filesys_init:
movem.l d0-d7/a0-a6,-(sp)
@ -665,7 +625,7 @@ exter_server_exit:
; d0 = exter task, d1 = trap task
heartbeatvblank:
movem.l d0-d3/a0-a2,-(sp)
movem.l d0-d3/a0-a4,-(sp)
move.l d0,d2
move.l d1,d3
@ -677,39 +637,60 @@ heartbeatvblank:
jsr (a0)
move.l d0,a2 ; intreq
moveq #22+3*4,d0
moveq #22+5*4,d0
move.l #65536+1,d1
jsr AllocMem(a6)
move.l d0,a1
move.l d0,a4
lea 22(a1),a0
move.l a2,(a0)
move.l d2,4(a0)
move.l d3,8(a0)
move.l a0,14(a1)
lea 22(a4),a3
move.l a3,a1
move.l a2,(a1)+
move.l d2,(a1)+
move.l d3,(a1)+
move.w #RTAREA_INTBASE,d0
bsr.w getrtbase
move.l a0,(a1)+
move.w #RTAREA_INTXY,d0
bsr.w getrtbase
move.l a0,(a1)+
move.b #2,8(a1) ;NT_INTERRUPT
move.b #-10,9(a1) ;priority
move.l a3,14(a4)
move.b #2,8(a4) ;NT_INTERRUPT
move.b #-10,9(a4) ;priority
lea kaname(pc),a0
move.l a0,10(a1)
move.l a0,10(a4)
lea kaint(pc),a0
move.l a0,18(a1)
move.l a0,18(a4)
move.l a4,a1
moveq #5,d0 ;INTB_VERTB
jsr -$00a8(a6)
movem.l (sp)+,d0-d3/a0-a2
movem.l (sp)+,d0-d3/a0-a4
rts
kaint:
move.l (a1),a0
addq.l #1,(a0)
move.l 3*4(a1),a0 ;RTAREA_INTBASE
move.l (a0),d0
beq.s .noint
move.l d0,a0
cmp.w #31,20(a0) ;version < 31
bcs.s .noint
tst.l 34(a0) ;ViewPort == NULL
beq.s .noint
tst.l 60(a0) ;FirstScreen == NULL
beq.s .noint
move.l 4*4(a1),a1
move.l 68(a0),(a1) ;Y.W X.W
.noint
moveq #0,d0
rts
setup_exter:
movem.l d0-d3/d7/a0-a2,-(sp)
move.l d0,d7
bsr.w residenthack
move.l #RTAREA_INTREQ,d0
bsr.w getrtbase
move.l a0,a2
@ -2030,8 +2011,8 @@ MH_IEPT = (MH_IEH+22) ;IEPointerTable/IENewTablet
MH_IENTTAGS = (MH_IEPT+32) ;space for ient_TagList
MH_IO = (MH_IENTTAGS+16*4*2)
MH_TM = (MH_IO+4)
MH_DATA = (MH_TM+4)
MH_END = (MH_DATA+MH_DATA_SIZE)
MH_DATAPTR = (MH_TM+4)
MH_END = (MH_DATAPTR+4)
MH_MOUSEHACK = 0
MH_TABLET = 1
@ -2156,10 +2137,10 @@ mousehack_task:
sub.l a1,a1
jsr -$0126(a6) ;FindTask
move.l d0,a4
move.l d0,a2
moveq #20,d0
move.l a4,a1
move.l a2,a1
jsr -$012c(a6) ;SetTaskPri
moveq #0,d0
@ -2168,9 +2149,14 @@ mousehack_task:
jsr AllocMem(a6)
move.l d0,a5
move.w #RTAREA_MOUSEHACK,d0
bsr.w getrtbase
move.l a0,MH_DATAPTR(a5)
move.l a0,a4
lea MH_FOO(a5),a3
move.l a6,MH_FOO_EXECBASE(a3)
move.l a4,MH_FOO_TASK(a3)
move.l a2,MH_FOO_TASK(a3)
move.l d6,MH_FOO_MASK(a3)
moveq #-1,d0
move.w d0,MH_FOO_CNT(a3)
@ -2179,8 +2165,7 @@ mousehack_task:
move.w #$FF38,d0
moveq #5,d1
bsr.w getrtbase
move.l a5,d0
add.l #MH_DATA,d0
move.l a4,d0
jsr (a0)
lea MH_INT(a5),a1
@ -2214,6 +2199,10 @@ mhloop
jsr -$0228(a6) ;OpenLibrary
move.l d0,MH_FOO_INTBASE(a3)
beq.s mhloop
move.l d0,d1
move.w #RTAREA_INTBASE,d0
bsr.w getrtbase
move.l d1,(a0)
.intyes
tst.l MH_FOO_GFXBASE(a3)
bne.s .gfxyes
@ -2224,6 +2213,10 @@ mhloop
jsr -$0228(a6) ;OpenLibrary
move.l d0,MH_FOO_GFXBASE(a3)
beq.w mhloop
move.l d0,d1
move.w #RTAREA_GFXBASE,d0
bsr.w getrtbase
move.l d1,(a0)
.gfxyes
tst.l MH_IO(a5)
@ -2237,7 +2230,7 @@ mhloop
move.l d0,d2
jsr -$008a(a6) ;Permit
tst.l d2
beq.s mhloop
beq.w mhloop
lea inp_dev(pc),a0
moveq #0,d0
moveq #0,d1
@ -2275,6 +2268,8 @@ mhloop
cmp.w #36,d7
bcs.s .nodims
cmp.w #50,d7
bcc.s .nodims
subq.l #1,MH_FOO_LIMITCNT(a3)
bpl.s .nodims
move.l a3,a0
@ -2289,7 +2284,7 @@ mhloop
move.l #22,36(a1) ;sizeof(struct InputEvent)
move.l a2,40(a1)
move.b MH_E+MH_DATA(a5),d0
move.b MH_E(a4),d0
cmp.w #39,d7
bcs.w .notablet
btst #MH_TABLET,d0
@ -2310,72 +2305,72 @@ mhloop
clr.w 6(a2) ;ie_Code
bsr.w buttonstoqual
move.w MH_X+MH_DATA(a5),12+2(a0) ;ient_TabletX
move.w MH_X(a4),12+2(a0) ;ient_TabletX
clr.w 16(a0)
move.w MH_Y++MH_DATA(a5),16+2(a0) ;ient_TabletY
move.w MH_Y(a4),16+2(a0) ;ient_TabletY
clr.w 20(a0)
move.w MH_MAXX+MH_DATA(a5),20+2(a0) ;ient_RangeX
move.w MH_MAXX(a4),20+2(a0) ;ient_RangeX
clr.w 24(a0)
move.w MH_MAXY+MH_DATA(a5),24+2(a0) ;ient_RangeY
move.w MH_MAXY(a4),24+2(a0) ;ient_RangeY
lea MH_IENTTAGS(a5),a1
move.l a1,28(a0) ;ient_TagList
move.l #TABLETA_Pressure,(a1)+
move.w MH_PRESSURE+MH_DATA(a5),d0
move.w MH_PRESSURE(a4),d0
ext.l d0
asl.l #8,d0
move.l d0,(a1)+
move.l #TABLETA_ButtonBits,(a1)+
move.l MH_BUTTONBITS+MH_DATA(a5),(a1)+
move.l MH_BUTTONBITS(a4),(a1)+
moveq #0,d0
move.w MH_RESX+MH_DATA(a5),d0
move.w MH_RESX(a4),d0
bmi.s .noresx
move.l #TABLETA_ResolutionX,(a1)+
move.l d0,(a1)+
.noresx
move.w MH_RESY+MH_DATA(a5),d0
move.w MH_RESY(a4),d0
bmi.s .noresy
move.l #TABLETA_ResolutionY,(a1)+
move.l d0,(a1)+
.noresy
move.w MH_MAXZ+MH_DATA(a5),d0
move.w MH_MAXZ(a4),d0
bmi.s .noz
move.l #TABLETA_RangeZ,(a1)+
move.l d0,(a1)+
move.w MH_Z+MH_DATA(a5),d0
move.w MH_Z(a4),d0
move.l #TABLETA_TabletZ,(a1)+
move.l d0,(a1)+
.noz
move.w MH_MAXAX+MH_DATA(a5),d0
move.w MH_MAXAX(a4),d0
bmi.s .noax
move.l #TABLETA_AngleX,(a1)+
move.w MH_AX+MH_DATA(a5),d0
move.w MH_AX(a4),d0
ext.l d0
asl.l #8,d0
move.l d0,(a1)+
.noax
move.w MH_MAXAY+MH_DATA(a5),d0
move.w MH_MAXAY(a4),d0
bmi.s .noay
move.l #TABLETA_AngleY,(a1)+
move.w MH_AY+MH_DATA(a5),d0
move.w MH_AY(a4),d0
ext.l d0
asl.l #8,d0
move.l d0,(a1)+
.noay
move.w MH_MAXAZ+MH_DATA(a5),d0
move.w MH_MAXAZ(a4),d0
bmi.s .noaz
move.l #TABLETA_AngleZ,(a1)+
move.w MH_AZ+MH_DATA(a5),d0
move.w MH_AZ(a4),d0
ext.l d0
asl.l #8,d0
move.l d0,(a1)+
.noaz
moveq #0,d0
move.w MH_INPROXIMITY+MH_DATA(a5),d0
move.w MH_INPROXIMITY(a4),d0
bmi.s .noproxi
move.l #TABLETA_InProximity,(a1)+
move.l d0,(a1)+
@ -2387,7 +2382,7 @@ mhloop
;create mouse button events if button state changed
move.w #$68,d3 ;IECODE_LBUTTON->IECODE_RBUTTON->IECODE_MBUTTON
moveq #1,d2
move.l MH_BUTTONBITS+MH_DATA(a5),d4
move.l MH_BUTTONBITS(a4),d4
.nextbut
move.l d4,d0
and.l d2,d0
@ -2418,7 +2413,7 @@ mhloop
.notablet
move.b MH_E+MH_DATA(a5),d0
move.b MH_E(a4),d0
btst #MH_MOUSEHACK,d0
beq.w mhloop
@ -2429,7 +2424,7 @@ mhloop
move.l MH_FOO_INTBASE(a3),a0
move.w MH_ABSX+MH_DATA(a5),d0
move.w MH_ABSX(a4),d0
move.w 34+14(a0),d1
add.w d1,d1
sub.w d1,d0
@ -2438,7 +2433,7 @@ mhloop
.xn
move.w d0,10(a2)
move.w MH_ABSY+MH_DATA(a5),d0
move.w MH_ABSY(a4),d0
move.w 34+12(a0),d1
add.w d1,d1
sub.w d1,d0
@ -2456,7 +2451,7 @@ mhend
buttonstoqual:
;IEQUALIFIER_MIDBUTTON=0x1000/IEQUALIFIER_RBUTTON=0x2000/IEQUALIFIER_LEFTBUTTON=0x4000
move.l MH_BUTTONBITS+MH_DATA(a5),d1
move.l MH_BUTTONBITS(a4),d1
moveq #0,d0
btst #0,d1
beq.s .btq1
@ -2478,23 +2473,25 @@ mousehackint:
beq.s .l1
tst.l MH_TM(a1)
beq.s .l1
move.w MH_CNT+MH_DATA(a1),d0
move.l MH_DATAPTR(a1),a0
move.w MH_CNT(a0),d0
cmp.w MH_FOO+MH_FOO_CNT(a1),d0
beq.s .l2
move.w d0,MH_FOO+MH_FOO_CNT(a1)
.l1
move.l a1,-(sp)
move.l MH_FOO+MH_FOO_EXECBASE(a1),a6
move.l MH_FOO+MH_FOO_MASK(a1),d0
move.l MH_FOO+MH_FOO_TASK(a1),a1
jsr -$0144(a6) ; Signal
move.l (sp)+,a1
.l2
subq.w #1,MH_FOO+MH_FOO_ALIVE(a1)
bpl.s .l3
move.w #50,MH_FOO+MH_FOO_ALIVE(a1)
move.w #$FF38,d0
moveq #2,d1
move.w #RTAREA_INTREQ+3,d0
bsr.w getrtbase
jsr (a0)
st (a0)
.l3
lea $dff000,a0
moveq #0,d0
@ -3137,7 +3134,7 @@ hwtrap_install:
move.l a2,14(a1)
lea.l hwtrap_interrupt(pc),a0
move.l a0,18(a1)
move.w #$0270,8(a1)
move.w #$027a,8(a1)
moveq #13,d0 ;EXTER
jsr -168(a6) ; AddIntServer
movem.l (sp)+,a2/a6
@ -3230,7 +3227,7 @@ hwtrap_interrupt:
move.l a2,d0
clr.w d0
move.l d0,a0
moveq #TRAP_DATA_NUM-1,d1
moveq #TRAP_DATA_NUM+TRAP_DATA_SEND_NUM-1,d1
move.l a0,a1
move.l RTAREA_SYSBASE(a0),a6
add.l #TRAP_DATA,a0

View File

@ -72,8 +72,6 @@
#define TRACING_ENABLED 1
int log_filesys = 0;
int filesystem_state;
#define TRAPMD 1
#if TRACING_ENABLED
@ -140,6 +138,7 @@ uaecptr filesys_initcode, filesys_initcode_ptr;
static uaecptr bootrom_start;
static uae_u32 fsdevname, fshandlername, filesys_configdev;
static uae_u32 cdfs_devname, cdfs_handlername;
static uaecptr afterdos_name, afterdos_id, afterdos_initcode;
static int filesys_in_interrupt;
static uae_u32 mountertask;
static int automountunit = -1;
@ -1771,18 +1770,11 @@ static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, c
write_log (_T("FILESYS: delayed insert %d: '%s' ('%s')\n"), u->unit, volume ? volume : _T("<none>"), rootdir);
}
int filesys_eject(int nr)
static uae_u32 filesys_eject_cb(TrapContext *ctx, void *ud)
{
UnitInfo *ui = &mountinfo.ui[nr];
UnitInfo *ui = (UnitInfo*)ud;
Unit *u = ui->self;
TrapContext *ctx = NULL;
if (!mountertask || u->mount_changed)
return 0;
if (ui->open <= 0 || u == NULL)
return 0;
if (!is_virtual (nr))
return 0;
if (!filesys_isvolume(ctx, u))
return 0;
u->mount_changed = -1;
@ -1793,6 +1785,20 @@ int filesys_eject(int nr)
uae_Signal(trap_get_long(ctx, u->volume + 176 - 32), 1 << 13);
return 1;
}
int filesys_eject(int nr)
{
UnitInfo *ui = &mountinfo.ui[nr];
Unit *u = ui->self;
if (!mountertask || u->mount_changed)
return 0;
if (ui->open <= 0 || u == NULL)
return 0;
if (!is_virtual (nr))
return 0;
trap_callback(filesys_eject_cb, ui);
return 1;
}
static uae_u32 heartbeat;
static int heartbeat_count;
@ -1803,9 +1809,9 @@ void setsystime (void)
{
TrapContext *ctx = NULL;
if (!currprefs.tod_hack || !rtarea_base)
if (!currprefs.tod_hack || !rtarea_bank.baseaddr)
return;
heartbeat = trap_get_long(ctx, rtarea_base + RTAREA_HEARTBEAT);
heartbeat = get_long_host(rtarea_bank.baseaddr + RTAREA_HEARTBEAT);
heartbeat_task = 1;
heartbeat_count = 10;
}
@ -3111,7 +3117,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr)
if (is_virtual (nr)) {
ui->unit_pipe = xmalloc (smp_comm_pipe, 1);
ui->back_pipe = xmalloc (smp_comm_pipe, 1);
init_comm_pipe (ui->unit_pipe, 100, 3);
init_comm_pipe (ui->unit_pipe, 300, 3);
init_comm_pipe (ui->back_pipe, 100, 1);
uae_start_thread (_T("filesys"), filesys_thread, (void *)ui, &ui->tid);
}
@ -3245,6 +3251,11 @@ static uae_u32 REGPARAM2 startup_handler(TrapContext *ctx)
return 1 | (late ? 2 : 0);
}
static bool is_writeprotected(Unit *unit)
{
return unit->ui.readonly || unit->ui.locked || currprefs.harddrive_read_only;
}
static void do_info(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr info, bool disk_info)
{
struct fs_usage fsu;
@ -3288,7 +3299,7 @@ static void do_info(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr info,
}
put_long_host(buf, 0); /* errors */
put_long_host(buf + 4, nr); /* unit number */
put_long_host(buf + 8, unit->ui.readonly || unit->ui.locked ? 80 : 82); /* state */
put_long_host(buf + 8, is_writeprotected(unit) ? 80 : 82); /* state */
put_long_host(buf + 20, blocksize); /* bytesperblock */
put_long_host(buf + 32, 0); /* inuse */
if (unit->ui.unknown_media) {
@ -4965,14 +4976,14 @@ static void do_find(TrapContext *ctx, Unit *unit, dpacket *packet, int mode, int
return;
}
if (create != 2) {
if ((((mode & aino->amigaos_mode) & A_FIBF_WRITE) != 0 || unit->ui.readonly || unit->ui.locked)
if ((((mode & aino->amigaos_mode) & A_FIBF_WRITE) != 0 || is_writeprotected(unit))
&& fallback)
{
mode &= ~A_FIBF_WRITE;
}
/* Kick 1.3 doesn't check read and write access bits - maybe it would be
* simpler just not to do that either. */
if ((mode & A_FIBF_WRITE) != 0 && (unit->ui.readonly || unit->ui.locked)) {
if ((mode & A_FIBF_WRITE) != 0 && is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5089,7 +5100,7 @@ static void action_fh_from_lock(TrapContext *ctx, Unit *unit, dpacket *packet)
: O_RDWR));
/* the files on CD really can have the write-bit set. */
if (unit->ui.readonly || unit->ui.locked)
if (is_writeprotected(unit))
openmode = O_RDONLY;
fd = fs_openfile (unit, aino, openmode | O_BINARY);
@ -5120,7 +5131,7 @@ static void action_find_input(TrapContext *ctx, Unit *unit, dpacket *packet)
static void action_find_output(TrapContext *ctx, Unit *unit, dpacket *packet)
{
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5130,7 +5141,7 @@ static void action_find_output(TrapContext *ctx, Unit *unit, dpacket *packet)
static void action_find_write(TrapContext *ctx, Unit *unit, dpacket *packet)
{
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5323,7 +5334,7 @@ static void action_write(TrapContext *ctx, Unit *unit, dpacket *packet)
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
TRACE((_T("ACTION_WRITE(%s,0x%x,%d)\n"), k->aino->nname, addr, size));
if (unit->ui.readonly || unit->ui.locked || k->aino->vfso) {
if (is_writeprotected(unit) || k->aino->vfso) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5462,7 +5473,7 @@ static void action_set_protect(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_SET_PROTECT(0x%x,\"%s\",0x%x)\n"), lock, bstr(ctx, unit, name), mask));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5502,7 +5513,7 @@ static void action_set_comment(TrapContext *ctx, Unit * unit, dpacket *packet)
a_inode *a;
int err;
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5691,7 +5702,7 @@ static void action_create_dir(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_CREATE_DIR(0x%x,\"%s\")\n"), lock, bstr(ctx, unit, name)));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5877,7 +5888,7 @@ static void action_delete_object(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_DELETE_OBJECT(0x%x,\"%s\")\n"), lock, bstr(ctx, unit, name)));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5940,7 +5951,7 @@ static void action_set_date(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_SET_DATE(0x%x,\"%s\")\n"), lock, bstr(ctx, unit, name)));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -5987,7 +5998,7 @@ static void action_rename_object(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_RENAME_OBJECT(0x%x,\"%s\","), lock1, bstr(ctx, unit, name1)));
TRACE((_T("0x%x,\"%s\")\n"), lock2, bstr(ctx, unit, name2)));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -6094,7 +6105,7 @@ static void action_rename_disk(TrapContext *ctx, Unit *unit, dpacket *packet)
TRACE((_T("ACTION_RENAME_DISK(\"%s\")\n"), bstr(ctx, unit, name)));
if (unit->ui.readonly || unit->ui.locked) {
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED);
return;
@ -7153,7 +7164,6 @@ void filesys_reset (void)
{
if (isrestore ())
return;
filesystem_state = 0;
load_injected_icons();
filesys_reset2 ();
initialize_mountinfo ();
@ -7322,13 +7332,53 @@ static uae_u32 REGPARAM2 filesys_doio(TrapContext *ctx)
return 0;
}
static uaecptr add_resident(TrapContext *ctx, uaecptr resaddr, uaecptr myres)
{
uaecptr sysbase, reslist, prevjmp, resptr;
uae_s8 myrespri = trap_get_byte(ctx, myres + 13); // rt_Pri
sysbase = trap_get_long(ctx, 4);
prevjmp = 0;
reslist = trap_get_long(ctx, sysbase + 300); // ResModules
for (;;) {
resptr = trap_get_long(ctx, reslist);
if (!resptr)
break;
if (resptr & 0x80000000) {
prevjmp = reslist;
reslist = resptr & 0x7fffffff;
continue;
}
uae_s8 respri = trap_get_byte(ctx, resptr + 13); // rt_Pri
uaecptr resname = trap_get_long(ctx, resptr + 14); // rt_Name
if (resname) {
uae_char resnamebuf[256];
trap_get_string(ctx, resnamebuf, resname, sizeof resnamebuf);
if (myrespri >= respri)
break;
}
prevjmp = 0;
reslist += 4;
}
if (prevjmp) {
trap_put_long(ctx, prevjmp, 0x80000000 | resaddr);
} else {
trap_put_long(ctx, reslist, 0x80000000 | resaddr);
}
trap_put_long(ctx, resaddr, myres);
trap_put_long(ctx, resaddr + 4, resptr);
trap_put_long(ctx, resaddr + 8, 0x80000000 | (reslist + 4));
resaddr += 3 * 4;
return resaddr;
}
static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
{
UnitInfo *uip = mountinfo.ui;
uaecptr resaddr = trap_get_areg(ctx, 2);
uaecptr expansion = trap_get_areg(ctx, 5);
uaecptr start = resaddr;
uaecptr residents, tmp;
uaecptr first_resident, last_resident, tmp;
uaecptr resaddr_hack = 0;
uae_u8 *baseaddr;
@ -7354,7 +7404,7 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
write_log (_T("filesystem: diagentry %08x configdev %08x\n"), resaddr, filesys_configdev);
tmp = resaddr;
first_resident = resaddr;
if (ROM_hardfile_resid != 0) {
/* Build a struct Resident. This will set up and initialize
* the uae.device */
@ -7369,7 +7419,7 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
}
resaddr += 0x1A;
if (!KS12_BOOT_HACK || expansion)
tmp = resaddr;
first_resident = resaddr;
/* The good thing about this function is that it always gets called
* when we boot. So we could put all sorts of stuff that wants to be done
* here.
@ -7378,6 +7428,18 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
* Resident structures and call InitResident() for them at the end of the
* diag entry. */
if (kickstart_version >= 37) {
trap_put_word(ctx, resaddr + 0x0, 0x4afc);
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A);
trap_put_word(ctx, resaddr + 0xA, 0x0432); /* RTF_AFTERDOS; Version 50 */
trap_put_word(ctx, resaddr + 0xC, 0x0000 | AFTERDOS_INIT_PRI); /* NT_UNKNOWN; pri */
trap_put_long(ctx, resaddr + 0xE, afterdos_name);
trap_put_long(ctx, resaddr + 0x12, afterdos_id);
trap_put_long(ctx, resaddr + 0x16, afterdos_initcode);
resaddr += 0x1A;
}
resaddr = uaeres_startup(ctx, resaddr);
#ifdef BSDSOCKET
resaddr = bsdlib_startup(ctx, resaddr);
@ -7398,9 +7460,11 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
resaddr = tabletlib_startup(ctx, resaddr);
#endif
last_resident = resaddr;
#if 0
/* scan for Residents and return pointer to array of them */
residents = resaddr;
while (tmp < residents && tmp >= start) {
tmp = first_resident;
while (tmp < last_resident && tmp >= first_resident) {
if (trap_get_word(ctx, tmp) == 0x4AFC &&
trap_get_long(ctx, tmp + 0x2) == tmp) {
trap_put_word(ctx, resaddr, 0x227C); /* move.l #tmp,a1 */
@ -7413,6 +7477,8 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
tmp += 2;
}
}
#endif
/* call setup_exter */
trap_put_word(ctx, resaddr + 0, 0x7000 | (currprefs.uaeboard > 1 ? 3 : 1)); /* moveq #x,d0 */
trap_put_word(ctx, resaddr + 2, 0x2079); /* move.l RTAREA_BASE+setup_exter,a0 */
@ -7512,7 +7578,7 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
put_word_host(baseaddr + 0x2112, 1 | 2 | 8 | 16);
}
trap_set_areg(ctx, 0, residents);
trap_set_areg(ctx, 0, last_resident);
if (currprefs.uae_hide_autoconfig && expansion) {
bool found = true;
@ -7540,6 +7606,19 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx)
}
}
#if 1
tmp = first_resident;
while (tmp < last_resident && tmp >= first_resident) {
if (trap_get_word(ctx, tmp) == 0x4AFC && trap_get_long(ctx, tmp + 0x2) == tmp) {
resaddr = add_resident(ctx, resaddr, tmp);
tmp = trap_get_long(ctx, tmp + 0x6);
} else {
tmp += 2;
}
}
//activate_debugger();
#endif
return 1;
}
@ -7714,13 +7793,6 @@ static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *ctx)
if (trap_get_dreg(ctx, 3) >= 0)
uip->startup = trap_get_long(ctx, devicenode + 28);
if (!filesystem_state) {
write_log(_T("CHANGED!\n"));
filesystem_state = 1;
}
return devicenode;
}
@ -8567,19 +8639,19 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *ctx)
uaecptr diminfo = trap_get_areg(ctx, 2);
uaecptr dispinfo = trap_get_areg(ctx, 3);
uaecptr vp = trap_get_areg(ctx, 4);
return input_mousehack_status(mode, diminfo, dispinfo, vp, trap_get_dreg(ctx, 2));
return input_mousehack_status(ctx, mode, diminfo, dispinfo, vp, trap_get_dreg(ctx, 2));
} else if (mode == 10) {
amiga_clipboard_die();
amiga_clipboard_die(ctx);
} else if (mode == 11) {
amiga_clipboard_got_data(trap_get_areg(ctx, 2), trap_get_dreg(ctx, 2), trap_get_dreg(ctx, 0) + 8);
amiga_clipboard_got_data(ctx, trap_get_areg(ctx, 2), trap_get_dreg(ctx, 2), trap_get_dreg(ctx, 0) + 8);
} else if (mode == 12) {
return amiga_clipboard_want_data();
return amiga_clipboard_want_data(ctx);
} else if (mode == 13) {
return amiga_clipboard_proc_start();
return amiga_clipboard_proc_start(ctx);
} else if (mode == 14) {
amiga_clipboard_task_start(trap_get_dreg(ctx, 0));
amiga_clipboard_task_start(ctx, trap_get_dreg(ctx, 0));
} else if (mode == 15) {
amiga_clipboard_init();
amiga_clipboard_init(ctx);
} else if (mode == 16) {
uaecptr a2 = trap_get_areg(ctx, 2);
input_mousehack_mouseoffset(a2);
@ -8589,15 +8661,16 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *ctx)
v |= 1;
if (consolehook_activate())
v |= 2;
trap_dos_active();
return v;
} else if (mode == 18) {
put_long_host(rtarea_bank.baseaddr + RTAREA_EXTERTASK, trap_get_dreg(ctx, 0));
put_long_host(rtarea_bank.baseaddr + RTAREA_TRAPTASK, trap_get_dreg(ctx, 2));
return rtarea_base + RTAREA_HEARTBEAT;
} else if (mode == 101) {
consolehook_ret(trap_get_areg(ctx, 1), trap_get_areg(ctx, 2));
consolehook_ret(ctx, trap_get_areg(ctx, 1), trap_get_areg(ctx, 2));
} else if (mode == 102) {
uaecptr ret = consolehook_beginio(trap_get_areg(ctx, 1));
uaecptr ret = consolehook_beginio(ctx, trap_get_areg(ctx, 1));
trap_put_long(ctx, trap_get_areg(ctx, 7) + 4 * 4, ret);
} else {
write_log (_T("Unknown mousehack hook %d\n"), mode);
@ -8703,6 +8776,8 @@ void filesys_install (void)
fshandlername = ds_bstr_ansi ("uaefs");
cdfs_devname = ds_ansi ("uaescsi.device");
cdfs_handlername = ds_bstr_ansi ("uaecdfs");
afterdos_name = ds_ansi("UAE afterdos");
afterdos_id = ds_ansi("UAE afterdos 0.1");
ROM_filesys_diagentry = here ();
calltrap (deftrap2 (filesys_diagentry, 0, _T("filesys_diagentry")));
@ -8798,6 +8873,7 @@ void filesys_install_code (void)
EXPANSION_bootcode = bootrom_start + bootrom_header + items * 4 - 4;
b = bootrom_start + bootrom_header + 3 * 4 - 4;
filesys_initcode = bootrom_start + dlg (b) + bootrom_header - 4;
afterdos_initcode = filesys_get_entry(8);
}
#ifdef _WIN32

File diff suppressed because it is too large Load Diff

View File

@ -1149,6 +1149,11 @@ static int checkbounds (struct hardfiledata *hfd, uae_u64 offset, uae_u64 len)
return 1;
}
static bool is_writeprotected(struct hardfiledata *hfd)
{
return hfd->ci.readonly || hfd->dangerous || currprefs.harddrive_read_only;
}
static int nodisk (struct hardfiledata *hfd)
{
if (hfd->drive_empty)
@ -1395,7 +1400,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
// do nothing
if (nodisk (hfd))
goto nodisk;
if (hfd->ci.readonly || hfd->dangerous)
if (is_writeprotected(hfd))
goto readprot;
scsi_len = 0;
break;
@ -1442,7 +1447,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
case 0x0a: /* WRITE (6) */
if (nodisk (hfd))
goto nodisk;
if (hfd->ci.readonly || hfd->dangerous)
if (is_writeprotected(hfd))
goto readprot;
offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf);
if (offset == ~0)
@ -1485,7 +1490,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
totalsize = 8 - 2;
alen = (cmdbuf[7] << 8) | cmdbuf[8];
p[2] = 0;
p[3] = (hfd->ci.readonly || hfd->dangerous) ? 0x80 : 0x00;
p[3] = is_writeprotected(hfd) ? 0x80 : 0x00;
p[4] = 0;
p[5] = 0;
p[6] = 0;
@ -1495,7 +1500,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
totalsize = 4 - 1;
alen = cmdbuf[4];
p[1] = 0;
p[2] = (hfd->ci.readonly || hfd->dangerous) ? 0x80 : 0x00;
p[2] = is_writeprotected(hfd) ? 0x80 : 0x00;
p[3] = 0;
p += 4;
}
@ -1640,7 +1645,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
case 0x2a: /* WRITE (10) */
if (nodisk (hfd))
goto nodisk;
if (hfd->ci.readonly || hfd->dangerous)
if (is_writeprotected(hfd))
goto readprot;
offset = rl (cmdbuf + 2);
offset *= hfd->ci.blocksize;
@ -1697,7 +1702,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
case 0xaa: /* WRITE (12) */
if (nodisk (hfd))
goto nodisk;
if (hfd->ci.readonly || hfd->dangerous)
if (is_writeprotected(hfd))
goto readprot;
offset = rl (cmdbuf + 2);
offset *= hfd->ci.blocksize;
@ -2006,7 +2011,7 @@ static int start_thread (TrapContext *ctx, int unit)
return 1;
memset (hfpd, 0, sizeof (struct hardfileprivdata));
hfpd->base = trap_get_areg(ctx, 6);
init_comm_pipe (&hfpd->requests, 100, 1);
init_comm_pipe (&hfpd->requests, 300, 3);
uae_sem_init (&hfpd->sync_sem, 0, 0);
uae_start_thread (_T("hardfile"), hardfile_thread, hfpd, NULL);
uae_sem_wait (&hfpd->sync_sem);
@ -2070,8 +2075,11 @@ static uae_u32 REGPARAM2 hardfile_close (TrapContext *ctx)
return 0;
scsi_free(hfpd->sd);
trap_put_word(ctx, hfpd->base + 32, trap_get_word(ctx, hfpd->base + 32) - 1);
if (trap_get_word(ctx, hfpd->base + 32) == 0)
if (trap_get_word(ctx, hfpd->base + 32) == 0) {
write_comm_pipe_pvoid(&hfpd->requests, NULL, 0);
write_comm_pipe_pvoid(&hfpd->requests, NULL, 0);
write_comm_pipe_u32(&hfpd->requests, 0, 1);
}
return 0;
}
@ -2152,7 +2160,7 @@ static uae_u32 hardfile_do_io (TrapContext *ctx, struct hardfiledata *hfd, struc
case CMD_FORMAT: /* Format */
if (nodisk (hfd))
goto no_disk;
if (hfd->ci.readonly || hfd->dangerous) {
if (is_writeprotected(hfd)) {
error = 28; /* write protect */
} else {
offset = get_long_host(iobuf + 44);
@ -2179,7 +2187,7 @@ static uae_u32 hardfile_do_io (TrapContext *ctx, struct hardfiledata *hfd, struc
case NSCMD_TD_FORMAT64:
if (nodisk (hfd))
goto no_disk;
if (hfd->ci.readonly || hfd->dangerous) {
if (is_writeprotected(hfd)) {
error = 28; /* write protect */
} else {
offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32);
@ -2242,7 +2250,7 @@ static uae_u32 hardfile_do_io (TrapContext *ctx, struct hardfiledata *hfd, struc
break;
case CMD_PROTSTATUS:
if (hfd->ci.readonly || hfd->dangerous)
if (is_writeprotected(hfd))
actual = -1;
else
actual = 0;

View File

@ -11,14 +11,17 @@
#include "uae/types.h"
#define AFTERDOS_INIT_PRI ((-121) & 0xff)
#define AFTERDOS_PRI ((-122) & 0xff)
#define RTAREA_DEFAULT 0xf00000
#define RTAREA_BACKUP 0xef0000
#define RTAREA_BACKUP_2 0xdb0000
#define RTAREA_SIZE 0x10000
#define RTAREA_TRAPS 0x3000
#define RTAREA_RTG 0x3800
#define RTAREA_TRAMPOLINE 0x3b00
#define RTAREA_RTG 0x3600
#define RTAREA_TRAMPOLINE 0x3900
#define RTAREA_DATAREGION 0xF000
#define RTAREA_FSBOARD 0xFFEC
@ -35,18 +38,20 @@
#define RTAREA_TRAP_DATA_EXTRA 144
#define RTAREA_TRAP_DATA_EXTRA_SIZE (RTAREA_TRAP_DATA_SLOT_SIZE - RTAREA_TRAP_DATA_EXTRA)
#define RTAREA_TRAP_SEND_DATA 0xc0000
#define RTAREA_TRAP_SEND_DATA_SIZE 0x2000
#define RTAREA_TRAP_STATUS 0xF000
#define RTAREA_TRAP_STATUS_SIZE 8
#define RTAREA_TRAP_STATUS_SECOND 4
#define RTAREA_TRAP_SEND_STATUS 0xF100
#define RTAREA_SYSBASE 0x3FFC
#define RTAREA_GFXBASE 0x3FF8
#define RTAREA_INTBASE 0x3FF4
#define RTAREA_INTXY 0x3FF0
#define RTAREA_TRAP_DATA_NUM (RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE)
#define RTAREA_TRAP_DATA_SEND_NUM 1
#define RTAREA_TRAP_SEND_STATUS (RTAREA_TRAP_STATUS + RTAREA_TRAP_STATUS_SIZE * RTAREA_TRAP_DATA_NUM)
#define RTAREA_TRAP_SEND_DATA (RTAREA_TRAP_DATA + RTAREA_TRAP_DATA_SLOT_SIZE * RTAREA_TRAP_DATA_NUM)
extern uae_u32 addr (int);
extern void db (uae_u8);

View File

@ -91,7 +91,8 @@ struct device_info {
struct amigascsi
{
uae_u8 *data;
uae_u8 *data_h;
uaecptr data_a;
uae_s32 len;
uae_u8 cmd[16];
uae_s32 cmd_len;
@ -178,7 +179,7 @@ int sys_command_cd_rawread (int unitnum, uae_u8 *data, int sector, int size, int
extern int sys_command_read (int unitnum, uae_u8 *data, int block, int size);
extern int sys_command_write (int unitnum, uae_u8 *data, int block, int size);
extern int sys_command_scsi_direct_native (int unitnum, int type, struct amigascsi *as);
extern int sys_command_scsi_direct (int unitnum, int type, uaecptr request);
extern int sys_command_scsi_direct(TrapContext *ctx, int unitnum, int type, uaecptr request);
extern int sys_command_ismedia (int unitnum, int quick);
extern struct device_info *sys_command_info_session (int unitnum, struct device_info *di, int, int);
extern bool blkdev_get_info (struct uae_prefs *p, int unitnum, struct device_info *di);

View File

@ -133,10 +133,10 @@ struct UAEBSDBase {
#define FDCB_ALLOC 1
#define FDCB_CHECK 2
uae_u32 addstr (uae_u32 * dst, const TCHAR *src);
uae_u32 addstr_ansi (uae_u32 * dst, const uae_char *src);
uae_u32 strncpyha (uae_u32 dst, const uae_char *src, int size);
uae_u32 addmem (uae_u32 * dst, const uae_char *src, int len);
uae_u32 addstr(TrapContext *ctx, uae_u32 * dst, const TCHAR *src);
uae_u32 addstr_ansi(TrapContext *ctx, uae_u32 * dst, const uae_char *src);
uae_u32 strncpyha(TrapContext *ctx, uae_u32 dst, const uae_char *src, int size);
uae_u32 addmem(TrapContext *ctx, uae_u32 * dst, const uae_char *src, int len);
#define SB struct socketbase *sb

View File

@ -3,12 +3,12 @@
#include "uae/types.h"
extern int amiga_clipboard_want_data (void);
extern void amiga_clipboard_got_data (uaecptr data, uae_u32 size, uae_u32 actual);
extern void amiga_clipboard_die (void);
extern void amiga_clipboard_init (void);
extern uaecptr amiga_clipboard_proc_start (void);
extern void amiga_clipboard_task_start (uaecptr);
extern int amiga_clipboard_want_data(TrapContext *ctx);
extern void amiga_clipboard_got_data(TrapContext *ctx, uaecptr data, uae_u32 size, uae_u32 actual);
extern void amiga_clipboard_die(TrapContext *ctx);
extern void amiga_clipboard_init(TrapContext *ctx);
extern uaecptr amiga_clipboard_proc_start(TrapContext *ctx);
extern void amiga_clipboard_task_start(TrapContext *ctx, uaecptr);
extern void clipboard_disable(bool);
extern void clipboard_vsync(void);

View File

@ -57,9 +57,7 @@ STATIC_INLINE void destroy_comm_pipe (smp_comm_pipe *p)
STATIC_INLINE void maybe_wake_reader (smp_comm_pipe *p, int no_buffer)
{
if (p->reader_waiting
&& (no_buffer || ((p->wrp - p->rdp + p->size) % p->size) >= p->chunks))
{
if (p->reader_waiting && (no_buffer || ((p->wrp - p->rdp + p->size) % p->size) >= p->chunks)) {
p->reader_waiting = 0;
uae_sem_post (&p->reader_wait);
}

View File

@ -4,8 +4,8 @@
#include "uae/types.h"
int consolehook_activate(void);
void consolehook_ret (uaecptr condev, uaecptr oldbeginio);
uaecptr consolehook_beginio (uaecptr request);
void consolehook_ret(TrapContext *ctx, uaecptr condev, uaecptr oldbeginio);
uaecptr consolehook_beginio(TrapContext *ctx, uaecptr request);
void consolehook_config(struct uae_prefs *p);
#endif /* UAE_CONSOLEHOOK_H */

View File

@ -427,7 +427,7 @@ struct uae_prefs {
int gfx_max_horizontal, gfx_max_vertical;
int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma, gfx_gamma_ch[3];
bool gfx_blackerthanblack;
bool gfx_threebitcolors;
int gfx_threebitcolors;
int gfx_api;
int color_mode;
int gfx_extrawidth;
@ -627,6 +627,7 @@ struct uae_prefs {
int nr_floppies;
struct floppyslot floppyslots[4];
bool floppy_read_only;
bool harddrive_read_only;
TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
int dfxclickvolume_disk[4];
int dfxclickvolume_empty[4];

View File

@ -96,29 +96,36 @@ void trap_set_background(TrapContext *ctx);
void trap_background_set_complete(TrapContext *ctx);
bool trap_valid_address(TrapContext *ctx, uaecptr addr, uae_u32 size);
bool trap_is_indirect(void);
void trap_dos_active(void);
void trap_reset(void);
typedef uae_u32 (*TRAP_CALLBACK)(TrapContext*, void*);
void trap_callback(TRAP_CALLBACK, void*);
uae_u32 trap_get_dreg(TrapContext *context, int reg);
uae_u32 trap_get_areg(TrapContext *context, int reg);
void trap_set_dreg(TrapContext *context, int reg, uae_u32 v);
void trap_set_areg(TrapContext *context, int reg, uae_u32 v);
TrapContext *alloc_host_main_trap_context(void);
void free_host_trap_context(TrapContext*);
void trap_put_long(TrapContext *context, uaecptr addr, uae_u32 v);
void trap_put_word(TrapContext *context, uaecptr addr, uae_u16 v);
void trap_put_byte(TrapContext *context, uaecptr addr, uae_u8 v);
uae_u32 trap_get_dreg(TrapContext *ctx, int reg);
uae_u32 trap_get_areg(TrapContext *ctx, int reg);
void trap_set_dreg(TrapContext *ctx, int reg, uae_u32 v);
void trap_set_areg(TrapContext *ctx, int reg, uae_u32 v);
uae_u32 trap_get_long(TrapContext *context, uaecptr addr);
uae_u16 trap_get_word(TrapContext *context, uaecptr addr);
uae_u8 trap_get_byte(TrapContext *context, uaecptr addr);
void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v);
void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v);
void trap_put_byte(TrapContext *ctx, uaecptr addr, uae_u8 v);
void trap_put_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt);
void trap_get_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt);
void trap_put_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt);
void trap_get_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt);
void trap_put_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt);
void trap_get_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt);
uae_u32 trap_get_long(TrapContext *ctx, uaecptr addr);
uae_u16 trap_get_word(TrapContext *ctx, uaecptr addr);
uae_u8 trap_get_byte(TrapContext *ctx, uaecptr addr);
int trap_put_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen);
int trap_get_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen);
void trap_put_bytes(TrapContext *ctx, const void *haddrp, uaecptr addr, int cnt);
void trap_get_bytes(TrapContext *ctx, void *haddrp, uaecptr addr, int cnt);
void trap_put_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt);
void trap_get_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt);
void trap_put_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt);
void trap_get_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt);
int trap_put_string(TrapContext *ctx, const void *haddrp, uaecptr addr, int maxlen);
int trap_get_string(TrapContext *ctx, void *haddrp, uaecptr addr, int maxlen);
void trap_set_longs(TrapContext *ctx, uaecptr addr, uae_u32 v, int cnt);
void trap_set_words(TrapContext *ctx, uaecptr addr, uae_u16 v, int cnt);

View File

@ -206,7 +206,7 @@ static int execscsicmd_direct (int unitnum, struct amigascsi *as)
/* the Amiga does not tell us how long the timeout shall be, so make it _very_ long (specified in seconds) */
swb.spt.TimeOutValue = 80 * 60;
scsi_datap = scsi_datap_org = as->len ? as->data : 0;
scsi_datap = scsi_datap_org = as->len ? as->data_h : 0;
swb.spt.DataIn = (as->flags & 1) ? SCSI_IOCTL_DATA_IN : SCSI_IOCTL_DATA_OUT;
for (i = 0; i < as->cmd_len; i++)
swb.spt.Cdb[i] = as->cmd[i];

View File

@ -2113,7 +2113,7 @@ uae_u32 host_Inet_NtoA(TrapContext *ctx, SB, uae_u32 in)
if ((addr = inet_ntoa(ina)) != NULL) {
scratchbuf = m68k_areg (regs,6) + offsetof(struct UAEBSDBase,scratchbuf);
strncpyha(scratchbuf,addr,SCRATCHBUFSIZE);
strncpyha(ctx, scratchbuf,addr,SCRATCHBUFSIZE);
if (ISBSDTRACE) {
TCHAR *s = au (addr);
BSDTRACE((_T("%s\n"),s));
@ -2519,13 +2519,13 @@ kludge:
put_long (sb->hostent + 16, sb->hostent + 24 + numaliases * 4);
for (i = 0; i < numaliases; i++)
put_long (sb->hostent + 20 + i * 4, addstr_ansi (&aptr, h->h_aliases[i]));
put_long (sb->hostent + 20 + i * 4, addstr_ansi(ctx, &aptr, h->h_aliases[i]));
put_long (sb->hostent + 20 + numaliases * 4, 0);
for (i = 0; i < numaddr; i++)
put_long (sb->hostent + 24 + (numaliases + i) * 4, addmem (&aptr, h->h_addr_list[i], h->h_length));
put_long (sb->hostent + 24 + (numaliases + i) * 4, addmem(ctx, &aptr, h->h_addr_list[i], h->h_length));
put_long (sb->hostent + 24 + numaliases * 4 + numaddr * 4, 0);
put_long (sb->hostent, aptr);
addstr_ansi (&aptr, h->h_name);
addstr_ansi(ctx, &aptr, h->h_name);
if (ISBSDTRACE) {
TCHAR *s = au (h->h_name);
@ -2616,10 +2616,10 @@ void host_getprotobyname(TrapContext *ctx, SB, uae_u32 name)
put_long (sb->protoent+8,p->p_proto);
for (i = 0; i < numaliases; i++)
put_long (sb->protoent + 12 + i * 4, addstr_ansi (&aptr, p->p_aliases[i]));
put_long (sb->protoent + 12 + i * 4, addstr_ansi(ctx, &aptr, p->p_aliases[i]));
put_long (sb->protoent + 12 + numaliases * 4,0);
put_long (sb->protoent, aptr);
addstr_ansi (&aptr, p->p_name);
addstr_ansi(ctx, &aptr, p->p_name);
if (ISBSDTRACE) {
TCHAR *s = au (p->p_name);
BSDTRACE((_T("OK (%s, %d):%d\n"), s, p->p_proto, argsp->wscnt));
@ -2713,12 +2713,12 @@ void host_getservbynameport(TrapContext *ctx, SB, uae_u32 nameport, uae_u32 prot
put_long (sb->servent + 8, (unsigned short)htons(s->s_port));
for (i = 0; i < numaliases; i++)
put_long (sb->servent + 16 + i * 4,addstr_ansi (&aptr,s->s_aliases[i]));
put_long (sb->servent + 16 + i * 4,addstr_ansi(ctx, &aptr,s->s_aliases[i]));
put_long (sb->servent + 16 + numaliases * 4,0);
put_long (sb->servent, aptr);
addstr_ansi (&aptr, s->s_name);
addstr_ansi(ctx, &aptr, s->s_name);
put_long (sb->servent + 12, aptr);
addstr_ansi (&aptr, s->s_proto);
addstr_ansi(ctx, &aptr, s->s_proto);
if (ISBSDTRACE) {
TCHAR *ss = au (s->s_name);

View File

@ -7,6 +7,7 @@
#include <windows.h>
#include "traps.h"
#include "clipboard_win32.h"
#include "clipboard.h"
@ -31,7 +32,7 @@ static void *clipboard_delayed_data;
static int clipboard_delayed_size;
static bool clip_disabled;
static void debugwrite (const TCHAR *name, uae_u8 *p, int size)
static void debugwrite (TrapContext *ctx, const TCHAR *name, uaecptr p, int size)
{
FILE *f;
int cnt;
@ -50,27 +51,42 @@ static void debugwrite (const TCHAR *name, uae_u8 *p, int size)
}
f = _tfopen (tmp, _T("wb"));
if (f) {
fwrite (p, size, 1, f);
uae_u8 *pd = xmalloc(uae_u8, size);
trap_get_bytes(ctx, pd, p, size);
fwrite (pd, size, 1, f);
fclose (f);
xfree(pd);
}
return;
}
}
static void to_amiga_start (void)
static uae_u32 to_amiga_start_cb(TrapContext *ctx, void *ud)
{
if (!initialized)
return;
if (!clipboard_data || get_long (clipboard_data) != 0)
return;
if (trap_get_long(ctx, clipboard_data) != 0)
return 0;
if (clipboard_debug) {
debugwrite (_T("clipboard_p2a"), to_amiga, to_amiga_size);
debugwrite(ctx, _T("clipboard_p2a"), clipboard_data, to_amiga_size);
}
#if DEBUG_CLIP > 0
write_log(_T("clipboard: to_amiga %08x %d\n"), clipboard_data, to_amiga_size);
#endif
put_long (clipboard_data, to_amiga_size);
uae_Signal (get_long (clipboard_data + 8), 1 << 13);
trap_put_long(ctx, clipboard_data, to_amiga_size);
uae_Signal(trap_get_long(ctx, clipboard_data + 8), 1 << 13);
return 1;
}
static void to_amiga_start(TrapContext *ctx)
{
if (!initialized)
return;
if (!clipboard_data)
return;
if (!ctx) {
trap_callback(to_amiga_start_cb, NULL);
} else {
to_amiga_start_cb(ctx, NULL);
}
}
static uae_char *pctoamiga (const uae_char *txt)
@ -143,7 +159,7 @@ static TCHAR *amigatopc (const char *txt)
}
static void to_iff_text (const TCHAR *pctxt)
static void to_iff_text(TrapContext *ctx, const TCHAR *pctxt)
{
uae_u8 b[] = { 'F','O','R','M',0,0,0,0,'F','T','X','T','C','H','R','S',0,0,0,0 };
uae_u32 size;
@ -169,15 +185,15 @@ static void to_iff_text (const TCHAR *pctxt)
to_amiga = xcalloc (uae_u8, to_amiga_size);
memcpy (to_amiga, b, sizeof b);
memcpy (to_amiga + sizeof b, txt, txtlen);
to_amiga_start ();
to_amiga_start(ctx);
xfree (txt);
xfree (s);
}
static int clipboard_put_text (const TCHAR *txt);
static void from_iff_text (uaecptr ftxt, uae_u32 len)
static void from_iff_text(uae_u8 *addr, uae_u32 len)
{
uae_u8 *addr = NULL, *eaddr;
uae_u8 *eaddr;
char *txt = NULL;
int txtsize = 0;
@ -189,9 +205,8 @@ static void from_iff_text (uaecptr ftxt, uae_u32 len)
len = fread(addr, 1, 10000, f);
fclose(f);
}
return;
}
#else
addr = get_real_address (ftxt);
#endif
eaddr = addr + len;
if (memcmp("FTXT", addr + 8, 4))
@ -224,8 +239,7 @@ static void from_iff_text (uaecptr ftxt, uae_u32 len)
xfree(txt);
}
static void to_iff_ilbm (HBITMAP hbmp)
static void to_iff_ilbm(TrapContext *ctx, HBITMAP hbmp)
{
BITMAP bmp;
int bmpw, w, h, bpp, iffbpp, tsize, size, x, y, i;
@ -401,40 +415,48 @@ static void to_iff_ilbm (HBITMAP hbmp)
to_amiga_size = 8 + tsize + (tsize & 1);
to_amiga = iff;
to_amiga_start ();
to_amiga_start (ctx);
xfree (bmp.bmBits);
}
static uae_u8 *iff_decomp (const uae_u8 *addr, int w, int h, int planes)
static uae_u8 *iff_decomp(const uae_u8 *addr, const uae_u8 *eaddr, int w, int h, int planes)
{
int y, i, w2;
uae_u8 *dst;
w2 = (w + 15) & ~15;
dst = xmalloc (uae_u8, w2 * h * planes);
dst = xcalloc (uae_u8, w2 * h * planes);
for (y = 0; y < h * planes; y++) {
uae_u8 *p = dst + w2 * y;
uae_u8 *end = p + w2;
while (p < end) {
if (addr >= eaddr)
return dst;
uae_s8 c = *addr++;
if (c >= 0 && c <= 127) {
uae_u8 cnt = c + 1;
for (i = 0; i < cnt && p < end; i++)
if (addr + cnt > eaddr)
return dst;
for (i = 0; i < cnt && p < end; i++) {
*p++= *addr++;
}
} else if (c <= -1 && c >= -127) {
uae_u8 cnt = -c + 1;
if (addr >= eaddr)
return dst;
uae_u8 v = *addr++;
for (i = 0; i < cnt && p < end; i++)
for (i = 0; i < cnt && p < end; i++) {
*p++= v;
}
}
}
}
return dst;
}
static int clipboard_put_bmp (HBITMAP hbmp);
static void from_iff_ilbm (uaecptr ilbm, uae_u32 len)
static void from_iff_ilbm(uae_u8 *saddr, uae_u32 len)
{
HBITMAP hbm = NULL;
BITMAPINFO *bmih;
@ -450,7 +472,7 @@ static void from_iff_ilbm (uaecptr ilbm, uae_u32 len)
bmsize = 0;
bmptr = NULL;
planes = 0; compr = 0;
addr = get_real_address (ilbm);
addr = saddr;
eaddr = addr + len;
size = (addr[4] << 24) | (addr[5] << 16) | (addr[6] << 8) | (addr[7] << 0);
if (memcmp ("ILBM", addr + 8, 4))
@ -559,7 +581,7 @@ static void from_iff_ilbm (uaecptr ilbm, uae_u32 len)
bmptr = xcalloc (uae_u8, bmpw * h);
if (compr)
addr = caddr = iff_decomp (addr, w, h, planes + (masking == 1 ? 1 : 0));
addr = caddr = iff_decomp(addr, addr + csize, w, h, planes + (masking == 1 ? 1 : 0));
dptr = bmptr;
if (planes <= 8 && !ham) {
@ -659,23 +681,35 @@ static void from_iff_ilbm (uaecptr ilbm, uae_u32 len)
xfree (bmptr);
}
static void from_iff (uaecptr data, uae_u32 len)
static void from_iff(TrapContext *ctx, uaecptr data, uae_u32 len)
{
uae_u8 *addr;
uae_u8 *buf;
if (len < 18)
return;
if (!valid_address (data, len))
if (!trap_valid_address(ctx, data, len))
return;
addr = get_real_address (data);
buf = xmalloc(uae_u8, (len + 3) & ~3);
trap_get_bytes(ctx, buf, data, (len + 3) & ~3);
#if 1
FILE *f = fopen("clipboard.dat", "wb");
if (f) {
fwrite(buf, 1, len, f);
fclose(f);
}
#endif
if (clipboard_debug)
debugwrite (_T("clipboard_a2p"), addr, len);
if (memcmp ("FORM", addr, 4))
return;
if (!memcmp ("FTXT", addr + 8, 4))
from_iff_text (data, len);
if (!memcmp ("ILBM", addr + 8, 4))
from_iff_ilbm (data, len);
debugwrite(ctx, _T("clipboard_a2p"), data, len);
if (!memcmp ("FORM", buf, 4)) {
if (!memcmp ("FTXT", buf + 8, 4))
from_iff_text(buf, len);
if (!memcmp ("ILBM", buf + 8, 4))
from_iff_ilbm(buf, len);
}
xfree(buf);
}
void clipboard_disable (bool disabled)
@ -683,7 +717,7 @@ void clipboard_disable (bool disabled)
clip_disabled = disabled;
}
static void clipboard_read (HWND hwnd)
static void clipboard_read(TrapContext *ctx, HWND hwnd)
{
HGLOBAL hglb;
UINT f;
@ -718,7 +752,7 @@ static void clipboard_read (HWND hwnd)
#if DEBUG_CLIP > 0
write_log (_T("clipboard: CF_UNICODETEXT '%s'\n"), lptstr);
#endif
to_iff_text (lptstr);
to_iff_text(ctx, lptstr);
GlobalUnlock (hglb);
}
}
@ -728,7 +762,7 @@ static void clipboard_read (HWND hwnd)
#if DEBUG_CLIP > 0
write_log (_T("clipboard: CF_BITMAP\n"));
#endif
to_iff_ilbm (hbmp);
to_iff_ilbm(ctx, hbmp);
}
}
CloseClipboard ();
@ -759,7 +793,7 @@ void clipboard_changed (HWND hwnd)
clipboard_change = 1;
return;
}
clipboard_read (hwnd);
clipboard_read(NULL, hwnd);
}
static int clipboard_put_bmp_real (HBITMAP hbmp)
@ -824,54 +858,52 @@ static int clipboard_put_bmp (HBITMAP hbmp)
return 1;
}
void amiga_clipboard_die (void)
void amiga_clipboard_die(TrapContext *ctx)
{
signaling = 0;
write_log (_T("clipboard not initialized\n"));
}
void amiga_clipboard_init (void)
void amiga_clipboard_init(TrapContext *ctx)
{
signaling = 0;
write_log (_T("clipboard initialized\n"));
initialized = 1;
clipboard_read (chwnd);
clipboard_read(ctx, chwnd);
}
void amiga_clipboard_task_start (uaecptr data)
void amiga_clipboard_task_start(TrapContext *ctx, uaecptr data)
{
clipboard_data = data;
signaling = 1;
write_log (_T("clipboard task init: %08x\n"), clipboard_data);
}
uae_u32 amiga_clipboard_proc_start (void)
uae_u32 amiga_clipboard_proc_start(TrapContext *ctx)
{
write_log (_T("clipboard process init: %08x\n"), clipboard_data);
signaling = 1;
return clipboard_data;
}
void amiga_clipboard_got_data (uaecptr data, uae_u32 size, uae_u32 actual)
void amiga_clipboard_got_data(TrapContext *ctx, uaecptr data, uae_u32 size, uae_u32 actual)
{
uae_u8 *addr;
if (!initialized) {
write_log (_T("clipboard: got_data() before initialized!?\n"));
return;
}
addr = get_real_address (data);
#if DEBUG_CLIP > 0
write_log (_T("clipboard: <-amiga, %08x, %08x %d %d\n"), clipboard_data, data, size, actual);
#endif
from_iff (data, actual);
from_iff(ctx, data, actual);
}
int amiga_clipboard_want_data (void)
int amiga_clipboard_want_data(TrapContext *ctx)
{
uae_u32 addr, size;
addr = get_long (clipboard_data + 4);
size = get_long (clipboard_data);
addr = trap_get_long(ctx, clipboard_data + 4);
size = trap_get_long(ctx, clipboard_data);
if (!initialized) {
write_log (_T("clipboard: want_data() before initialized!? (%08x %08x %d)\n"), clipboard_data, addr, size);
to_amiga = NULL;
@ -883,8 +915,7 @@ int amiga_clipboard_want_data (void)
return 0;
}
if (addr && size) {
uae_u8 *raddr = get_real_address (addr);
memcpy (raddr, to_amiga, size);
trap_put_bytes(ctx, to_amiga, addr, size);
}
xfree (to_amiga);
#if DEBUG_CLIP > 0
@ -901,7 +932,7 @@ void clipboard_active (HWND hwnd, int active)
if (!initialized)
return;
if (clipactive && clipboard_change) {
clipboard_read (hwnd);
clipboard_read(NULL, hwnd);
}
if (!clipactive && clipboard_delayed_data) {
if (clipboard_delayed_size < 0) {
@ -915,22 +946,26 @@ void clipboard_active (HWND hwnd, int active)
}
}
void clipboard_vsync (void)
static uae_u32 clipboard_vsync_cb(TrapContext *ctx, void *ud)
{
uaecptr task;
if (!signaling || !clipboard_data)
return;
vdelay--;
if (vdelay > 0)
return;
task = get_long (clipboard_data + 8);
uaecptr task = trap_get_long(ctx, clipboard_data + 8);
if (task && native2amiga_isfree()) {
uae_Signal(task, 1 << 13);
#if DEBUG_CLIP > 0
write_log(_T("clipboard: signal %08x\n"), clipboard_data);
#endif
}
return 0;
}
void clipboard_vsync(void)
{
if (!signaling || !clipboard_data)
return;
vdelay--;
if (vdelay > 0)
return;
trap_callback(clipboard_vsync_cb, NULL);
vdelay = 50;
}

View File

@ -491,7 +491,6 @@
#define IDC_AUTORESOLUTIONVGA 1181
#define IDC_RATE2ENABLE 1182
#define IDC_GRAYSCALE 1183
#define IDC_ATARICOLORFIX 1184
#define IDC_FRAMERATE 1185
#define IDC_XSIZE 1187
#define IDC_YSIZE 1188

View File

@ -192,7 +192,6 @@ BEGIN
CONTROL "Double, fields",IDC_LM_IDOUBLED2,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,264,90,10
CONTROL "Double, fields+",IDC_LM_IDOUBLED3,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,277,90,10
CONTROL "Monochrome video out",IDC_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,167,139,10
CONTROL "Dark palette fix",IDC_ATARICOLORFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,295,129,10
END
IDD_MEMORY DIALOGEX 0, 0, 396, 246
@ -2012,7 +2011,7 @@ BEGIN
IDS_WSTYLE_EXTENDED "Extended"
IDS_MISCLISTITEMS1 "Untrap = middle button\nShow GUI on startup\nUse CTRL-F11 to quit\nDon't show taskbar button\nDon't show notification icon\n"
IDS_MISCLISTITEMS2 "Always on top\nDisable screensaver\nSynchronize clock\nOne second reboot pause\nFaster RTG\nClipboard sharing\nAllow native code\n"
IDS_MISCLISTITEMS3 "Native on-screen display\nRTG on-screen display\nCreate winuaelog.txt log\nLog illegal memory accesses\nBlank unused displays\nStart mouse uncaptured\nStart minimized\nMinimize when focus is lost\n100/120Hz VSync black frame insertion\nMaster floppy write protection\nHide all UAE autoconfig boards\n"
IDS_MISCLISTITEMS3 "Native on-screen display\nRTG on-screen display\nCreate winuaelog.txt log\nLog illegal memory accesses\nBlank unused displays\nStart mouse uncaptured\nStart minimized\nMinimize when focus is lost\n100/120Hz VSync black frame insertion\nMaster floppy write protection\nMaster harddrive write protection\nHide all UAE autoconfig boards\n"
IDS_JOYMODE_WHEELMOUSE "Wheel Mouse"
IDS_NUMSG_KS68030PLUS "The selected system ROM requires a 68030 or higher CPU."
IDS_SELECTTAPE "Select a Tape directory or archive file..."
@ -2031,10 +2030,10 @@ BEGIN
IDS_FILTER_PAL_EXTRA "Brightness\nContrast\nSaturation\nGamma\nScanlines\nBlurriness\nNoise\n"
IDS_FILTER_3D_EXTRA "Point/Bilinear\nScanline opacity\nScanline level\n"
IDS_ALWAYS_ON "Always on"
IDS_DISPLAY_ATTRIBUTES "Brightness\nContrast\nGamma\nGamma [R]\nGamma [G]\nGamma [B]"
IDS_DISPLAY_ATTRIBUTES "Brightness\nContrast\nGamma\nGamma [R]\nGamma [G]\nGamma [B]\nDark palette fix"
IDS_NUMSG_NO_PPC "PPC CPU was started but PPC CPU emulation core plugin was not found. Download available from http://www.winuae.net/"
IDS_NUMSG_UAEBOOTROM_PCC
"PPC native OS booted with UAE boot ROM active. UAE expansions are not hardware emulated and are not PPC compatible. (UAE HD controller, uaescsi.device, uaeserial, bsdsocket and so on..)"
"PPC native OS booted with incompatible UAE boot ROM enabled.\nSelect ROM panel ""New UAE (128k, ROM, Indirect)"" option\nor disable all UAE expansions.\n"
IDS_AUTOSCALE_OVERSCAN_BLANK "Overscan blanking"
END

View File

@ -20,18 +20,18 @@
#define LANG_DLL_FULL_VERSION_MATCH 1
#if WINUAEPUBLICBETA
#define WINUAEBETA _T("2")
#define WINUAEBETA _T("4")
#else
#define WINUAEBETA _T("")
#endif
#define WINUAEDATE MAKEBD(2016, 1, 31)
#define WINUAEDATE MAKEBD(2016, 2, 7)
//#define WINUAEEXTRA _T("AmiKit Preview")
//#define WINUAEEXTRA _T("Amiga Forever Edition")
#ifndef WINUAEEXTRA
#define WINUAEEXTRA _T("OS4_UAE")
#define WINUAEEXTRA _T("")
#endif
#ifndef WINUAEREV
#define WINUAEREV _T("")
@ -163,6 +163,9 @@ extern int screenshot_prepare (void);
extern int screenshot_prepare (int);
extern void screenshot_free (void);
extern void rawinput_release(void);
extern void rawinput_alloc(void);
struct winuae_lang
{
WORD id;

View File

@ -4056,6 +4056,7 @@ static const struct miscentry misclist[] = {
{ 0, 1, _T("Minimize when focus is lost"), &workprefs.win32_minimize_inactive },
{ 0, 1, _T("100/120Hz VSync black frame insertion"), &workprefs.lightboost_strobo },
{ 0, 0, _T("Master floppy write protection"), &workprefs.floppy_read_only },
{ 0, 0, _T("Master harddrive write protection"), &workprefs.harddrive_read_only },
{ 0, 0, _T("Hide all UAE autoconfig boards"), &workprefs.uae_hide_autoconfig },
{ 0, 1, _T("Right Control = Right Windows key"), &workprefs.right_control_is_right_win_key },
{ 0, NULL }
@ -6507,10 +6508,13 @@ static int display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d)
return j;
}
static int da_mode_selected;
static int da_mode_selected, da_mode_multiplier;
static int *getp_da (void)
static int *getp_da (HWND hDlg)
{
int vmin = -200;
int vmax = 200;
da_mode_multiplier = 10;
int *p = 0;
switch (da_mode_selected)
{
@ -6532,18 +6536,30 @@ static int *getp_da (void)
case 5:
p = &workprefs.gfx_gamma_ch[2];
break;
case 6:
p = &workprefs.gfx_threebitcolors;
vmin = 0;
vmax = 2;
da_mode_multiplier = 1;
break;
}
if (*p < vmin * da_mode_multiplier)
*p = vmin * da_mode_multiplier;
if (*p > vmax * da_mode_multiplier)
*p = vmax * da_mode_multiplier;
SendDlgItemMessage(hDlg, IDC_DA_SLIDER, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage(hDlg, IDC_DA_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(vmin, vmax));
return p;
}
static void set_da (HWND hDlg)
{
int *p = getp_da ();
int *p = getp_da (hDlg);
if (!p)
return;
TCHAR buf[10];
SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPOS, TRUE, (*p) / 10);
_stprintf(buf, _T("%.1f"), (double)((*p) / 10.0));
SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPOS, TRUE, (*p) / da_mode_multiplier);
_stprintf(buf, _T("%.1f"), (double)((*p) / (double)da_mode_multiplier));
SetDlgItemText (hDlg, IDC_DA_TEXT, buf);
}
@ -6555,6 +6571,7 @@ static void update_da (HWND hDlg)
currprefs.gfx_gamma_ch[2] = workprefs.gfx_gamma_ch[2];
currprefs.gfx_luminance = workprefs.gfx_luminance;
currprefs.gfx_contrast = workprefs.gfx_contrast;
currprefs.gfx_threebitcolors = workprefs.gfx_threebitcolors;
set_da (hDlg);
init_colors ();
init_custom ();
@ -6566,10 +6583,10 @@ static void handle_da (HWND hDlg)
int *p;
int v;
p = getp_da ();
p = getp_da (hDlg);
if (!p)
return;
v = SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_GETPOS, 0, 0) * 10;
v = SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_GETPOS, 0, 0) * da_mode_multiplier;
if (v == *p)
return;
*p = v;
@ -6597,9 +6614,7 @@ void init_da (HWND hDlg)
if (da_mode_selected == CB_ERR)
da_mode_selected = 0;
SendDlgItemMessage (hDlg, IDC_DA_MODE, CB_SETCURSEL, da_mode_selected, 0);
SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETRANGE, TRUE, MAKELONG (-200, 200));
p = getp_da ();
p = getp_da (hDlg);
if (p)
set_da (hDlg);
}
@ -6880,7 +6895,6 @@ static void values_to_displaydlg (HWND hDlg)
CheckDlgButton(hDlg, IDC_LORES_SMOOTHED, workprefs.gfx_lores_mode);
CheckDlgButton(hDlg, IDC_FLICKERFIXER, workprefs.gfx_scandoubler);
CheckDlgButton(hDlg, IDC_GRAYSCALE, workprefs.gfx_grayscale);
CheckDlgButton(hDlg, IDC_ATARICOLORFIX, workprefs.gfx_threebitcolors);
CheckDlgButton (hDlg, IDC_XCENTER, workprefs.gfx_xcenter);
CheckDlgButton (hDlg, IDC_YCENTER, workprefs.gfx_ycenter);
@ -7004,7 +7018,6 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
workprefs.gfx_blackerthanblack = ischecked (hDlg, IDC_BLACKER_THAN_BLACK);
workprefs.gfx_autoresolution_vga = ischecked(hDlg, IDC_AUTORESOLUTIONVGA);
workprefs.gfx_grayscale = ischecked(hDlg, IDC_GRAYSCALE);
workprefs.gfx_threebitcolors = ischecked(hDlg, IDC_ATARICOLORFIX);
int vres = workprefs.gfx_vresolution;
int viscan = workprefs.gfx_iscanlines;
@ -7267,7 +7280,7 @@ static INT_PTR CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (LOWORD (wParam) == IDC_DA_RESET) {
int *p;
da_mode_selected = SendDlgItemMessage (hDlg, IDC_DA_MODE, CB_GETCURSEL, 0, 0);
p = getp_da ();
p = getp_da (hDlg);
if (p)
*p = 0;
init_da (hDlg);

View File

@ -380,6 +380,7 @@
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
<ImageHasSafeExceptionHandlers>
</ImageHasSafeExceptionHandlers>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>../resources/winuae.exe.manifest</AdditionalManifestFiles>
@ -458,6 +459,7 @@
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
<ImageHasSafeExceptionHandlers>
</ImageHasSafeExceptionHandlers>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>../resources/winuae.exe.manifest</AdditionalManifestFiles>
@ -533,6 +535,7 @@
<TargetMachine>MachineX64</TargetMachine>
<LargeAddressAware>true</LargeAddressAware>
<BaseAddress>0x10000000</BaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>..\resources\winuae64.exe.manifest</AdditionalManifestFiles>
@ -605,6 +608,7 @@
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<BaseAddress>0x10000000</BaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>..\resources\winuae64.exe.manifest</AdditionalManifestFiles>
@ -682,6 +686,7 @@
<SetChecksum>true</SetChecksum>
<BaseAddress>
</BaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>../resources/winuae.exe.manifest</AdditionalManifestFiles>
@ -754,6 +759,7 @@
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<BaseAddress>0x10000000</BaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<AdditionalManifestFiles>..\resources\winuae64.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>

View File

@ -1,4 +1,95 @@
Beta 4:
- Default game ports config without default.uae (Mouse + keyboard layout A) was not set. (b3)
- On the fly input device change crash fix. (b3)
- Monochrome mode config file entry added.
- Atari ST dark palette fix moved to Brightness/Contrast/etc select menu and added alternate mode.
- UAE expansion resident structures are now injected to execbase ResList. Now less important expansions are initialized
later. Previously all were initialized during diag init time. Now also uses normal RTF_AFTERDOS resident to start
clipboard sharing instead of ugly hack.
- Simplified rawinput support, also removed rawinput checks, added when long time ago WINE didn't fully support rawinput.
- Added harddrive master write protection checkbox to Misc panel. WARNING: don't use it with hardfiles unless you know
exactly what you are doing.
- UAE Boot ROM with PPC native OS message now asks to enable correct boot ROM mode.
OS4 UAE expansion updates:
- Clipboard sharing is now supported.
- Magic mouse is now supported.
- Virtual mouse driver is now supported.
- uaenative.library converted to new trap system but not tested.
- uaescsi.device initialization converted to new trap system, device will open now without crashing but any CD access
commands will not work (and most likely will also crash strangely).
Still not supported:
- Directory filesystem on the fly insertion/removal, including CDFS CD swaps. Getting this to work will be extremely
complex task. Not sure if it is worth the trouble.
- bsdsocket.library
- uaeahi (Probably not needed, PCI sound card emulation is better choice)
Beta 3:
- When matching config file and on the fly connected game controllers, first check if both id and friendly name match and
only if no match, check id only and finally name only. Some multi slot controller adapters have unique name for each
port but all ports have same ID. (Was id and then name matching previously)
- Remembered input device selections are now forgotten when new config is loaded.
- On the fly unplugged devices are now properly remembered and re-inserted if on the fly reconnected.
- PC Bridge disk drives raw image support (extended adf, ipf and so on.) Standard DOS disks only, no copy protections
or other tricks supported. Read-only, writing is not supported.
- JIT slider now only shows power of 2 cache size values and max is 16384. (Max was already changed in previous betas)
- Linked config files loaded unreliably (or never) due to uninitialized variable.
- Real storage device (harddisk, memory card etc..) failed to open the device if it didn't have device path, only
drive letter.
- CDFS automount didn't mount CDs with empty label, dos does not like empty volume names, replace empty name with "NO_LABEL"
- BPLCON0 BYPASS bit emulated. AGA-only, bypasses palette selection, creates gray scale output. (Microcosm cheat mode effect)
- Added A1000 composite out monochrome output mode emulation when BPLCON0 COLOR bit is zeroed. Option in advanced
chipset panel. Only emulated if no video port display devices enabled, monochrome emulation shares same code (and
in real world it is also not possible, RGB video out is not affected by COLOR bit). Also added always-on monochrome
mode option to Display panel. (Uses HRM documented gray scale brightness = 30% red, 60% green and 10% blue)
- "Atari ST palette fix" added to Display panel, called "Dark palette fix". It is wrong to mention Atari ST in GUI :)
There are few stupid Atari ST ports that use original palette (3 bits/component) = halved brightness in Amiga.
- UAE autoconfig board/boot ROM selection added to ROM panel. Do not touch unless you wan to run OS4 + UAE expansions.
OS4 + UAE expansions: must be set to last option, "New UAE (128k, ROM, Indirect)". (Quickly added to GUI, probably
will change in future versions)
OS4 compatible UAE autoconfig board, boot ROM and communication interface.
Currently supported UAE devices:
- Directory harddrives.
- uaehf.device (UAE HD controller hardfiles)
- uaegfx RTG. (Copy OS3.x uaegfx and uaegfx.info to OS4.x Devs:Monitors)
- uaenet.device
- uae.resource
- uaelib ("uaelib_demux" trap)
Not yet supported (lots more work needed):
- bsdsocket.library (This is the most difficult)
- uaenative.library
- clipboard sharing
- uaescsi.device
- virtual mouse driver
- on the fly directory harddrive changes.
And everything else that was not mentioned.
Notes:
- Slower than normal host<>Amiga communication because every read or write that accesses Amiga memory needs to be
done in Amiga side (due to non-1:1 logical/physical mapping). It will never be as fast as direct communication.
- Remember to set ROM panel UAE expansion type to "New UAE (128k, ROM, Indirect)".
- Directory harddrive (copied from HDF) OS4 installation will boot but it is not recommended, it is slowe
than HDF and there is mysterious issue that causes random read errors. (Missing font requester when booting is the
most common side-effect)
- Most UAE expansions have preliminary updates for indirect trap support and support required multiple major
changes = many things can be strangely broken..
Development speed of OS4 compatible UAE expansion and priority of features mainly depends on donations.
Beta 2:
- Game Ports panel keyboard layouts didn't load from config file. (b1)

View File

@ -1754,8 +1754,11 @@ uaecptr netdev_startup(TrapContext *ctx, uaecptr resaddr)
trap_put_word(ctx, resaddr + 0x0, 0x4AFC);
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
trap_put_word(ctx, resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */
trap_put_word(ctx, resaddr + 0xC, 0x0305); /* NT_DEVICE; pri 05 */
if (kickstart_version >= 37) {
trap_put_long(ctx, resaddr + 0xA, 0x84010300 | AFTERDOS_PRI); /* RTF_AUTOINIT|RTF_AFTERDOS; Version 1; NT_DEVICE; pri */
} else {
trap_put_long(ctx, resaddr + 0xA, 0x81010305); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1; NT_DEVICE; pri 05 */
}
trap_put_long(ctx, resaddr + 0xE, ROM_netdev_resname);
trap_put_long(ctx, resaddr + 0x12, ROM_netdev_resid);
trap_put_long(ctx, resaddr + 0x16, ROM_netdev_init); /* calls netdev_init */

View File

@ -409,7 +409,7 @@ void scsi_emulate_cmd(struct scsi_data *sd)
as.flags &= ~1;
as.sense_len = 32;
as.cmd_len = sd->cmd_len;
as.data = sd->buffer;
as.data_h = sd->buffer;
as.len = sd->direction < 0 ? DEVICE_SCSI_BUFSIZE : sd->data_len;
sys_command_scsi_direct_native(sd->nativescsiunit, -1, &as);
sd->status = as.status;

View File

@ -51,6 +51,7 @@ struct devstruct {
int drivetype;
int iscd;
volatile uaecptr d_request[MAX_ASYNC_REQUESTS];
volatile uae_u8 *d_request_iobuf[MAX_ASYNC_REQUESTS];
volatile int d_request_type[MAX_ASYNC_REQUESTS];
volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS];
struct device_info di;
@ -93,13 +94,13 @@ static struct device_info *devinfo (struct devstruct *devst, struct device_info
return di;
}
static void io_log (const TCHAR *msg, uaecptr request)
static void io_log(const TCHAR *msg, uae_u8 *iobuf, uaecptr request)
{
if (log_scsi)
write_log (_T("%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n"),
msg, request, get_word (request + 28), get_long (request + 40),
get_long (request + 36), get_long (request + 44),
get_long (request + 32), get_byte (request + 31));
msg, request, get_word (request + 28), get_long_host(iobuf + 40),
get_long_host(iobuf + 36), get_long_host(iobuf + 44),
get_long_host(iobuf + 32), get_byte (request + 31));
}
static struct devstruct *getdevstruct (int unit)
@ -112,9 +113,9 @@ static struct devstruct *getdevstruct (int unit)
return 0;
}
static struct priv_devstruct *getpdevstruct (uaecptr request)
static struct priv_devstruct *getpdevstruct(TrapContext *ctx, uaecptr request)
{
int i = get_long (request + 24);
int i = trap_get_long(ctx, request + 24);
if (i < 0 || i >= MAX_OPEN_DEVICES || pdevst[i].inuse == 0) {
write_log (_T("uaescsi.device: corrupt iorequest %08X %d\n"), request, i);
return 0;
@ -139,7 +140,7 @@ static int start_thread (struct devstruct *dev)
{
if (dev->thread_running)
return 1;
init_comm_pipe (&dev->requests, 100, 1);
init_comm_pipe (&dev->requests, 300, 3);
uae_sem_init (&dev->sync_sem, 0, 0);
uae_start_thread (_T("uaescsi"), dev_thread, dev, NULL);
uae_sem_wait (&dev->sync_sem);
@ -153,14 +154,16 @@ static void dev_close_3 (struct devstruct *dev, struct priv_devstruct *pdev)
if (!dev->opencnt) {
sys_command_close (dev->unitnum);
pdev->inuse = 0;
write_comm_pipe_pvoid(&dev->requests, NULL, 0);
write_comm_pipe_pvoid(&dev->requests, NULL, 0);
write_comm_pipe_u32(&dev->requests, 0, 1);
}
}
static uae_u32 REGPARAM2 dev_close_2 (TrapContext *context)
static uae_u32 REGPARAM2 dev_close_2(TrapContext *ctx)
{
uae_u32 request = m68k_areg (regs, 1);
struct priv_devstruct *pdev = getpdevstruct (request);
uae_u32 request = trap_get_areg(ctx, 1);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
struct devstruct *dev;
if (!pdev)
@ -171,8 +174,8 @@ static uae_u32 REGPARAM2 dev_close_2 (TrapContext *context)
if (!dev)
return 0;
dev_close_3 (dev, pdev);
put_long (request + 24, 0);
put_word (m68k_areg (regs, 6) + 32, get_word (m68k_areg (regs, 6) + 32) - 1);
trap_put_long(ctx, request + 24, 0);
trap_put_word(ctx, trap_get_areg(ctx, 6) + 32, trap_get_word(ctx, trap_get_areg(ctx, 6) + 32) - 1);
return 0;
}
@ -185,28 +188,29 @@ static uae_u32 REGPARAM2 diskdev_close (TrapContext *context)
return dev_close_2(context);
}
static int openfail (uaecptr ioreq, int error)
static int openfail(TrapContext *ctx, uaecptr ioreq, int error)
{
put_long (ioreq + 20, -1);
put_byte (ioreq + 31, error);
trap_put_long(ctx, ioreq + 20, -1);
trap_put_byte(ctx, ioreq + 31, error);
return (uae_u32)-1;
}
static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context, int type)
static uae_u32 REGPARAM2 dev_open_2(TrapContext *ctx, int type)
{
uaecptr ioreq = m68k_areg (regs, 1);
uae_u32 unit = m68k_dreg (regs, 0);
uae_u32 flags = m68k_dreg (regs, 1);
uaecptr ioreq = trap_get_areg(ctx, 1);
uae_u32 unit = trap_get_dreg(ctx, 0);
uae_u32 flags = trap_get_dreg(ctx, 1);
struct devstruct *dev = getdevstruct(unit);
struct priv_devstruct *pdev = 0;
int i, v;
if (log_scsi)
write_log (_T("opening %s:%d ioreq=%08X\n"), getdevname (type), unit, ioreq);
if (get_word (ioreq + 0x12) < IOSTDREQ_SIZE && get_word (ioreq + 0x12) > 0)
return openfail (ioreq, IOERR_BADLENGTH);
uae_u16 len = trap_get_word(ctx, ioreq + 0x12);
if (len < IOSTDREQ_SIZE && len > 0)
return openfail(ctx, ioreq, IOERR_BADLENGTH);
if (!dev)
return openfail (ioreq, 32); /* badunitnum */
return openfail(ctx, ioreq, 32); /* badunitnum */
if (!dev->opencnt) {
for (i = 0; i < MAX_OPEN_DEVICES; i++) {
pdev = &pdevst[i];
@ -219,12 +223,12 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context, int type)
v = sys_command_open(dev->unitnum);
}
if (!v)
return openfail (ioreq, IOERR_OPENFAIL);
return openfail(ctx, ioreq, IOERR_OPENFAIL);
pdev->type = type;
pdev->unit = unit;
pdev->flags = flags;
pdev->inuse = 1;
put_long (ioreq + 24, pdev - pdevst);
trap_put_long(ctx, ioreq + 24, pdev - pdevst);
start_thread (dev);
} else {
for (i = 0; i < MAX_OPEN_DEVICES; i++) {
@ -232,31 +236,31 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context, int type)
if (pdev->inuse && pdev->unit == unit) break;
}
if (i == MAX_OPEN_DEVICES)
return openfail (ioreq, IOERR_OPENFAIL);
put_long (ioreq + 24, pdev - pdevst);
return openfail(ctx, ioreq, IOERR_OPENFAIL);
trap_put_long(ctx, ioreq + 24, pdev - pdevst);
}
dev->opencnt++;
put_word (m68k_areg (regs, 6) + 32, get_word (m68k_areg (regs, 6) + 32) + 1);
put_byte (ioreq + 31, 0);
put_byte (ioreq + 8, 7);
trap_put_word(ctx, trap_get_areg(ctx, 6) + 32, trap_get_word(ctx, trap_get_areg(ctx, 6) + 32) + 1);
trap_put_byte(ctx, ioreq + 31, 0);
trap_put_byte(ctx, ioreq + 8, 7);
return 0;
}
static uae_u32 REGPARAM2 dev_open (TrapContext *context)
static uae_u32 REGPARAM2 dev_open(TrapContext *ctx)
{
return dev_open_2 (context, UAEDEV_SCSI_ID);
return dev_open_2(ctx, UAEDEV_SCSI_ID);
}
static uae_u32 REGPARAM2 diskdev_open (TrapContext *context)
static uae_u32 REGPARAM2 diskdev_open (TrapContext *ctx)
{
return dev_open_2 (context, UAEDEV_DISK_ID);
return dev_open_2(ctx, UAEDEV_DISK_ID);
}
static uae_u32 REGPARAM2 dev_expunge (TrapContext *context)
static uae_u32 REGPARAM2 dev_expunge(TrapContext *ctx)
{
return 0;
}
static uae_u32 REGPARAM2 diskdev_expunge (TrapContext *context)
static uae_u32 REGPARAM2 diskdev_expunge(TrapContext *ctx)
{
return 0;
}
@ -265,7 +269,8 @@ static int is_async_request (struct devstruct *dev, uaecptr request)
{
int i = 0;
while (i < MAX_ASYNC_REQUESTS) {
if (dev->d_request[i] == request) return 1;
if (dev->d_request[i] == request)
return 1;
i++;
}
return 0;
@ -365,7 +370,7 @@ int scsi_do_disk_change (int unitnum, int insert, int *pollmode)
return ret;
}
static int add_async_request (struct devstruct *dev, uaecptr request, int type, uae_u32 data)
static int add_async_request(struct devstruct *dev, uae_u8 *iobuf, uaecptr request, int type, uae_u32 data)
{
int i;
@ -383,6 +388,7 @@ static int add_async_request (struct devstruct *dev, uaecptr request, int type,
i = 0;
while (i < MAX_ASYNC_REQUESTS) {
if (dev->d_request[i] == 0) {
dev->d_request_iobuf[i] = iobuf;
dev->d_request[i] = request;
dev->d_request_type[i] = type;
dev->d_request_data[i] = data;
@ -403,6 +409,8 @@ static int release_async_request (struct devstruct *dev, uaecptr request)
if (dev->d_request[i] == request) {
int type = dev->d_request_type[i];
dev->d_request[i] = 0;
xfree((uae_u8*)dev->d_request_iobuf[i]);
dev->d_request_iobuf[i] = 0;
dev->d_request_data[i] = 0;
dev->d_request_type[i] = 0;
return type;
@ -430,7 +438,7 @@ static void abort_async (struct devstruct *dev, uaecptr request, int errcode, in
write_log (_T("asyncronous request=%08X aborted, error=%d\n"), request, errcode);
}
static int command_read (struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
static int command_read(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
{
int blocksize = dev->di.bytespersector;
@ -448,7 +456,7 @@ static int command_read (struct devstruct *dev, uaecptr data, uae_u64 offset, ua
return 0;
}
static int command_write (struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
static int command_write(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
{
uae_u32 blocksize = dev->di.bytespersector;
length /= blocksize;
@ -469,7 +477,7 @@ static int command_write (struct devstruct *dev, uaecptr data, uae_u64 offset, u
return 0;
}
static int command_cd_read (struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
static int command_cd_read(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
{
uae_u32 len, sector, startoffset;
int blocksize;
@ -512,19 +520,19 @@ static int command_cd_read (struct devstruct *dev, uaecptr data, uae_u64 offset,
return 0;
}
static int dev_do_io_other (struct devstruct *dev, uaecptr request)
static int dev_do_io_other(TrapContext *ctx, struct devstruct *dev, uae_u8 *iobuf, uaecptr request)
{
uae_u32 command;
uae_u32 io_data = get_long (request + 40); // 0x28
uae_u32 io_length = get_long (request + 36); // 0x24
uae_u32 io_actual = get_long (request + 32); // 0x20
uae_u32 io_offset = get_long (request + 44); // 0x2c
uae_u32 io_data = get_long_host(iobuf + 40); // 0x28
uae_u32 io_length = get_long_host(iobuf + 36); // 0x24
uae_u32 io_actual = get_long_host(iobuf + 32); // 0x20
uae_u32 io_offset = get_long_host(iobuf + 44); // 0x2c
uae_u32 io_error = 0;
struct priv_devstruct *pdev = getpdevstruct (request);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
if (!pdev)
return 0;
command = get_word (request + 28);
command = get_word_host(iobuf + 28);
if (log_scsi)
write_log (_T("SCSI OTHER %d: DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n"),
@ -543,8 +551,8 @@ static int dev_do_io_other (struct devstruct *dev, uaecptr request)
break;
case HD_SCSICMD:
{
uae_u32 sdd = get_long (request + 40);
io_error = sys_command_scsi_direct (dev->unitnum, dev->drivetype, sdd);
uae_u32 sdd = get_long_host(iobuf + 40);
io_error = sys_command_scsi_direct(ctx, dev->unitnum, dev->drivetype, sdd);
if (log_scsi)
write_log (_T("scsidev other: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31));
}
@ -554,26 +562,26 @@ static int dev_do_io_other (struct devstruct *dev, uaecptr request)
break;
}
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
io_log (_T("dev_io_other"), request);
put_long_host(iobuf + 32, io_actual);
put_byte_host(iobuf + 31, io_error);
io_log (_T("dev_io_other"), iobuf, request);
return 0;
}
static int dev_do_io_tape (struct devstruct *dev, uaecptr request)
static int dev_do_io_tape (TrapContext *ctx, struct devstruct *dev, uae_u8 *iobuf, uaecptr request)
{
uae_u32 command;
uae_u32 io_data = get_long (request + 40); // 0x28
uae_u32 io_length = get_long (request + 36); // 0x24
uae_u32 io_actual = get_long (request + 32); // 0x20
uae_u32 io_offset = get_long (request + 44); // 0x2c
uae_u32 io_data = get_long_host(iobuf + 40); // 0x28
uae_u32 io_length = get_long_host(iobuf + 36); // 0x24
uae_u32 io_actual = get_long_host(iobuf + 32); // 0x20
uae_u32 io_offset = get_long_host(iobuf + 44); // 0x2c
uae_u32 io_error = 0;
struct priv_devstruct *pdev = getpdevstruct (request);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
if (!pdev)
return 0;
command = get_word (request + 28);
command = get_word_host(iobuf + 28);
if (log_scsi)
write_log (_T("TAPE %d: DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n"),
@ -592,8 +600,8 @@ static int dev_do_io_tape (struct devstruct *dev, uaecptr request)
break;
case HD_SCSICMD:
{
uae_u32 sdd = get_long (request + 40);
io_error = sys_command_scsi_direct (dev->unitnum, INQ_SEQD, sdd);
uae_u32 sdd = get_long_host(iobuf + 40);
io_error = sys_command_scsi_direct(ctx, dev->unitnum, INQ_SEQD, sdd);
if (log_scsi)
write_log (_T("scsidev tape: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31));
}
@ -603,28 +611,28 @@ static int dev_do_io_tape (struct devstruct *dev, uaecptr request)
break;
}
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
io_log (_T("dev_io_tape"), request);
put_long_host(iobuf + 32, io_actual);
put_byte_host(iobuf + 31, io_error);
io_log (_T("dev_io_tape"), iobuf, request);
return 0;
}
static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
static int dev_do_io_cd (TrapContext *ctx, struct devstruct *dev, uae_u8 *iobuf, uaecptr request)
{
uae_u32 command;
uae_u32 io_data = get_long (request + 40); // 0x28
uae_u32 io_length = get_long (request + 36); // 0x24
uae_u32 io_actual = get_long (request + 32); // 0x20
uae_u32 io_offset = get_long (request + 44); // 0x2c
uae_u32 io_data = get_long_host(iobuf + 40); // 0x28
uae_u32 io_length = get_long_host(iobuf + 36); // 0x24
uae_u32 io_actual = get_long_host(iobuf + 32); // 0x20
uae_u32 io_offset = get_long_host(iobuf + 44); // 0x2c
uae_u32 io_error = 0;
uae_u64 io_offset64;
int async = 0;
int bmask = dev->di.bytespersector - 1;
struct priv_devstruct *pdev = getpdevstruct (request);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
if (!pdev)
return 0;
command = get_word (request + 28);
command = get_word_host(iobuf + 28);
if (log_scsi)
write_log (_T("CD %d: DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n"),
@ -636,28 +644,28 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
if (dev->di.media_inserted <= 0)
goto no_media;
if (dev->drivetype == INQ_ROMD) {
io_error = command_cd_read (dev, io_data, io_offset, io_length, &io_actual);
io_error = command_cd_read(ctx, dev, io_data, io_offset, io_length, &io_actual);
} else {
if ((io_offset & bmask) || bmask == 0 || io_data == 0)
goto bad_command;
if ((io_length & bmask) || io_length == 0)
goto bad_len;
io_error = command_read (dev, io_data, io_offset, io_length, &io_actual);
io_error = command_read(ctx, dev, io_data, io_offset, io_length, &io_actual);
}
break;
case TD_READ64:
case NSCMD_TD_READ64:
if (dev->di.media_inserted <= 0)
goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
io_offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32);
if ((io_offset64 & bmask) || bmask == 0 || io_data == 0)
goto bad_command;
if ((io_length & bmask) || io_length == 0)
goto bad_len;
if (dev->drivetype == INQ_ROMD)
io_error = command_cd_read (dev, io_data, io_offset64, io_length, &io_actual);
io_error = command_cd_read(ctx, dev, io_data, io_offset64, io_length, &io_actual);
else
io_error = command_read (dev, io_data, io_offset64, io_length, &io_actual);
io_error = command_read(ctx, dev, io_data, io_offset64, io_length, &io_actual);
break;
case CMD_WRITE:
@ -670,14 +678,14 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
} else if ((io_length & bmask) || io_length == 0) {
goto bad_len;
} else {
io_error = command_write (dev, io_data, io_offset, io_length, &io_actual);
io_error = command_write(ctx, dev, io_data, io_offset, io_length, &io_actual);
}
break;
case TD_WRITE64:
case NSCMD_TD_WRITE64:
if (dev->di.media_inserted <= 0)
goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
io_offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32);
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
io_error = 28; /* writeprotect */
} else if ((io_offset64 & bmask) || bmask == 0 || io_data == 0) {
@ -685,7 +693,7 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
} else if ((io_length & bmask) || io_length == 0) {
goto bad_len;
} else {
io_error = command_write (dev, io_data, io_offset64, io_length, &io_actual);
io_error = command_write(ctx, dev, io_data, io_offset64, io_length, &io_actual);
}
break;
@ -699,14 +707,14 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
} else if ((io_length & bmask) || io_length == 0) {
goto bad_len;
} else {
io_error = command_write (dev, io_data, io_offset, io_length, &io_actual);
io_error = command_write(ctx, dev, io_data, io_offset, io_length, &io_actual);
}
break;
case TD_FORMAT64:
case NSCMD_TD_FORMAT64:
if (dev->di.media_inserted <= 0)
goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
io_offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32);
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
io_error = 28; /* writeprotect */
} else if ((io_offset64 & bmask) || bmask == 0 || io_data == 0) {
@ -714,7 +722,7 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
} else if ((io_length & bmask) || io_length == 0) {
goto bad_len;
} else {
io_error = command_write (dev, io_data, io_offset64, io_length, &io_actual);
io_error = command_write(ctx, dev, io_data, io_offset64, io_length, &io_actual);
}
break;
@ -754,24 +762,26 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
case CMD_GETGEOMETRY:
{
struct device_info *di;
uae_u8 geom[30];
di = devinfo (dev, &dev->di);
if (di->media_inserted <= 0)
goto no_media;
put_long (io_data + 0, di->bytespersector);
put_long (io_data + 4, di->sectorspertrack * di->trackspercylinder * di->cylinders);
put_long (io_data + 8, di->cylinders);
put_long (io_data + 12, di->sectorspertrack * di->trackspercylinder);
put_long (io_data + 16, di->trackspercylinder);
put_long (io_data + 20, di->sectorspertrack);
put_long (io_data + 24, 0); /* bufmemtype */
put_byte (io_data + 28, di->type);
put_byte (io_data + 29, di->removable ? 1 : 0); /* flags */
put_long_host(geom + 0, di->bytespersector);
put_long_host(geom + 4, di->sectorspertrack * di->trackspercylinder * di->cylinders);
put_long_host(geom + 8, di->cylinders);
put_long_host(geom + 12, di->sectorspertrack * di->trackspercylinder);
put_long_host(geom + 16, di->trackspercylinder);
put_long_host(geom + 20, di->sectorspertrack);
put_long_host(geom + 24, 0); /* bufmemtype */
put_byte_host(geom + 28, di->type);
put_byte_host(geom + 29, di->removable ? 1 : 0); /* flags */
trap_put_bytes(ctx, geom, io_data, sizeof geom);
io_actual = 30;
}
break;
case CMD_ADDCHANGEINT:
dev->changeint_mediastate = dev->di.media_inserted;
io_error = add_async_request (dev, request, ASYNC_REQUEST_CHANGEINT, io_data);
io_error = add_async_request (dev, iobuf, request, ASYNC_REQUEST_CHANGEINT, io_data);
if (!io_error)
async = 1;
break;
@ -817,7 +827,7 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
}
break;
case CD_ADDFRAMEINT:
io_error = add_async_request (dev, request, ASYNC_REQUEST_FRAMEINT, io_data);
io_error = add_async_request (dev, iobuf, request, ASYNC_REQUEST_FRAMEINT, io_data);
if (!io_error)
async = 1;
break;
@ -961,18 +971,18 @@ static int dev_do_io_cd (struct devstruct *dev, uaecptr request)
case HD_SCSICMD:
{
uae_u32 sdd = get_long (request + 40);
io_error = sys_command_scsi_direct (dev->unitnum, INQ_ROMD, sdd);
uae_u32 sdd = get_long_host(iobuf + 40);
io_error = sys_command_scsi_direct(ctx, dev->unitnum, INQ_ROMD, sdd);
if (log_scsi)
write_log (_T("scsidev cd: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31));
}
break;
case NSCMD_DEVICEQUERY:
put_long (io_data + 0, 0);
put_long (io_data + 4, 16); /* size */
put_word (io_data + 8, NSDEVTYPE_TRACKDISK);
put_word (io_data + 10, 0);
put_long (io_data + 12, nscmd_cmd);
trap_put_long(ctx, io_data + 0, 0);
trap_put_long(ctx, io_data + 4, 16); /* size */
trap_put_word(ctx, io_data + 8, NSDEVTYPE_TRACKDISK);
trap_put_word(ctx, io_data + 10, 0);
trap_put_long(ctx, io_data + 12, nscmd_cmd);
io_actual = 16;
break;
default:
@ -988,20 +998,20 @@ no_media:
io_error = TDERR_DiskChanged;
break;
}
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
io_log (_T("dev_io_cd"), request);
put_long_host(iobuf + 32, io_actual);
put_byte_host(iobuf + 31, io_error);
io_log (_T("dev_io_cd"), iobuf, request);
return async;
}
static int dev_do_io (struct devstruct *dev, uaecptr request)
static int dev_do_io(TrapContext *ctx, struct devstruct *dev, uae_u8 *iobuf, uaecptr request)
{
if (dev->drivetype == INQ_SEQD) {
return dev_do_io_tape (dev, request);
return dev_do_io_tape(ctx, dev, iobuf, request);
} else if (dev->drivetype == INQ_ROMD) {
return dev_do_io_cd (dev, request);
return dev_do_io_cd(ctx, dev, iobuf, request);
} else {
return dev_do_io_other (dev, request);
return dev_do_io_other(ctx, dev, iobuf, request);
}
}
@ -1026,41 +1036,60 @@ static int dev_can_quick (uae_u32 command)
return 0;
}
static int dev_canquick (struct devstruct *dev, uaecptr request)
static int dev_canquick(struct devstruct *dev, uae_u8 *iobuf, uaecptr request)
{
uae_u32 command = get_word (request + 28);
uae_u32 command = get_word_host(iobuf + 28);
return dev_can_quick (command);
}
static uae_u32 REGPARAM2 dev_beginio (TrapContext *context)
static uae_u32 REGPARAM2 dev_beginio(TrapContext *ctx)
{
uae_u32 request = m68k_areg (regs, 1);
uae_u8 flags = get_byte (request + 30);
int command = get_word (request + 28);
struct priv_devstruct *pdev = getpdevstruct (request);
uae_u32 request = trap_get_areg(ctx, 1);
uae_u8 *iobuf = xmalloc(uae_u8, 48);
trap_get_bytes(ctx, iobuf, request, 48);
uae_u8 flags = get_byte_host(iobuf + 30);
int command = get_word_host(iobuf + 28);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
struct devstruct *dev;
int canquick;
put_byte (request + 8, NT_MESSAGE);
put_byte_host(iobuf + 8, NT_MESSAGE);
if (!pdev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
uae_u8 err = 32;
put_byte_host(iobuf + 31, err);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
xfree(iobuf);
return err;
}
dev = getdevstruct (pdev->unit);
if (!dev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
uae_u8 err = 32;
put_byte_host(iobuf + 31, err);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
xfree(iobuf);
return err;
}
put_byte (request + 31, 0);
canquick = dev_canquick (dev, request);
put_byte_host(iobuf + 31, 0);
canquick = dev_canquick (dev, iobuf, request);
if (((flags & 1) && canquick) || (canquick < 0)) {
dev_do_io (dev, request);
dev_do_io(ctx, dev, iobuf, request);
uae_u8 v = get_byte_host(iobuf + 31);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
xfree(iobuf);
if (!(flags & 1))
uae_ReplyMsg (request);
return get_byte (request + 31);
return v;
} else {
add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0);
put_byte (request + 30, get_byte (request + 30) & ~1);
add_async_request (dev, iobuf, request, ASYNC_REQUEST_TEMP, 0);
put_byte_host(iobuf + 30, get_byte_host(iobuf + 30) & ~1);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
trap_set_background(ctx);
write_comm_pipe_pvoid(&dev->requests, ctx, 0);
write_comm_pipe_pvoid(&dev->requests, iobuf, 0);
write_comm_pipe_u32(&dev->requests, request, 1);
return 0;
}
@ -1074,6 +1103,8 @@ static void *dev_thread (void *devs)
dev->thread_running = 1;
uae_sem_post (&dev->sync_sem);
for (;;) {
TrapContext *ctx = (TrapContext*)read_comm_pipe_pvoid_blocking(&dev->requests);
uae_u8 *iobuf = (uae_u8*)read_comm_pipe_pvoid_blocking(&dev->requests);
uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&dev->requests);
uae_sem_wait (&change_sem);
if (!request) {
@ -1081,52 +1112,57 @@ static void *dev_thread (void *devs)
uae_sem_post (&dev->sync_sem);
uae_sem_post (&change_sem);
return 0;
} else if (dev_do_io (dev, request) == 0) {
put_byte (request + 30, get_byte (request + 30) & ~1);
} else if (dev_do_io(ctx, dev, iobuf, request) == 0) {
put_byte_host(iobuf + 30, get_byte_host(iobuf + 30) & ~1);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
release_async_request (dev, request);
uae_ReplyMsg (request);
} else {
if (log_scsi)
write_log (_T("%s:%d async request %08X\n"), getdevname(0), dev->unitnum, request);
trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8);
}
trap_background_set_complete(ctx);
uae_sem_post (&change_sem);
}
return 0;
}
static uae_u32 REGPARAM2 dev_init_2 (TrapContext *context, int type)
static uae_u32 REGPARAM2 dev_init_2(TrapContext *ctx, int type)
{
uae_u32 base = trap_get_dreg (context, 0);
uae_u32 base = trap_get_dreg(ctx, 0);
if (log_scsi)
write_log (_T("%s init\n"), getdevname (type));
return base;
}
static uae_u32 REGPARAM2 dev_init (TrapContext *context)
static uae_u32 REGPARAM2 dev_init(TrapContext *ctx)
{
return dev_init_2 (context, UAEDEV_SCSI_ID);
return dev_init_2(ctx, UAEDEV_SCSI_ID);
}
static uae_u32 REGPARAM2 diskdev_init (TrapContext *context)
static uae_u32 REGPARAM2 diskdev_init(TrapContext *ctx)
{
return dev_init_2 (context, UAEDEV_DISK_ID);
return dev_init_2(ctx, UAEDEV_DISK_ID);
}
static uae_u32 REGPARAM2 dev_abortio (TrapContext *context)
static uae_u32 REGPARAM2 dev_abortio (TrapContext *ctx)
{
uae_u32 request = m68k_areg (regs, 1);
struct priv_devstruct *pdev = getpdevstruct (request);
uae_u32 request = trap_get_areg(ctx, 1);
struct priv_devstruct *pdev = getpdevstruct(ctx, request);
struct devstruct *dev;
if (!pdev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
uae_u8 err = 32;
trap_put_byte(ctx, request + 31, err);
return err;
}
dev = getdevstruct (pdev->unit);
if (!dev) {
put_byte (request + 31, 32);
return get_byte (request + 31);
uae_u8 err = 32;
trap_put_byte(ctx, request + 31, err);
return err;
}
put_byte (request + 31, IOERR_ABORTED);
trap_put_byte(ctx, request + 31, IOERR_ABORTED);
if (log_scsi)
write_log (_T("abortio %s unit=%d, request=%08X\n"), getdevname (pdev->type), pdev->unit, request);
abort_async(dev, request, IOERR_ABORTED, 0);

View File

@ -181,8 +181,11 @@ uaecptr tabletlib_startup(TrapContext *ctx, uaecptr resaddr)
trap_put_word(ctx, resaddr + 0x0, 0x4AFC);
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
trap_put_word(ctx, resaddr + 0xA, 0x8127); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */
trap_put_word(ctx, resaddr + 0xC, 0x0900); /* NT_LIBRARY; pri 00 */
if (kickstart_version >= 37) {
trap_put_long(ctx, resaddr + 0xA, 0x84270900 | AFTERDOS_PRI); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
} else {
trap_put_long(ctx, resaddr + 0xA, 0x81270905); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
}
trap_put_long(ctx, resaddr + 0xE, lib_name);
trap_put_long(ctx, resaddr + 0x12, lib_id);
trap_put_long(ctx, resaddr + 0x16, lib_init);

258
traps.cpp
View File

@ -230,6 +230,8 @@ struct TrapContext
uae_u8 calllib_reg_inuse[16];
int tindex;
int tcnt;
TRAP_CALLBACK callback;
void *callback_ud;
};
static void copytocpucontext(struct TrapCPUContext *cpu)
@ -303,12 +305,13 @@ static void *trap_thread (void *arg)
/* UAE board traps */
#define TRAP_THREADS 4
#define TRAP_THREADS (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM)
static smp_comm_pipe trap_thread_pipe[TRAP_THREADS];
static uae_thread_id trap_thread_id[TRAP_THREADS];
static volatile uae_atomic trap_thread_index;
static volatile int hardware_trap_kill[RTAREA_TRAP_DATA_NUM];
static volatile int hardware_trap_kill[TRAP_THREADS];
static volatile int trap_cnt;
volatile int trap_mode;
static void hardware_trap_ack(TrapContext *ctx)
{
@ -337,6 +340,7 @@ static void *hardware_trap_thread(void *arg)
TrapContext *ctx = (TrapContext*)read_comm_pipe_pvoid_blocking(&trap_thread_pipe[tid]);
if (!ctx)
break;
uae_u8 *data = ctx->host_trap_data;
uae_u8 *status = ctx->host_trap_status;
ctx->tindex = tid;
@ -356,7 +360,13 @@ static void *hardware_trap_thread(void *arg)
write_log(_T("%d: T%d,%d,%08x\n"), ctx->tcnt, tid, trap_num, trap->addr);
#endif
uae_u32 ret = trap->handler(ctx);
uae_u32 ret;
if (ctx->callback) {
ret = ctx->callback(ctx, ctx->callback_ud);
} else {
ret = trap->handler(ctx);
}
if (!ctx->trap_background) {
for (int i = 0; i < 15; i++) {
@ -389,6 +399,11 @@ void trap_background_set_complete(TrapContext *ctx)
}
}
void trap_dos_active(void)
{
trap_mode = 1;
}
void call_hardware_trap(uae_u8 *host_base, uaecptr amiga_base, int slot)
{
TrapContext *ctx = xcalloc(TrapContext, 1);
@ -396,42 +411,38 @@ void call_hardware_trap(uae_u8 *host_base, uaecptr amiga_base, int slot)
ctx->amiga_trap_data = amiga_base + RTAREA_TRAP_DATA + slot * RTAREA_TRAP_DATA_SLOT_SIZE;
ctx->host_trap_status = host_base + RTAREA_TRAP_STATUS + slot * RTAREA_TRAP_STATUS_SIZE;
ctx->amiga_trap_status = amiga_base + RTAREA_TRAP_STATUS + slot * RTAREA_TRAP_STATUS_SIZE;
uae_u32 idx = atomic_inc(&trap_thread_index) & (TRAP_THREADS - 1);
uae_u32 idx = atomic_inc(&trap_thread_index) & (RTAREA_TRAP_DATA_NUM - 1);
write_comm_pipe_pvoid(&trap_thread_pipe[idx], ctx, 1);
}
extern HANDLE hardware_trap_event[];
extern uae_sem_t hardware_trap_event[];
#define MAX_OUTTRAPS 1
static struct TrapContext outtrap[RTAREA_TRAP_DATA_SEND_NUM];
static volatile uae_atomic outtrap_alloc[RTAREA_TRAP_DATA_SEND_NUM];
static struct TrapContext outtrap[MAX_OUTTRAPS];
static volatile uae_atomic outtrap_alloc[MAX_OUTTRAPS];
static uae_u32 call_hardware_trap_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1, uae_u32 p2, uae_u32 p3, uae_u32 p4)
TrapContext *alloc_host_main_trap_context(void)
{
bool sendmode = false;
if (ctx == NULL) {
int slot = 0;
// now this gets even more tricky..
if (atomic_inc(&outtrap_alloc[slot])) {
write_log(_T("already allocated!!\n"));
return 0;
int trap_slot = RTAREA_TRAP_DATA_NUM;
if (atomic_inc(&outtrap_alloc[trap_slot - RTAREA_TRAP_DATA_NUM])) {
while (outtrap_alloc[trap_slot - RTAREA_TRAP_DATA_NUM] > RTAREA_TRAP_DATA_SEND_NUM)
sleep_millis(1);
}
ctx = &outtrap[slot];
ctx->host_trap_data = rtarea_bank.baseaddr + RTAREA_TRAP_SEND_DATA + slot * RTAREA_TRAP_DATA_SLOT_SIZE;
ctx->amiga_trap_data = rtarea_base + RTAREA_TRAP_DATA + slot * RTAREA_TRAP_DATA_SLOT_SIZE;
ctx->host_trap_status = rtarea_bank.baseaddr + RTAREA_TRAP_SEND_STATUS + slot * RTAREA_TRAP_STATUS_SIZE;
ctx->amiga_trap_status = rtarea_base + RTAREA_TRAP_SEND_STATUS + slot * RTAREA_TRAP_STATUS_SIZE;
sendmode = true;
TrapContext *ctx = &outtrap[trap_slot - RTAREA_TRAP_DATA_NUM];
return ctx;
}
void free_host_trap_context(TrapContext *ctx)
{
int trap_slot = RTAREA_TRAP_DATA_NUM;
atomic_dec(&outtrap_alloc[trap_slot]);
}
static uae_u32 call_hardware_trap_back_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1, uae_u32 p2, uae_u32 p3, uae_u32 p4)
{
int trap_slot = ((ctx->amiga_trap_data & 0xffff) - RTAREA_TRAP_DATA) / RTAREA_TRAP_DATA_SLOT_SIZE;
uae_u8 *data = ctx->host_trap_data + RTAREA_TRAP_DATA_SECOND;
uae_u8 *status = ctx->host_trap_status + RTAREA_TRAP_STATUS_SECOND;
int trap_slot = ((ctx->amiga_trap_data & 0xffff) - RTAREA_TRAP_DATA) / RTAREA_TRAP_DATA_SLOT_SIZE;
#if NEW_TRAP_DEBUG
write_log(_T("%d: B%dS%d\n"), ctx->tcnt, cmd, trap_slot);
#endif
@ -450,14 +461,8 @@ static uae_u32 call_hardware_trap_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1
*d = 0xff;
if (sendmode) {
write_log(_T("sendmode!\n"));
} else {
for (;;) {
if (hardware_trap_kill[trap_slot] == 0xff)
if (hardware_trap_kill[trap_slot] < 0)
return 0;
uae_u8 v = *d;
if (v == 0x01 || v == 0x02)
@ -466,15 +471,12 @@ static uae_u32 call_hardware_trap_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1
hardware_trap_kill[trap_slot] = 2;
return 0;
}
// FIXME: OS specific code!
if (WaitForSingleObject(hardware_trap_event[trap_slot], 100) == WAIT_ABANDONED) {
if (uae_sem_trywait_delay(&hardware_trap_event[trap_slot], 100) == -2) {
hardware_trap_kill[trap_slot] = 3;
return 0;
}
}
}
// get result
uae_u32 v = get_long_host(data + 4);
@ -487,6 +489,34 @@ static uae_u32 call_hardware_trap_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1
return v;
}
static uae_u32 call_hardware_trap_back(TrapContext *ctx, uae_u16 cmd, uae_u32 p1, uae_u32 p2, uae_u32 p3, uae_u32 p4)
{
return call_hardware_trap_back_back(ctx, cmd, p1, p2, p3, p4);
}
// Executes trap from C-code
void trap_callback(TRAP_CALLBACK cb, void *ud)
{
if (trap_is_indirect()) {
int trap_slot = RTAREA_TRAP_DATA_NUM;
TrapContext *ctx = xcalloc(TrapContext, 1);
ctx->host_trap_data = rtarea_bank.baseaddr + RTAREA_TRAP_DATA + trap_slot * RTAREA_TRAP_DATA_SLOT_SIZE;
ctx->amiga_trap_data = rtarea_base + RTAREA_TRAP_DATA + trap_slot * RTAREA_TRAP_DATA_SLOT_SIZE;
ctx->host_trap_status = rtarea_bank.baseaddr + RTAREA_TRAP_STATUS + trap_slot * RTAREA_TRAP_STATUS_SIZE;
ctx->amiga_trap_status = rtarea_base + RTAREA_TRAP_STATUS + trap_slot * RTAREA_TRAP_STATUS_SIZE;
// Set status to allocated, we are skipping hwtrap_entry()
put_long_host(ctx->host_trap_status + 4, 0x00000000);
put_long_host(ctx->host_trap_status, 0x00000080);
ctx->callback = cb;
ctx->callback_ud = ud;
write_comm_pipe_pvoid(&trap_thread_pipe[trap_slot], ctx, 1);
} else {
cb(NULL, ud);
}
}
/*
* Set up extended trap context and call handler function
@ -700,7 +730,6 @@ uae_u32 CallFunc(TrapContext *ctx, uaecptr func)
void init_traps(void)
{
trap_count = 0;
hwtrap_waiting = 0;
if (!trap_thread_id[0] && trap_is_indirect()) {
for (int i = 0; i < TRAP_THREADS; i++) {
init_comm_pipe(&trap_thread_pipe[i], 100, 1);
@ -746,6 +775,22 @@ void init_extended_traps (void)
}
void trap_reset(void)
{
trap_mode = 0;
hwtrap_waiting = 0;
}
bool trap_is_indirect(void)
{
return currprefs.uaeboard > 2;
}
static bool trap_is_indirect_null(TrapContext *ctx)
{
return ctx && trap_is_indirect();
}
void trap_call_add_dreg(TrapContext *ctx, int reg, uae_u32 v)
{
ctx->calllib_reg_inuse[reg] = 1;
@ -759,7 +804,7 @@ void trap_call_add_areg(TrapContext *ctx, int reg, uae_u32 v)
uae_u32 trap_call_lib(TrapContext *ctx, uaecptr base, uae_s16 offset)
{
uae_u32 v;
if (ctx && ctx->host_trap_data) {
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
for (int i = 0; i < 16; i++) {
if (ctx->calllib_reg_inuse[i]) {
@ -797,7 +842,7 @@ uae_u32 trap_call_lib(TrapContext *ctx, uaecptr base, uae_s16 offset)
uae_u32 trap_call_func(TrapContext *ctx, uaecptr func)
{
uae_u32 v;
if (ctx && ctx->host_trap_data) {
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
for (int i = 0; i < 16; i++) {
if (ctx->calllib_reg_inuse[i]) {
@ -836,16 +881,13 @@ uae_u32 trap_call_func(TrapContext *ctx, uaecptr func)
void trap_set_background(TrapContext *ctx)
{
if (!ctx)
return;
if (!trap_is_indirect())
return;
ctx->trap_background++;
}
bool trap_is_indirect(void)
{
return currprefs.uaeboard > 2;
}
bool trap_valid_address(TrapContext *ctx, uaecptr addr, uae_u32 size)
{
if (!ctx || currprefs.uaeboard < 3)
@ -856,7 +898,7 @@ bool trap_valid_address(TrapContext *ctx, uaecptr addr, uae_u32 size)
uae_u32 trap_get_dreg(TrapContext *ctx, int reg)
{
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
if (!ctx) {
write_log(_T("trap_get_dreg() without TrapContext!\n"));
return 0;
@ -868,7 +910,7 @@ uae_u32 trap_get_dreg(TrapContext *ctx, int reg)
}
uae_u32 trap_get_areg(TrapContext *ctx, int reg)
{
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
if (!ctx) {
write_log(_T("trap_get_areg() without TrapContext!\n"));
return 0;
@ -880,7 +922,7 @@ uae_u32 trap_get_areg(TrapContext *ctx, int reg)
}
void trap_set_dreg(TrapContext *ctx, int reg, uae_u32 v)
{
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
if (!ctx) {
write_log(_T("trap_set_dreg() without TrapContext!\n"));
return;
@ -892,7 +934,7 @@ void trap_set_dreg(TrapContext *ctx, int reg, uae_u32 v)
}
void trap_set_areg(TrapContext *ctx, int reg, uae_u32 v)
{
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
if (!ctx) {
write_log(_T("trap_set_areg() without TrapContext!\n"));
return;
@ -903,66 +945,66 @@ void trap_set_areg(TrapContext *ctx, int reg, uae_u32 v)
}
}
void trap_put_long(TrapContext *context, uaecptr addr, uae_u32 v)
void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v)
{
if (trap_is_indirect()) {
call_hardware_trap_back(context, TRAPCMD_PUT_LONG, addr, v, 0, 0);
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_PUT_LONG, addr, v, 0, 0);
} else {
put_long(addr, v);
}
}
void trap_put_word(TrapContext *context, uaecptr addr, uae_u16 v)
void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v)
{
if (trap_is_indirect()) {
call_hardware_trap_back(context, TRAPCMD_PUT_WORD, addr, v, 0, 0);
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_PUT_WORD, addr, v, 0, 0);
} else {
put_word(addr, v);
}
}
void trap_put_byte(TrapContext *context, uaecptr addr, uae_u8 v)
void trap_put_byte(TrapContext *ctx, uaecptr addr, uae_u8 v)
{
if (trap_is_indirect()) {
call_hardware_trap_back(context, TRAPCMD_PUT_BYTE, addr, v, 0, 0);
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_PUT_BYTE, addr, v, 0, 0);
} else {
put_byte(addr, v);
}
}
uae_u32 trap_get_long(TrapContext *context, uaecptr addr)
uae_u32 trap_get_long(TrapContext *ctx, uaecptr addr)
{
if (trap_is_indirect()) {
return call_hardware_trap_back(context, TRAPCMD_GET_LONG, addr, 0, 0, 0);
if (trap_is_indirect_null(ctx)) {
return call_hardware_trap_back(ctx, TRAPCMD_GET_LONG, addr, 0, 0, 0);
} else {
return get_long(addr);
}
}
uae_u16 trap_get_word(TrapContext *context, uaecptr addr)
uae_u16 trap_get_word(TrapContext *ctx, uaecptr addr)
{
if (trap_is_indirect()) {
return call_hardware_trap_back(context, TRAPCMD_GET_WORD, addr, 0, 0, 0);
if (trap_is_indirect_null(ctx)) {
return call_hardware_trap_back(ctx, TRAPCMD_GET_WORD, addr, 0, 0, 0);
} else {
return get_word(addr);
}
}
uae_u8 trap_get_byte(TrapContext *context, uaecptr addr)
uae_u8 trap_get_byte(TrapContext *ctx, uaecptr addr)
{
if (trap_is_indirect()) {
return call_hardware_trap_back(context, TRAPCMD_GET_BYTE, addr, 0, 0, 0);
if (trap_is_indirect_null(ctx)) {
return call_hardware_trap_back(ctx, TRAPCMD_GET_BYTE, addr, 0, 0, 0);
} else {
return get_byte(addr);
}
}
void trap_put_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt)
void trap_put_bytes(TrapContext *ctx, const void *haddrp, uaecptr addr, int cnt)
{
if (!cnt)
return;
uae_u8 *haddr = (uae_u8*)haddrp;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE ? RTAREA_TRAP_DATA_EXTRA_SIZE : cnt;
memcpy(context->host_trap_data + RTAREA_TRAP_DATA_EXTRA, haddr, max);
call_hardware_trap_back(context, TRAPCMD_PUT_BYTES, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
memcpy(ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA, haddr, max);
call_hardware_trap_back(ctx, TRAPCMD_PUT_BYTES, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
haddr += max;
addr += max;
cnt -= max;
@ -978,16 +1020,16 @@ void trap_put_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt)
}
}
}
void trap_get_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt)
void trap_get_bytes(TrapContext *ctx, void *haddrp, uaecptr addr, int cnt)
{
if (!cnt)
return;
uae_u8 *haddr = (uae_u8*)haddrp;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE ? RTAREA_TRAP_DATA_EXTRA_SIZE : cnt;
call_hardware_trap_back(context, TRAPCMD_PUT_BYTES, addr, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
memcpy(haddr, context->host_trap_data + RTAREA_TRAP_DATA_EXTRA, max);
call_hardware_trap_back(ctx, TRAPCMD_PUT_BYTES, addr, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
memcpy(haddr, ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA, max);
haddr += max;
addr += max;
cnt -= max;
@ -1003,17 +1045,17 @@ void trap_get_bytes(TrapContext *context, void *haddrp, uaecptr addr, int cnt)
}
}
}
void trap_put_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt)
void trap_put_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u32) ? RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u32) : cnt;
for (int i = 0; i < max; i++) {
put_long_host(context->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u32), *haddr++);
put_long_host(ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u32), *haddr++);
}
call_hardware_trap_back(context, TRAPCMD_PUT_LONGS, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
call_hardware_trap_back(ctx, TRAPCMD_PUT_LONGS, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
addr += max * sizeof(uae_u32);
cnt -= max;
}
@ -1025,16 +1067,16 @@ void trap_put_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt)
}
}
}
void trap_get_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt)
void trap_get_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u32) ? RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u32) : cnt;
call_hardware_trap_back(context, TRAPCMD_GET_LONGS, addr, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
call_hardware_trap_back(ctx, TRAPCMD_GET_LONGS, addr, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
for (int i = 0; i < max; i++) {
*haddr++ = get_long_host(context->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u32));
*haddr++ = get_long_host(ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u32));
}
addr += max * sizeof(uae_u32);
cnt -= max;
@ -1047,17 +1089,17 @@ void trap_get_longs(TrapContext *context, uae_u32 *haddr, uaecptr addr, int cnt)
}
}
}
void trap_put_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt)
void trap_put_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u16) ? RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u16) : cnt;
for (int i = 0; i < max; i++) {
put_word_host(context->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u16), *haddr++);
put_word_host(ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u16), *haddr++);
}
call_hardware_trap_back(context, TRAPCMD_PUT_WORDS, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
call_hardware_trap_back(ctx, TRAPCMD_PUT_WORDS, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, max, 0);
addr += max * sizeof(uae_u16);
cnt -= max;
}
@ -1069,16 +1111,16 @@ void trap_put_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt)
}
}
}
void trap_get_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt)
void trap_get_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
while (cnt > 0) {
int max = cnt > RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u16) ? RTAREA_TRAP_DATA_EXTRA_SIZE / sizeof(uae_u16) : cnt;
call_hardware_trap_back(context, TRAPCMD_GET_WORDS, addr, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
call_hardware_trap_back(ctx, TRAPCMD_GET_WORDS, addr, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, max, 0);
for (int i = 0; i < max; i++) {
*haddr++ = get_word_host(context->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u16));
*haddr++ = get_word_host(ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA + i * sizeof(uae_u16));
}
addr += max * sizeof(uae_u16);
cnt -= max;
@ -1092,12 +1134,12 @@ void trap_get_words(TrapContext *context, uae_u16 *haddr, uaecptr addr, int cnt)
}
}
int trap_put_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen)
int trap_put_string(TrapContext *ctx, const void *haddrp, uaecptr addr, int maxlen)
{
int len = 0;
uae_u8 *haddr = (uae_u8*)haddrp;
if (trap_is_indirect()) {
uae_u8 *p = context->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
for (;;) {
uae_u8 v = *haddr++;
*p++ = v;
@ -1105,7 +1147,7 @@ int trap_put_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen
break;
len++;
}
call_hardware_trap_back(context, TRAPCMD_PUT_STRING, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, maxlen, 0);
call_hardware_trap_back(ctx, TRAPCMD_PUT_STRING, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, addr, maxlen, 0);
} else {
for (;;) {
uae_u8 v = *haddr++;
@ -1118,13 +1160,13 @@ int trap_put_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen
}
return len;
}
int trap_get_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen)
int trap_get_string(TrapContext *ctx, void *haddrp, uaecptr addr, int maxlen)
{
int len = 0;
uae_u8 *haddr = (uae_u8*)haddrp;
if (trap_is_indirect()) {
uae_u8 *p = context->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
call_hardware_trap_back(context, TRAPCMD_GET_STRING, addr, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, maxlen, 0);
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
call_hardware_trap_back(ctx, TRAPCMD_GET_STRING, addr, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, maxlen, 0);
for (;;) {
uae_u8 v = *p++;
*haddr++ = v;
@ -1144,12 +1186,12 @@ int trap_get_string(TrapContext *context, void *haddrp, uaecptr addr, int maxlen
}
return len;
}
int trap_get_bstr(TrapContext *context, uae_u8 *haddr, uaecptr addr, int maxlen)
int trap_get_bstr(TrapContext *ctx, uae_u8 *haddr, uaecptr addr, int maxlen)
{
int len = 0;
if (trap_is_indirect()) {
uae_u8 *p = context->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
call_hardware_trap_back(context, TRAPCMD_GET_BSTR, addr, context->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, maxlen, 0);
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
call_hardware_trap_back(ctx, TRAPCMD_GET_BSTR, addr, ctx->amiga_trap_data + RTAREA_TRAP_DATA_EXTRA, maxlen, 0);
for (;;) {
uae_u8 v = *p++;
*haddr++ = v;
@ -1172,7 +1214,7 @@ void trap_set_longs(TrapContext *ctx, uaecptr addr, uae_u32 v, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_SET_LONGS, addr, v, cnt, 0);
} else {
for (int i = 0; i < cnt; i++) {
@ -1185,7 +1227,7 @@ void trap_set_words(TrapContext *ctx, uaecptr addr, uae_u16 v, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_SET_WORDS, addr, v, cnt, 0);
} else {
for (int i = 0; i < cnt; i++) {
@ -1198,7 +1240,7 @@ void trap_set_bytes(TrapContext *ctx, uaecptr addr, uae_u8 v, int cnt)
{
if (!cnt)
return;
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
call_hardware_trap_back(ctx, TRAPCMD_SET_BYTES, addr, v, cnt, 0);
} else {
for (int i = 0; i < cnt; i++) {
@ -1210,7 +1252,7 @@ void trap_set_bytes(TrapContext *ctx, uaecptr addr, uae_u8 v, int cnt)
void trap_multi(TrapContext *ctx, struct trapmd *data, int items)
{
if (trap_is_indirect()) {
if (trap_is_indirect_null(ctx)) {
uae_u8 *p = ctx->host_trap_data + RTAREA_TRAP_DATA_EXTRA;
for (int i = 0; i < items; i++) {
struct trapmd *md = &data[i];

View File

@ -268,8 +268,10 @@ static uae_u32 open_library (const char *name, uae_u32 min_version)
return handle;
}
uae_u32 uaenative_open_library (TrapContext *context, int flags)
uae_u32 uaenative_open_library (TrapContext *ctx, int flags)
{
char namebuf[256];
if (!currprefs.native_code) {
write_log(_T("uni: tried to open native library, but native code ")
_T("is not enabled\n"));
@ -279,16 +281,17 @@ uae_u32 uaenative_open_library (TrapContext *context, int flags)
uaecptr name;
uae_u32 min_version;
if (flags & UNI_FLAG_COMPAT) {
name = trap_get_areg(context, 0);
name = trap_get_areg(ctx, 0);
min_version = 0;
}
else {
name = trap_get_areg(context, 1);
min_version = trap_get_dreg(context, 0);
name = trap_get_areg(ctx, 1);
min_version = trap_get_dreg(ctx, 0);
}
uae_u32 result = open_library (
(const char *) get_real_address (name), min_version);
trap_get_string(ctx, namebuf, name, sizeof namebuf);
uae_u32 result = open_library(namebuf, min_version);
if ((flags & UNI_FLAG_COMPAT) && !(result & 0x80000000)) {
// error opening library, return 0 for error in compatibility mode
@ -330,8 +333,10 @@ static uae_u32 get_function_handle (uae_u32 handle, const char *name)
return register_handle (library_data, function_address);
}
uae_u32 uaenative_get_function (TrapContext *context, int flags)
uae_u32 uaenative_get_function (TrapContext *ctx, int flags)
{
char namebuf[256];
if (!currprefs.native_code) {
return UNI_ERROR_NOT_ENABLED;
}
@ -342,16 +347,17 @@ uae_u32 uaenative_get_function (TrapContext *context, int flags)
uaecptr name;
uae_u32 library;
if (flags & UNI_FLAG_COMPAT) {
name = trap_get_areg(context, 0);
library = trap_get_dreg(context, 1);
name = trap_get_areg(ctx, 0);
library = trap_get_dreg(ctx, 1);
}
else {
library = trap_get_areg(context, 0);
name = trap_get_areg(context, 1);
library = trap_get_areg(ctx, 0);
name = trap_get_areg(ctx, 1);
}
uae_u32 result = get_function_handle (
library, (const char *) get_real_address (name));
trap_get_string(ctx, namebuf, name, sizeof namebuf);
uae_u32 result = get_function_handle (library, namebuf);
if ((flags & UNI_FLAG_COMPAT) && !(result & 0x80000000)) {
// error getting function, return 0 for error in compatibility mode
@ -406,7 +412,8 @@ static uae_u32 do_call_function_compat_asm (struct uni *uni)
#endif
static void do_call_function (struct uni *uni) {
static void do_call_function (struct uni *uni)
{
printf("uni: calling native function %p\n", uni->native_function);
unsigned long start_time;
@ -552,9 +559,9 @@ uae_u32 uaenative_call_function (TrapContext *ctx, int flags)
uni.task = trap_get_long(ctx, sysbase + 276); // ThisTask
// make sure signal bit is cleared
m68k_dreg (regs, 0) = 0;
m68k_dreg (regs, 1) = 1 << SIGBIT;
CallLib (ctx, sysbase, -0x132); // SetSignal
trap_call_add_dreg(ctx, 0, 0);
trap_call_add_dreg(ctx, 1, 1 << SIGBIT);
trap_call_lib(ctx, sysbase, -0x132); // SetSignal
// start thread if necessary
if (!library_data->thread_id) {
@ -572,8 +579,8 @@ uae_u32 uaenative_call_function (TrapContext *ctx, int flags)
uae_sem_post(&library_data->full_count);
// wait for signal
trap_set_dreg(ctx, 0, 1 << SIGBIT);
CallLib(ctx, sysbase, -0x13e); // Wait
trap_call_add_dreg(ctx, 0, 1 << SIGBIT);
trap_call_lib(ctx, sysbase, -0x13e); // Wait
write_log (_T("uni: -- Got async result --\n"));
}
else {
@ -583,7 +590,7 @@ uae_u32 uaenative_call_function (TrapContext *ctx, int flags)
return uni.result;
}
uae_u32 uaenative_close_library(TrapContext *context, int flags)
uae_u32 uaenative_close_library(TrapContext *ctx, int flags)
{
if (!currprefs.native_code) {
return UNI_ERROR_NOT_ENABLED;
@ -591,10 +598,10 @@ uae_u32 uaenative_close_library(TrapContext *context, int flags)
uae_u32 handle;
if (flags & UNI_FLAG_COMPAT) {
handle = trap_get_dreg(context, 1);
handle = trap_get_dreg(ctx, 1);
}
else {
handle = trap_get_areg(context, 1);
handle = trap_get_areg(ctx, 1);
}
struct library_data *library_data = get_library_data_from_handle (handle);
@ -719,7 +726,7 @@ static uaecptr uae_library_startup (TrapContext *ctx, uaecptr res_addr, struct u
trap_put_long(ctx, res_addr + 0x02, res_addr);
trap_put_long(ctx, res_addr + 0x06, res_addr + 0x1A); // Continue scan here
trap_put_word(ctx, res_addr + 0x0A, 0x8004); // RTF_AUTOINIT, RT_VERSION
trap_put_word(ctx, res_addr + 0x0C, 0x0970); // NT_LIBRARY, RT_PRI
trap_put_word(ctx, res_addr + 0x0C, 0x0905); // NT_LIBRARY, RT_PRI
trap_put_long(ctx, res_addr + 0x0E, library->aptr_name);
trap_put_long(ctx, res_addr + 0x12, library->aptr_id);
trap_put_long(ctx, res_addr + 0x16, library->aptr_init);

View File

@ -74,7 +74,7 @@ uaecptr uaeres_startup (TrapContext *ctx, uaecptr resaddr)
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
trap_put_word(ctx, resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */
trap_put_word(ctx, resaddr + 0xC, 0x0878); /* NT_DEVICE; pri 05 */
trap_put_word(ctx, resaddr + 0xC, 0x0805); /* NT_DEVICE; pri 05 */
trap_put_long(ctx, resaddr + 0xE, res_name);
trap_put_long(ctx, resaddr + 0x12, res_id);
trap_put_long(ctx, resaddr + 0x16, res_init);

View File

@ -705,8 +705,11 @@ uaecptr uaeserialdev_startup(TrapContext *ctx, uaecptr resaddr)
trap_put_word(ctx, resaddr + 0x0, 0x4AFC);
trap_put_long(ctx, resaddr + 0x2, resaddr);
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
trap_put_word(ctx, resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */
trap_put_word(ctx, resaddr + 0xC, 0x0305); /* NT_DEVICE; pri 05 */
if (kickstart_version >= 37) {
trap_put_long(ctx, resaddr + 0xA, 0x84010300 | AFTERDOS_PRI); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
} else {
trap_put_long(ctx, resaddr + 0xA, 0x81010305); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
}
trap_put_long(ctx, resaddr + 0xE, ROM_uaeserialdev_resname);
trap_put_long(ctx, resaddr + 0x12, ROM_uaeserialdev_resid);
trap_put_long(ctx, resaddr + 0x16, ROM_uaeserialdev_init);