initial commit

This commit is contained in:
R-type
2015-12-14 14:00:35 +01:00
commit 5a96c0ca66
377 changed files with 149124 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
ppc-amigaos-objs
Atari800
Atari800.debug
+109
View File
@@ -0,0 +1,109 @@
@DATABASE "Atari800.guide"
@$VER: Atari800.guide 1.0 (23.03.00)
@AUTHOR Sebastian Bauer
@(C) ©2000
@NODE MAIN "Atari800 - Guide"
@SMARTWRAP
@{b}Atari800 1.0 @{AMIGAGUIDE}@{ub}
Note that the @{" guide author's " link CONTACTING} native language is German. So please
forgive any spelling and gramer mistakes. Or better correct them and send them
to @{" me " link CONTACTING}.
@{b}Attention!@{ub} This guide is designed for use with version 40 of the
amigaguide.datatype which is supplied with AmigaOS 3.1. Under other versions
this guide may look @{b}"less than optimal"@{ub}. Note further that if you
are presently running Kickstart 3.0, you may @{b}still@{ub} use Workbench
3.1 with it, including the newer amigaguide.datatype.
@{CODE}
@{" Copyright " link COPYRIGHT} Copyright and disclaimer
@{" Introduction " link INTRO} What does it do ?
@{" Requirements " link REQUIRE} What does it need ?
@{" Installation " link INSTALL} How to install (and remove) ?
@{" Usage " link USAGE} How to use it?
@{" Contacting " link CONTACTING } Where to send bug reports ?
@ENDNODE
@NODE COPYRIGHT "Atari800 - Copyright and disclamer"
@SMARTWRAP
@{b}Copyright@{ub}
Copyright (C) 1995 David Firth. E-Mail: david@signus.demon.co.uk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
@{" GNU General Public License " link COPYING/main}
@ENDNODE
@NODE INTRO "Atari800 - Introduction"
@SMARTWRAP
@{b}Introduction@{ub}
@ENDNODE
@NODE REQUIRE "Atari800 - Requirements"
@SMARTWRAP
@{b}Requirements@{ub}
The Amiga port of the Emulator requires a 68020 processor, OS3.0 and
MUI3.8. For sound support AHI is needed.
It also requires the Atari ROMs.
@ENDNODE
@NODE INSTALL "Atari800 - Installation"
@SMARTWRAP
@{b}How to install Atari800@{ub}
To install Atari800 simply copy the whole Atari800 drawer to the destination of your
choice. The ROM files must be in the copied in the same directory (but this can
be also changed).
@ENDNODE
@NODE USAGE "Atari800 - Usage"
@SMARTWRAP
@{b}Usage@{ub}
Sorry, but not written yet.
@ENDNODE
@NODE CONTACTING "Atari800 - Contacting"
@SMARTWRAP
@{b}Contacting@{ub}
The Amiga port of the Atari800 emulator was created by Sebastian Bauer.
Any comments which are related to the Amiga version should be sent to@{LINE}
@{" sebauer@t-online.de " system "YAM:YAM MAILTO sebauer@t-online.de NOCHECK"} or @{" Sebastian.Bauer@in.stud.tu-ilmenau.de " system "YAM:YAM MAILTO Sebastian.Bauer@in.stud.tu-ilmenau.de NOCHECK"}@{LINE}
The latest version of the emulator can be obtained from my homepage:@{LINE}
@{" http://home.t-online.de/home/sebauer/english.html " system "C:OpenURL http://home.t-online.de/home/sebauer/english.html"}
Also look on the official Atari800 Emulator support page at:
@{" http://cas3.zlin.vutbr.cz/~stehlik/a800.htm " system "C:OpenURL http://cas3.zlin.vutbr.cz/~stehlik/a800.htm"}
@ENDNODE
+6
View File
@@ -0,0 +1,6 @@
#define VERSION 2
#define REVISION 1
#define DATE "30.03.2009"
#define VERS "Atari800 2.1.0"
#define VSTRING "Atari800 2.1.0 (30.03.2009)\r\n"
#define VERSTAG "\0$VER: Atari800 2.1.0 (30.03.2009)"
+18
View File
@@ -0,0 +1,18 @@
VERSION EQU 2
REVISION EQU 4
DATE MACRO
dc.b '31.03.2009'
ENDM
VERS MACRO
dc.b 'Atari800 2.1'
ENDM
VSTRING MACRO
dc.b 'Atari800 2.1 (31.03.2009)',13,10,0
ENDM
VERSTAG MACRO
dc.b 0,'$VER: Atari800 2.1 (31.03.2009)',0
ENDM
+1
View File
@@ -0,0 +1 @@
1
+21
View File
@@ -0,0 +1,21 @@
VERSION = 2
REVISION = 1
.macro DATE
.ascii "31.03.2009"
.endm
.macro VERS
.ascii "Atari800 2.1"
.endm
.macro VSTRING
.ascii "Atari800 2.1 (31.03.2009)"
.byte 13,10,0
.endm
.macro VERSTAG
.byte 0
.ascii "$VER: Atari800 2.1 (31.03.2009)"
.byte 0
.endm
+79
View File
@@ -0,0 +1,79 @@
Short: V2.4 of the Atari 8-bit emulator
Uploader: mail@sebastianbauer.info (Sebastian Bauer)
Author: mail@sebastianbauer.info (Sebastian Bauer), Atari800 Emulator Development Team
Type: misc/emu
Kurz: V2.4 des Atari 8-bit Emulator
Requires: OS4
Version: 2.4
This is the Amiga port of the Atari800 Emulator. It requires at
least OS4 (e.g. the prerelease CD).
Install
~~~~~~~
Extract the archive and copy the resulting Atari800 drawer
anywhere you like. Later, copy the ROM Files into the ROMs
directory. Those ROMs can be extracted from an old XFormer
Archive. See http://atari800.sourceforge.net for details.
From there you find also the information how to obtain the
source code which is released under the GPL.
History
~~~~~~~
Version 2.4 (16.3.2005)
- matches version 1.3.6 of original sources
Version 2.3 (29.12.2004)
- matches version 1.3.4 of original sources
Version 2.2 (8.10.2004)
- the workbench window is now an appwindow. Drop in a file to
boot/run its contents
- tries to start a given workbench argument
- added an iconify option (menu entry and title gadget)
Version 2.1 (24.09.2004)
- major changes within the Amiga front end, including
o) ported to OS4, requires PPC processor
o) dropped MUI GUI, GUI is now menu driven
o) dropped overlay support for now
o) Atari joystick can be mapped to the keyboard
o) sound fixes
- matches 1.3.3 of original sources
Version 1.2 (15.10.2000)
- compiled the latest source
- a special 68060 version has been added
Version 1.1 (12.06.2000)
- console keys and sound should work better now
Version 1.0 (31.05.2000)
- initial public release
How can you reach me?
~~~~~~~~~~~~~~~~~~~~~
My e-mail address is:
mail@sebastianbauer.info
Address:
Sebastian Bauer
Neustädter Str. 50
07768 Kahla
Germany
Visit my homepage at
http://www.sebastianbauer.info/
Here you can find the latest version of the Atari800 emulator for
Amiga but also other things for Amiga, for example SimpleFind3,
SimpleHTML, SimplePac and the Freeciv Port.
Also look at the offical Atari800 Emulator homepage at
http://atari800.sourceforce.net/
__
/ /
__ / / Only Amiga makes it possible...
\ \/ /
\__/
File diff suppressed because it is too large Load Diff
+70
View File
@@ -0,0 +1,70 @@
#ifndef _ATARI_AMIGA_H_
#define _ATARI_AMIGA_H_
LONG InsertROM(LONG CartType);
LONG InsertDisk( LONG Drive );
VOID FreeDisplay(void);
LONG SetupDisplay(void);
VOID Iconify(void);
enum{
MEN_PROJECT=1,
MEN_PROJECT_ABOUT,
MEN_PROJECT_LOADSTATE,
MEN_PROJECT_SAVESTATE,
MEN_PROJECT_LOADBIN,
MEN_PROJECT_ICONIFY,
MEN_PROJECT_QUIT,
MEN_SYSTEM,
MEN_SYSTEM_BOOT,
MEN_SYSTEM_ID,
MEN_SYSTEM_ID1,
MEN_SYSTEM_ID2,
MEN_SYSTEM_ID3,
MEN_SYSTEM_ID4,
MEN_SYSTEM_ID5,
MEN_SYSTEM_ID6,
MEN_SYSTEM_ID7,
MEN_SYSTEM_ID8,
MEN_SYSTEM_ED,
MEN_SYSTEM_ED1,
MEN_SYSTEM_ED2,
MEN_SYSTEM_ED3,
MEN_SYSTEM_ED4,
MEN_SYSTEM_ED5,
MEN_SYSTEM_ED6,
MEN_SYSTEM_ED7,
MEN_SYSTEM_ED8,
MEN_SYSTEM_UI,
MEN_CONSOLE,
MEN_CONSOLE_OPTION,
MEN_CONSOLE_SELECT,
MEN_CONSOLE_START,
MEN_CONSOLE_HELP,
MEN_CONSOLE_BREAK,
MEN_CONSOLE_RESET,
MEN_CONSOLE_COLDSTART,
MEN_SETTINGS,
MEN_SETTINGS_FRAMERATE,
MEN_SETTINGS_CUSTOMSCREEN,
MEN_SETTINGS_WINDOW,
MEN_SETTINGS_SCALABLEWINDOW,
MEN_SETTINGS_SAVE,
MEN_SETTINGS_PORT0_GAMEPORT,
MEN_SETTINGS_PORT0_NUMERICPAD,
MEN_SETTINGS_PORT0_CURSORKEYS,
MEN_SETTINGS_PORT0_UNASSIGNED,
MEN_SETTINGS_PORT1_GAMEPORT,
MEN_SETTINGS_PORT1_NUMERICPAD,
MEN_SETTINGS_PORT1_CURSORKEYS,
MEN_SETTINGS_PORT1_UNASSIGNED,
};
#endif /* _ATARI_AMIGA_H_ */
+133
View File
@@ -0,0 +1,133 @@
; atari_asm.asm - Amiga specific port code
;
; Copyright (c) 2000 Sebastian Bauer
; Copyright (C) 2000-2003 Atari800 development team (see DOC/CREDITS)
;
; This file is part of the Atari800 emulator project which emulates
; the Atari 400, 800, 800XL, 130XE, and 5200 8-bit computers.
;
; Atari800 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; Atari800 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Atari800; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MC68020
XDEF _ScreenData28bit
; a0 - UBYTE *screen
; a1 - UBYTE *destscreendata
; a2 - UBYTE *colortable8
; d0 - UWORD width
; d1 - UWORD height
_ScreenData28bit:
movem.l d2/d7,-(a7)
lsr.w #2,d0
subq.l #1,d1
subq.l #1,d0
moveq #0,d2
; moveq #0,d3
; moveq #0,d4
; moveq #0,d5
.heightloop: move.l d0,d7
.widthloop:
; move.b (a0)+,d2
; move.b (a0)+,d3
; move.b (a0)+,d4
; move.b (a0)+,d5
; move.b (a2,d2),(a1)+
; move.b (a2,d3),(a1)+
; move.b (a2,d4),(a1)+
; move.b (a2,d5),(a1)+
move.b (a0)+,d2
move.b (a2,d2),(a1)+
move.b (a0)+,d2
move.b (a2,d2),(a1)+
move.b (a0)+,d2
move.b (a2,d2),(a1)+
move.b (a0)+,d2
move.b (a2,d2),(a1)+
; moveq #0,d3
; moveq #0,d5
; move.b (a0)+,d2
; move.b (a2,d2),d3
; move.b (a0)+,d2
; lsl.w #8,d3
; move.b (a2,d2),d4
; move.b (a0)+,d2
; or.w d4,d3
; move.b (a2,d2),d5
; swap d3
; move.b (a0)+,d2
; lsl.w #8,d5
; move.b (a2,d2),d3
; or.w d5,d3
; move.l d3,(a1)+
dbra d7,.widthloop
dbra d1,.heightloop
movem.l (a7)+,d2/d7
rts
XDEF _ScreenData215bit
; a0 - UBYTE *screen
; a1 - UWORD *destscreendata
; a2 - UWORD *colortable15
; d0 - UWORD width
; d1 - UWORD height
_ScreenData215bit:
movem.l d2/d3/d7,-(a7)
lsr.l #1,d0
subq.l #1,d1
subq.l #1,d0
moveq #0,d2
.heightloop: move.l d0,d7
.widthloop:
move.b (a0)+,d2
move.w (a2,d2*2),d3
move.b (a0)+,d2
swap d3
move.w (a2,d2*2),d3
move.l d3,(a1)+
dbra d7,.widthloop
dbra d1,.heightloop
movem.l (a7)+,d2/d3/d7
rts
end
+17
View File
@@ -0,0 +1,17 @@
#ifndef _AMIGA_ASM_H_
#define _AMIGA_ASM_H_
ASM void ScreenData28bit( register __a0 UBYTE *screen,
register __a1 UBYTE *tempscreendata,
register __a2 UBYTE *colortable8,
register __d0 ULONG width,
register __d1 ULONG height);
ASM void ScreenData215bit( register __a0 UBYTE *screen,
register __a1 UWORD *,
register __a2 UWORD *colortable15,
register __d0 ULONG width,
register __d1 ULONG height);
#endif /* _AMIGA_ASM_H_ */
+579
View File
@@ -0,0 +1,579 @@
/*
* async.c - async I/O code
*
* Copyright (c) 2000 Sebastian Bauer
* Copyright (c) 2000-2003 Atari800 development team (see DOC/CREDITS)
*
* This file is part of the Atari800 emulator project which emulates
* the Atari 400, 800, 800XL, 130XE, and 5200 8-bit computers.
*
* Atari800 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Atari800 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Atari800; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "async.h"
//-------------------------------------
// AS_OpenAsnycFH
#ifdef ASIO_NOEXTERNALS
AsyncFile*
AS_OpenAsyncFH(
BPTR handle,
OpenModes mode,
LONG bufferSize,
BOOL closeIt,
struct ExecBase *SysBase,
struct DosLibrary *DOSBase )
#else
AsyncFile *
AS_OpenAsyncFH( BPTR handle, OpenModes mode, LONG bufferSize, BOOL closeIt )
#endif
{
struct FileHandle *fh;
AsyncFile *file = NULL;
BPTR lock = NULL;
LONG blockSize, blockSize2;
D_S( struct InfoData, infoData );
if( mode == MODE_READ )
{
if( handle )
{
lock = DupLockFromFH( handle );
}
}
else
{
if( mode == MODE_APPEND )
{
/* in append mode, we open for writing, and then seek to the
* end of the file. That way, the initial write will happen at
* the end of the file, thus extending it
*/
if( handle )
{
if( Seek( handle, 0, OFFSET_END ) < 0 )
{
if( closeIt )
{
Close( handle );
}
handle = NULL;
}
}
}
/* we want a lock on the same device as where the file is. We can't
* use DupLockFromFH() for a write-mode file though. So we get sneaky
* and get a lock on the parent of the file
*/
if( handle )
{
lock = ParentOfFH( handle );
}
}
if( handle )
{
/* if it was possible to obtain a lock on the same device as the
* file we're working on, get the block size of that device and
* round up our buffer size to be a multiple of the block size.
* This maximizes DMA efficiency.
*/
blockSize = 512;
blockSize2 = 1024;
if( lock )
{
if( Info( lock, infoData ) )
{
blockSize = infoData->id_BytesPerBlock;
blockSize2 = blockSize * 2;
bufferSize = ( ( bufferSize + blockSize2 - 1 ) / blockSize2 ) * blockSize2;
}
UnLock(lock);
}
/* now allocate the ASyncFile structure, as well as the read buffers.
* Add 15 bytes to the total size in order to allow for later
* quad-longword alignement of the buffers
*/
for( ;; )
{
if(( file = AllocVec( sizeof( AsyncFile ) + bufferSize + 15, MEMF_PUBLIC | MEMF_ANY ) ))
{
break;
}
else
{
if( bufferSize > blockSize2 )
{
bufferSize -= blockSize2;
}
else
{
break;
}
}
}
if( file )
{
file->af_File = handle;
file->af_ReadMode = ( mode == MODE_READ );
file->af_BlockSize = blockSize;
file->af_CloseFH = closeIt;
/* initialize the ASyncFile structure. We do as much as we can here,
* in order to avoid doing it in more critical sections
*
* Note how the two buffers used are quad-longword aligned. This
* helps performance on 68040 systems with copyback cache. Aligning
* the data avoids a nasty side-effect of the 040 caches on DMA.
* Not aligning the data causes the device driver to have to do
* some magic to avoid the cache problem. This magic will generally
* involve flushing the CPU caches. This is very costly on an 040.
* Aligning things avoids the need for magic, at the cost of at
* most 15 bytes of ram.
*/
fh = BADDR( file->af_File );
file->af_Handler = fh->fh_Type;
file->af_BufferSize = ( ULONG ) bufferSize / 2;
file->af_Buffers[ 0 ] = ( APTR ) ( ( ( ULONG ) file + sizeof( AsyncFile ) + 15 ) & 0xfffffff0 );
file->af_Buffers[ 1 ] = file->af_Buffers[ 0 ] + file->af_BufferSize;
file->af_CurrentBuf = 0;
file->af_SeekOffset = 0;
file->af_PacketPending = FALSE;
file->af_SeekPastEOF = FALSE;
#ifdef ASIO_NOEXTERNALS
file->af_SysBase = SysBase;
file->af_DOSBase = DOSBase;
#endif
/* this is the port used to get the packets we send out back.
* It is initialized to PA_IGNORE, which means that no signal is
* generated when a message comes in to the port. The signal bit
* number is initialized to SIGB_SINGLE, which is the special bit
* that can be used for one-shot signalling. The signal will never
* be set, since the port is of type PA_IGNORE. We'll change the
* type of the port later on to PA_SIGNAL whenever we need to wait
* for a message to come in.
*
* The trick used here avoids the need to allocate an extra signal
* bit for the port. It is quite efficient.
*/
file->af_PacketPort.mp_MsgList.lh_Head = ( struct Node * ) &file->af_PacketPort.mp_MsgList.lh_Tail;
file->af_PacketPort.mp_MsgList.lh_Tail = NULL;
file->af_PacketPort.mp_MsgList.lh_TailPred = ( struct Node * ) &file->af_PacketPort.mp_MsgList.lh_Head;
file->af_PacketPort.mp_Node.ln_Type = NT_MSGPORT;
/* MH: Avoid problems with SnoopDos */
file->af_PacketPort.mp_Node.ln_Name = NULL;
file->af_PacketPort.mp_Flags = PA_IGNORE;
file->af_PacketPort.mp_SigBit = SIGB_SINGLE;
file->af_PacketPort.mp_SigTask = FindTask( NULL );
file->af_Packet.sp_Pkt.dp_Link = &file->af_Packet.sp_Msg;
file->af_Packet.sp_Pkt.dp_Arg1 = fh->fh_Arg1;
file->af_Packet.sp_Pkt.dp_Arg3 = file->af_BufferSize;
file->af_Packet.sp_Pkt.dp_Res1 = 0;
file->af_Packet.sp_Pkt.dp_Res2 = 0;
file->af_Packet.sp_Msg.mn_Node.ln_Name = ( STRPTR ) &file->af_Packet.sp_Pkt;
file->af_Packet.sp_Msg.mn_Node.ln_Type = NT_MESSAGE;
file->af_Packet.sp_Msg.mn_Length = sizeof( struct StandardPacket );
if( mode == MODE_READ )
{
/* if we are in read mode, send out the first read packet to
* the file system. While the application is getting ready to
* read data, the file system will happily fill in this buffer
* with DMA transfers, so that by the time the application
* needs the data, it will be in the buffer waiting
*/
file->af_Packet.sp_Pkt.dp_Type = ACTION_READ;
file->af_BytesLeft = 0;
/* MH: We set the offset to the buffer not being filled, in
* order to avoid special case code in SeekAsync. ReadAsync
* isn't affected by this, since af_BytesLeft == 0.
*/
file->af_Offset = file->af_Buffers[ 1 ];
if( file->af_Handler )
{
AS_SendPacket( file, file->af_Buffers[ 0 ] );
}
}
else
{
file->af_Packet.sp_Pkt.dp_Type = ACTION_WRITE;
file->af_BytesLeft = file->af_BufferSize;
file->af_Offset = file->af_Buffers[ 0 ];
}
}
else
{
if( closeIt )
{
Close( handle );
}
}
}
return( file );
}
//-------------------------------------
// AS_SendPacket
/* send out an async packet to the file system. */
VOID
AS_SendPacket( struct AsyncFile *file, APTR arg2 )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase;
SysBase = file->af_SysBase;
#endif
file->af_Packet.sp_Pkt.dp_Port = &file->af_PacketPort;
file->af_Packet.sp_Pkt.dp_Arg2 = ( LONG ) arg2;
PutMsg( file->af_Handler, &file->af_Packet.sp_Msg );
file->af_PacketPending = TRUE;
}
//-------------------------------------
// AS_WaitPacket
/* this function waits for a packet to come back from the file system. If no
* packet is pending, state from the previous packet is returned. This ensures
* that once an error occurs, it state is maintained for the rest of the life
* of the file handle.
*
* This function also deals with IO errors, bringing up the needed DOS
* requesters to let the user retry an operation or cancel it.
*/
LONG
AS_WaitPacket( AsyncFile *file )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase = file->af_SysBase;
struct DosLibrary *DOSBase = file->af_DOSBase;
#endif
LONG bytes;
if( file->af_PacketPending )
{
while( TRUE )
{
/* This enables signalling when a packet comes back to the port */
file->af_PacketPort.mp_Flags = PA_SIGNAL;
/* Wait for the packet to come back, and remove it from the message
* list. Since we know no other packets can come in to the port, we can
* safely use Remove() instead of GetMsg(). If other packets could come in,
* we would have to use GetMsg(), which correctly arbitrates access in such
* a case
*/
Remove( ( struct Node * ) WaitPort( &file->af_PacketPort ) );
/* set the port type back to PA_IGNORE so we won't be bothered with
* spurious signals
*/
file->af_PacketPort.mp_Flags = PA_IGNORE;
/* mark packet as no longer pending since we removed it */
file->af_PacketPending = FALSE;
bytes = file->af_Packet.sp_Pkt.dp_Res1;
if( bytes >= 0 )
{
/* packet didn't report an error, so bye... */
return( bytes );
}
/* see if the user wants to try again... */
if( ErrorReport( file->af_Packet.sp_Pkt.dp_Res2, REPORT_STREAM, file->af_File, NULL ) )
{
return( -1 );
}
/* user wants to try again, resend the packet */
AS_SendPacket( file,
file->af_Buffers[ file->af_ReadMode ?
file->af_CurrentBuf :
1 - file->af_CurrentBuf ] );
}
}
/* last packet's error code, or 0 if packet was never sent */
SetIoErr( file->af_Packet.sp_Pkt.dp_Res2 );
return( file->af_Packet.sp_Pkt.dp_Res1 );
}
//-------------------------------------
// AS_RequeuePacket( AsyncFile *file )
/* this function puts the packet back on the message list of our
* message port.
*/
VOID
AS_RequeuePacket( AsyncFile *file )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase = file->af_SysBase;
#endif
AddHead( &file->af_PacketPort.mp_MsgList, &file->af_Packet.sp_Msg.mn_Node );
file->af_PacketPending = TRUE;
}
//-------------------------------------
//-------------------------------------
// AsyncFile *OpenAsync()
#ifdef ASIO_NOEXTERNALS
_LIBCALL AsyncFile *
OpenAsync(
_REG( a0 ) const STRPTR fileName,
_REG( d0 ) OpenModes mode,
_REG( d1 ) LONG bufferSize,
_REG( a1 ) struct ExecBase *SysBase,
_REG( a2 ) struct DosLibrary *DOSBase )
#else
_LIBCALL AsyncFile *
OpenAsync(
_REG( a0 ) const STRPTR fileName,
_REG( d0 ) OpenModes mode,
_REG( d1 ) LONG bufferSize )
#endif
{
static const WORD PrivateOpenModes[] =
{
MODE_OLDFILE, MODE_NEWFILE, MODE_READWRITE
};
BPTR handle;
AsyncFile *file = NULL;
if(( handle = Open( fileName, PrivateOpenModes[ mode ] ) ))
{
#ifdef ASIO_NOEXTERNALS
file = AS_OpenAsyncFH( handle, mode, bufferSize, TRUE, SysBase, DOSBase );
#else
file = AS_OpenAsyncFH( handle, mode, bufferSize, TRUE );
#endif
if( !file )
{
Close( handle );
}
}
return( file );
}
//-------------------------------------
// LONG CloseAsync(AsyncFile *file )
_LIBCALL LONG
CloseAsync( _REG( a0 ) AsyncFile *file )
{
LONG result;
if( file )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase = file->af_SysBase;
struct DosLibrary *DOSBase = file->af_DOSBase;
#endif
result = AS_WaitPacket( file );
if( result >= 0 )
{
if( !file->af_ReadMode )
{
/* this will flush out any pending data in the write buffer */
if( file->af_BufferSize > file->af_BytesLeft )
{
result = Write(
file->af_File,
file->af_Buffers[ file->af_CurrentBuf ],
file->af_BufferSize - file->af_BytesLeft );
}
}
}
if( file->af_CloseFH )
{
Close( file->af_File );
}
FreeVec(file);
}
else
{
#ifndef ASIO_NOEXTERNALS
SetIoErr( ERROR_INVALID_LOCK );
#endif
result = -1;
}
return( result );
}
//-------------------------------------
// LONG WriteAsync( AsyncFile *file, APTR buffer, LONG numBytes )
_LIBCALL LONG
WriteAsync( _REG( a0 ) AsyncFile *file, _REG( a1 ) APTR buffer, _REG( d0 ) LONG numBytes )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase = file->af_SysBase;
#endif
LONG totalBytes = 0;
/* this takes care of NIL: */
if( !file->af_Handler )
{
file->af_Offset = file->af_Buffers[ 0 ];
file->af_BytesLeft = file->af_BufferSize;
return( numBytes );
}
while( numBytes > file->af_BytesLeft )
{
if( file->af_BytesLeft )
{
CopyMem( buffer, file->af_Offset, file->af_BytesLeft );
numBytes -= file->af_BytesLeft;
buffer = ( APTR ) ( ( ULONG ) buffer + file->af_BytesLeft );
totalBytes += file->af_BytesLeft;
}
if( AS_WaitPacket( file ) < 0 )
{
return( -1 );
}
/* send the current buffer out to disk */
AS_SendPacket( file, file->af_Buffers[ file->af_CurrentBuf ] );
file->af_CurrentBuf = 1 - file->af_CurrentBuf;
file->af_Offset = file->af_Buffers[ file->af_CurrentBuf ];
file->af_BytesLeft = file->af_BufferSize;
}
CopyMem( buffer, file->af_Offset, numBytes );
file->af_BytesLeft -= numBytes;
file->af_Offset += numBytes;
return ( totalBytes + numBytes );
}
//-------------------------------------
// LONG WriteCharAsync( AsyncFile *file, UBYTE ch )
_CALL LONG
WriteCharAsync( _REG( a0 ) AsyncFile *file, _REG( d0 ) UBYTE ch )
{
if( file->af_BytesLeft )
{
/* if there's any room left in the current buffer, directly write
* the byte into it, updating counters and stuff.
*/
*file->af_Offset = ch;
--file->af_BytesLeft;
++file->af_Offset;
/* one byte written */
return( 1 );
}
/* there was no room in the current buffer, so call the main write
* routine. This will effectively send the current buffer out to disk,
* wait for the other buffer to come back, and then put the byte into
* it.
*/
{
TEXT c;
c = ch; /* SAS/C workaround... */
return( WriteAsync( file, &c, 1 ) );
}
}
//-------------------------------------
// LONG ReadAsync( AsyncFile *file, APTR buffer, LONG numBytes )
_LIBCALL LONG
ReadAsync( _REG( a0 ) AsyncFile *file, _REG( a1 ) APTR buffer, _REG( d0 ) LONG numBytes )
{
#ifdef ASIO_NOEXTERNALS
struct ExecBase *SysBase = file->af_SysBase;
#endif
LONG totalBytes = 0;
LONG bytesArrived;
/* if we need more bytes than there are in the current buffer, enter the
* read loop
*/
while( numBytes > file->af_BytesLeft )
{
/* drain buffer */
CopyMem( file->af_Offset, buffer, file->af_BytesLeft );
numBytes -= file->af_BytesLeft;
buffer = ( APTR ) ( ( ULONG ) buffer + file->af_BytesLeft );
totalBytes += file->af_BytesLeft;
file->af_BytesLeft = 0;
bytesArrived = AS_WaitPacket( file );
if( bytesArrived <= 0 )
{
if( bytesArrived == 0 )
{
return( totalBytes );
}
return( -1 );
}
/* ask that the buffer be filled */
AS_SendPacket( file, file->af_Buffers[ 1 - file->af_CurrentBuf ] );
/* in case we tried to seek past EOF */
if( file->af_SeekOffset > bytesArrived )
{
file->af_SeekOffset = bytesArrived;
}
file->af_Offset = file->af_Buffers[ file->af_CurrentBuf ] + file->af_SeekOffset;
file->af_CurrentBuf = 1 - file->af_CurrentBuf;
file->af_BytesLeft = bytesArrived - file->af_SeekOffset;
file->af_SeekOffset = 0;
}
CopyMem( file->af_Offset, buffer, numBytes );
file->af_BytesLeft -= numBytes;
file->af_Offset += numBytes;
return( totalBytes + numBytes );
}
//-------------------------------------
+87
View File
@@ -0,0 +1,87 @@
#ifndef _ASYNC_H_
#define _ASYNC_H_
#include <exec/types.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <dos/dosextens.h>
#include <clib/asyncio_protos.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <string.h>
/*****************************************************************************/
#ifdef _DCC
#ifdef ASIO_SHARED_LIB
#define _LIBCALL __geta4 _ASM _ARGS
#else
#define _LIBCALL _ASM _ARGS
#endif
#else
#ifdef __GNUC__
#define _LIBCALL
#else
#ifdef __MAXON__
#define _LIBCALL
#else /* __SASC__ */
#ifdef ASIO_SHARED_LIB
#define _LIBCALL __saveds _ASM _ARGS
#else
#define _LIBCALL _ASM _ARGS
#endif
#endif
#endif /* _ GNUC_ */
#endif /* _DCC */
#define _CALL _ASM _ARGS
/*****************************************************************************/
#ifndef ASIO_NOEXTERNALS
extern struct DosLibrary *DOSBase;
extern struct ExecBase *SysBase;
#endif
#ifdef ASIO_SHARED_LIB
extern struct ExecBase *SysBase;
extern struct Library *UtilityBase;
extern struct DosLibrary *DOSBase;
#endif
/*****************************************************************************/
/* this macro lets us long-align structures on the stack */
#define D_S(type,name) char a_##name[ sizeof( type ) + 3 ]; \
type *name = ( type * ) ( ( LONG ) ( a_##name + 3 ) & ~3 );
#ifndef MIN
#define MIN(a,b) ( ( a ) < ( b ) ? ( a ) : ( b ) )
#endif
/*****************************************************************************/
#ifdef ASIO_NOEXTERNALS
AsyncFile *
AS_OpenAsyncFH( BPTR handle, OpenModes mode, LONG bufferSize, BOOL closeIt, struct ExecBase *SysBase, struct DosLibrary *DOSBase );
#else
AsyncFile *
AS_OpenAsyncFH( BPTR handle, OpenModes mode, LONG bufferSize, BOOL closeIt );
#endif
VOID AS_SendPacket( AsyncFile *file, APTR arg2 );
LONG AS_WaitPacket( AsyncFile *file );
VOID AS_RequeuePacket( AsyncFile *file );
VOID AS_RecordSyncFailure( AsyncFile *file );
#endif /* _ASYNC_H_ */
+428
View File
@@ -0,0 +1,428 @@
#ifndef CONFIG_H
#define CONFIG_H
/* Define to use back slash as directory separator. */
#undef BACK_SLASH
/* Target: standard I/O. */
#undef BASIC
/* Define to use buffered debug output. */
#undef BUFFERED_LOG
/* Define to allow sound clipping. */
#undef CLIP_SOUND
/* Define to 1 if the `closedir' function returns void instead of `int'. */
#undef CLOSEDIR_VOID
/* Define to allow console sound (keyboard clicks). */
#define CONSOLE_SOUND 1
/* Define to activate crash menu after CIM instruction. */
#define CRASH_MENU 1
/* Define to disable bitmap graphics emulation in CURSES target. */
#undef CURSES_BASIC
/* Alternate config filename due to 8+3 fs limit. */
#define DEFAULT_CFG_NAME "PROGDIR:Atari800.cfg"
/* Target: Windows with DirectX. */
#undef DIRECTX
/* Target: DOS VGA. */
#undef DOSVGA
/* Define to enable DOS style drives support. */
#undef DOS_DRIVES
/* Target: Atari Falcon system. */
#undef FALCON
/* Define to use m68k assembler CPU core for Falcon target. */
#undef FALCON_CPUASM
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `atexit' function. */
#define HAVE_ATEXIT 1
/* Define to 1 if you have the `chmod' function. */
#define HAVE_CHMOD 1
/* Define to 1 if you have the `clock' function. */
#define HAVE_CLOCK 1
/* Define to 1 if you have the <direct.h> header file. */
#undef HAVE_DIRECT_H
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `fdopen' function. */
#define HAVE_FDOPEN 1
/* Define to 1 if you have the `fflush' function. */
#define HAVE_FFLUSH 1
/* Define to 1 if you have the <file.h> header file. */
#undef HAVE_FILE_H
/* Define to 1 if you have the `floor' function. */
#define HAVE_FLOOR 1
/* Define to 1 if you have the `fstat' function. */
#define HAVE_FSTAT 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `gethostbyaddr' function. */
#undef HAVE_GETHOSTBYADDR
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `png' library (-lpng). */
/*#define HAVE_LIBPNG 1*/
/* Define to 1 if you have the `z' library (-lz). */
/*#define HAVE_LIBZ 1*/
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1
/* Define to 1 if you have the `mktemp' function. */
#define HAVE_MKTEMP 1
/* Define to 1 if you have the `modf' function. */
#define HAVE_MODF 1
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the `opendir' function. */
#define HAVE_OPENDIR 1
/* Define to 1 if you have the `rename' function. */
#define HAVE_RENAME 1
/* Define to 1 if you have the `rewind' function. */
#define HAVE_REWIND 1
/* Define to 1 if you have the `rmdir' function. */
#define HAVE_RMDIR 1
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Define to 1 if you have the `system' function. */
//#define HAVE_SYSTEM 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the `time' function. */
#define HAVE_TIME 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the `tmpfile' function. */
#define HAVE_TMPFILE 1
/* Define to 1 if you have the `tmpnam' function. */
#define HAVE_TMPNAM 1
/* Define to 1 if you have the `uclock' function. */
#define HAVE_UCLOCK 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unixio.h> header file. */
#undef HAVE_UNIXIO_H
/* Define to 1 if you have the `unlink' function. */
#define HAVE_UNLINK 1
/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 1
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* define to enable sound interpolation */
#define INTERPOLATE_SOUND 1
/* Define to use LINUX joystick. */
#undef LINUX_JOYSTICK
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Define to activate assembler in monitor. */
#define MONITOR_ASSEMBLER 1
/* Define to activate BREAK command in monitor. */
#undef MONITOR_BREAK
/* Define to activate user-defined breakpoints. */
#undef MONITOR_BREAKPOINTS
/* Define to activate hints in disassembler. */
#define MONITOR_HINTS 1
/* Target: X11 with Motif. */
#undef MOTIF
/* Define to allow color changes inside a scanline. */
#define NEW_CYCLE_EXACT 1
/* Define to use page-based attribute array. */
#undef PAGED_ATTRIB
/* Target: Sony PlayStation 2. */
#undef PS2
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to use R: device. */
#undef R_IO_DEVICE
/* Target: SDL library. */
#undef SDL
/* Define to the type of arg 1 for `select'. */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for `select'. */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
/* Define to allow serial in/out sound. */
#define SERIO_SOUND 1
/* Target: X11 with shared memory extensions. */
#undef SHM
/* Define to activate sound support. */
#define SOUND 1
#define SOUND_GAIN 2
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to allow stereo sound. */
#define STEREO 1
#define STEREO_SOUND 1
/* Save additional config file options. */
#define SUPPORTS_ATARI_CONFIGSAVE 1
/* Additional config file options. */
#define SUPPORTS_ATARI_CONFIGURE 1
/* Target: Linux with SVGALib. */
#undef SVGALIB
/* Define to use Toshiba Joystick Mouse support. */
#undef SVGA_JOYMOUSE
/* Define for drawing every 1/50 sec only 1/refresh of screen. */
#undef SVGA_SPEEDUP
/* Alternate system-wide config file for non-Unix OS. */
#undef SYSTEM_WIDE_CFG_FILE
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Define to use clock() instead of gettimeofday(). */
#undef USE_CLOCK
/* Target: Curses-compatible library. */
#undef USE_CURSES
/* Define for using cursor/ctrl keys for keyboard joystick. */
#undef USE_CURSORBLOCK
/* Target: Ncurses library. */
#undef USE_NCURSES
/* Define to use very slow computer support (faster -refresh). */
#undef VERY_SLOW
/* Define to allow volume only sound. */
#undef VOL_ONLY_SOUND
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 1
/* Define if unaligned word access is ok. */
#undef WORDS_UNALIGNED_OK
/* Target: Standard X11. */
#undef X11
/* Target: X11 with XView. */
#undef XVIEW
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
#undef inline
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
#undef volatile
#endif
/* Use Signed Samples in POKEY emulation */
#define SIGNED_SAMPLES 1
/* Define two screen arrays used for switching */
#define BITPL_SCR 1
+322
View File
@@ -0,0 +1,322 @@
/*
* amiga.c - Amiga specific port code
*
* Copyright (c) 2000 Sebastian Bauer
* Copyright (c) 2000-2003 Atari800 development team (see DOC/CREDITS)
*
* This file is part of the Atari800 emulator project which emulates
* the Atari 400, 800, 800XL, 130XE, and 5200 8-bit computers.
*
* Atari800 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Atari800 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Atari800; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stdio.h>
#include <exec/types.h>
#define ALL_REACTION_CLASSES
#include <reaction/reaction.h>
#include <reaction/reaction_macros.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include "gui.h"
#include "support.h"
struct Library *WindowBase;
struct Library *LayoutBase;
struct Library *ButtonBase;
struct Library *ListBrowserBase;
struct Library *TextEditorBase;
struct Library *LabelBase;
struct Library *StringBase;
struct Library *ScrollerBase;
struct Library *GetFileBase;
struct Library *ChooserBase;
struct Library *ClickTabBase;
struct Library *CheckBoxBase;
struct Library *GetScreenModeBase;
struct WindowIFace *IWindow;
struct LayoutIFace *ILayout;
struct ButtonIFace *IButton;
struct ListBrowserIFace *IListBrowser;
struct TextEditorIFace *ITextEditor;
struct LabelIFace *ILabel;
struct StringIFace *IString;
struct ScrollerIFace *IScroller;
struct GetFileIFace *IGetFile;
struct ChooserIFace *IChooser;
struct ClickTabIFace *IClickTab;
struct CheckBoxIFace *ICheckBox;
struct GetScreenModeIFace *IGetScreenMode;
#define LIBENTRY(name,version,base,iface) {name,version,(struct Library**)base,(struct Interface**) iface}
static struct
{
STRPTR Name;
ULONG Version;
struct Library **Base;
struct Interface **IFace;
} libraries[] =
{
LIBENTRY("window.class",44,&WindowBase,&IWindow),
LIBENTRY("gadgets/getfile.gadget",44,&GetFileBase, &IGetFile),
LIBENTRY("gadgets/layout.gadget",44,&LayoutBase, &ILayout),
LIBENTRY("gadgets/chooser.gadget",45,&ChooserBase, &IChooser),
LIBENTRY("gadgets/clicktab.gadget",44,&ClickTabBase, &IClickTab),
LIBENTRY("gadgets/button.gadget",44,&ButtonBase,&IButton),
LIBENTRY("gadgets/listbrowser.gadget",44,&ListBrowserBase,&IListBrowser),
LIBENTRY("gadgets/texteditor.gadget",50,&TextEditorBase,&ITextEditor),
LIBENTRY("gadgets/string.gadget",44,&StringBase,&IString),
LIBENTRY("gadgets/scroller.gadget",44,&ScrollerBase,&IScroller),
LIBENTRY("gadgets/checkbox.gadget",44,&CheckBoxBase, &ICheckBox),
LIBENTRY("gadgets/getscreenmode.gadget",44,&GetScreenModeBase, &IGetScreenMode),
LIBENTRY("images/label.image",44,&LabelBase,&ILabel),
};
/****************************************
Close libraries
*****************************************/
static void CloseGUILibs(void)
{
int i;
for (i=0;i<sizeof(libraries)/sizeof(libraries[0]);i++)
{
CloseLibraryInterface(*libraries[i].Base,*libraries[i].IFace);
*libraries[i].Base = NULL;
*libraries[i].IFace = NULL;
}
}
/****************************************
Open needed Libraries
*****************************************/
static int OpenGUILibs(void)
{
int i;
for (i=0;i<sizeof(libraries)/sizeof(libraries[0]);i++)
{
if (!(*libraries[i].Base = OpenLibraryInterface(libraries[i].Name,
libraries[i].Version,
libraries[i].IFace)))
{
printf("Unable to open %s version %ld\n",libraries[i].Name,libraries[i].Version);
goto out;
}
}
return 1;
out:
CloseGUILibs();
return 0;
}
/**********************************************************************
Get Attribute easily
***********************************************************************/
static ULONG xget(Object * obj, ULONG attribute)
{
ULONG x;
IIntuition->GetAttr(attribute, obj, (ULONG*)&x);
return (x);
}
/**********************************************************************
Set attributes of a given object.
Difference to RefreshSetGadgetAttrs() is that the parameters are all
Objects.
***********************************************************************/
void RefreshSetObjectAttrsA(Object *o, Object *wo, struct TagItem *tags)
{
struct Gadget *g = (struct Gadget*)o;
struct Window *w = (struct Window*)xget(wo,WINDOW_Window);
if (!o) return;
IIntuition->RefreshSetGadgetAttrsA(g,w,NULL,tags);
}
void VARARGS68K RefreshSetObjectAttrs(Object *o, Object *wo, ...)
{
ULONG *tags;
va_list args;
va_startlinear(args,wo);
tags = va_getlinearva(args,ULONG*);
RefreshSetObjectAttrsA(o,wo,(struct TagItem *)tags);
va_end(args);
}
/****** GUI ********/
static Object *main_wnd;
static Object *displaytype_chooser;
static Object *screenmode_getscreenmode;
//static Object *bestscreenmode_checkbox;
static int quitting;
enum
{
GID_QUIT = 1,
GID_SAVE,
GID_USE
};
/**********************************************************************
Handle
***********************************************************************/
static int Handle(struct AtariConfig *config)
{
int rc = 0;
ULONG result;
UWORD code;
while ((result = RA_HandleInput(main_wnd, &code) ) != WMHI_LASTMSG )
{
switch (result & WMHI_CLASSMASK)
{
case WMHI_CLOSEWINDOW:
rc = 1;
break;
case WMHI_GADGETUP:
switch (result & WMHI_GADGETMASK)
{
case GID_QUIT: rc = 1; quitting = 1; break;
case GID_SAVE: rc = 1; break;
case GID_USE: rc = 1; break;
}
}
}
return rc;
}
/*******************************
Eventlloop
********************************/
static void Loop(struct AtariConfig *config)
{
int ready = 0;
ULONG mainMask;
while (!ready)
{
ULONG mask;
IIntuition->GetAttr(WINDOW_SigMask, main_wnd, &mainMask);
mask = IExec->Wait(SIGBREAKF_CTRL_C | mainMask);
if (mask & mainMask)
ready = Handle(config);
if (mask & SIGBREAKF_CTRL_C) ready = 1;
}
}
/**********************************************************************
Configure atari
***********************************************************************/
BOOL Configure(struct AtariConfig *config)
{
static char * const tabLabels[] = {"General","Graphics","Sound","Paths",NULL};
static char * const screenTypeLabels[] = {"Custom","Window", "Sizeable Window", NULL};
if (!OpenGUILibs()) goto out;
main_wnd = (Object*)WindowObject,
WA_Title, "Atari800",
WA_Activate, TRUE,
WA_DepthGadget, TRUE,
WA_DragBar, TRUE,
WA_CloseGadget, TRUE,
WA_SizeGadget, TRUE,
WA_IDCMP, IDCMP_INTUITICKS,
// WINDOW_IDCMPHook, &idcmpHook,
WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE,
WINDOW_Position, WPOS_CENTERSCREEN,
WINDOW_ParentGroup, VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_DeferLayout, TRUE,
LAYOUT_AddChild, ClickTabObject,
GA_Text, &tabLabels,
CLICKTAB_PageGroup, PageObject,
PAGE_Add, VGroupObject,
EndGroup,
PAGE_Add, VGroupObject, /* Graphics */
LAYOUT_AddChild, displaytype_chooser = ChooserObject,
CHOOSER_LabelArray, screenTypeLabels,
CHOOSER_Selected, 0,
End,
MemberLabel("Displaytype"),
LAYOUT_AddChild, screenmode_getscreenmode = GetScreenModeObject,
End,
MemberLabel("Screenmode"),
CHILD_WeightedHeight, 0,
LAYOUT_AddChild, CheckBoxObject,
CHECKBOX_Checked, config->UseBestID,
End,
MemberLabel("Use best screen mode"),
EndGroup,
CHILD_WeightedHeight, 0,
PAGE_Add, VGroupObject,
LAYOUT_AddChild, CheckBoxObject,
End,
MemberLabel("Enable Sound"),
EndGroup,
PAGE_Add, VGroupObject, /* Sound */
EndGroup,
End, /* Page */
End, /* Clicktab */
LAYOUT_AddChild, HGroupObject,
LAYOUT_AddChild, Button("Start & Save",GID_SAVE),
LAYOUT_AddChild, Button("Start & Use",GID_USE),
LAYOUT_AddChild, Button("Quit",GID_QUIT),
EndGroup,
CHILD_WeightedHeight, 0,
EndGroup,
EndWindow;
if (!main_wnd) goto out;
RA_OpenWindow(main_wnd);
Loop(config);
IIntuition->DisposeObject(main_wnd);
CloseGUILibs();
return quitting?FALSE:TRUE;
out:
IIntuition->DisposeObject(main_wnd);
CloseGUILibs();
return FALSE;
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef _GUI_H
#define _GUI_H
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
struct AtariConfig
{
/* Amiga */
ULONG DisplayType;
ULONG DisplayID;
BOOL UseBestID;
};
BOOL Configure(struct AtariConfig *config);
#endif
+107
View File
@@ -0,0 +1,107 @@
# If Kickstart isn't defined, we don't run on AmigaOS
ifndef Kickstart
CROSS_COMPILE = ppc-amigaos-
RM = rm -R
MKDIR = mkdir -p
else
RM = delete all
MKDIR = makedir
endif
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
STRIP = $(CROSS_COMPILE)strip
# -------------------------------------------------------------
TARGET = Atari800
VERSION = 2
#CFLAGS = -O3 -I$(AHI_INCLUDE) -I. -I.. -Wall -use-dynld -DSUPPORTS_PLATFORM_CONFIGURE -DSUPPORTS_PLATFORM_CONFIGSAVE
CFLAGS = -O3 -I$(AHI_INCLUDE) -I. -I.. -Wall -DSUPPORTS_PLATFORM_CONFIGURE -DSUPPORTS_PLATFORM_CONFIGSAVE
#LIBS = -lm -lz -lpng -lAuto
LIBS = -lm -lauto
AMIGASRCS=\
amiga.c \
gui.c \
support.c
EMUSRCS= \
afile.c \
antic.c \
artifact.c \
atari.c \
binload.c \
cartridge.c \
cassette.c \
compfile.c \
cfg.c \
colours.c \
colours_external.c \
colours_pal.c \
colours_ntsc.c \
cpu.c \
devices.c \
esc.c \
gtia.c \
log.c \
memory.c \
monitor.c \
pia.c \
pokey.c \
rtime.c \
sio.c \
util.c \
pbi_proto80.c \
input.c \
statesav.c \
ui_basic.c \
ui.c \
screen.c \
cycle_map.c \
pbi_mio.c \
pbi_bb.c \
pbi_scsi.c \
pokeysnd.c \
mzpokeysnd.c \
remez.c \
sndsave.c \
pbi_xld.c \
votrax.c \
votraxsnd.c \
xep80.c \
xep80_fonts.c \
pbi.c
SRCS = $(AMIGASRCS) $(addprefix ../,$(EMUSRCS))
# -------------------------------------------------------------
OBJS = $(SRCS:%.c=ppc-amigaos-objs/amiga/%.o)
AOBJS = $(ASRCS:%.S=ppc-amigaos-objs/amiga/%.o)
all: dirs $(TARGET)
dirs:
-$(MKDIR) ppc-amigaos-objs ppc-amigaos-objs/amiga
# Rules for building
$(TARGET): $(OBJS) $(AOBJS)
$(CC) $(LINK) -o $@.debug $(OBJS) $(AOBJS) $(LIBS)
$(STRIP) -R.comment -o $@ $@.debug
ppc-amigaos-objs/amiga/%.o: %.S
$(CC) -Wa,-mregnames $(AFLAGS) -I$/home/sba/amigaos4/include -c $< -o $@
ppc-amigaos-objs/amiga/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) ppc-amigaos-objs
.PHONY: revision
revision:
bumprev $(VERSION) $(TARGET)
+258
View File
@@ -0,0 +1,258 @@
/*
* support.c - user interface support code
*
* Copyright (c) 2000 Sebastian Bauer
* Copyright (c) 2000-2003 Atari800 development team (see DOC/CREDITS)
*
* This file is part of the Atari800 emulator project which emulates
* the Atari 400, 800, 800XL, 130XE, and 5200 8-bit computers.
*
* Atari800 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Atari800 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Atari800; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define __USE_INLINE__
#define DoSuperMethod IDoSuperMethod
#define DoSuperMethodA IDoSuperMethodA
#define DoMethod IDoMethod
#define DoMethodA IDoMethodA
#include <string.h>
#include <cybergraphx/cybergraphics.h>
#include <libraries/gadtools.h>
#include <clib/alib_protos.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/graphics.h>
#include <proto/cybergraphics.h>
#include <proto/intuition.h>
/**************************************************************************
Some general supports
**************************************************************************/
LONG StrLen( const STRPTR str)
{
if(str) return (LONG)strlen(str);
return 0;
}
STRPTR StrCopy( const STRPTR str )
{
STRPTR dst;
if( !str ) return NULL;
if( !*str) return NULL;
dst = (STRPTR)AllocVec(strlen(str)+1,0);
if(dst) strcpy(dst,str);
return dst;
}
STRPTR GetFullPath( STRPTR drw, STRPTR file)
{
WORD dl = StrLen(drw);
WORD fl = StrLen( file );
LONG length = dl + fl + 6;
STRPTR fp = (STRPTR)AllocVec( length+1, 0 );
if( fp )
{
strcpy( fp, drw );
if( AddPart( fp, file, length )) return fp;
else FreeVec( fp );
}
return NULL;
}
STRPTR AddSuffix(const STRPTR name, const STRPTR suf)
{
STRPTR str;
if(!strstr(name,suf))
{
LONG len = StrLen(name)+StrLen(suf)+2;
str = (STRPTR)AllocVec(len,0);
if(str)
{
strcpy(str,name);
strcat(str,suf);
}
} else str = StrCopy(name);
return str;
}
ULONG GetBestID( ULONG width, ULONG height, ULONG depth )
{
struct Screen *defscr;
ULONG displayID;
if ((defscr = LockPubScreen(NULL)))
{
struct ViewPort *vp;
vp = &defscr->ViewPort;
displayID = BestModeID( BIDTAG_Depth,depth,
BIDTAG_NominalWidth, width,
BIDTAG_NominalHeight, height,
BIDTAG_MonitorID, GetVPModeID( vp ) & MONITOR_ID_MASK,
TAG_DONE);
if (CyberGfxBase)
{
if (IsCyberModeID(displayID))
{
struct DimensionInfo dims;
/* Get the normal dimensions of the returned displayID */
if (GetDisplayInfoData(NULL,&dims,sizeof(dims),DTAG_DIMS,displayID) > 0)
{
ULONG modeWidth = dims.Nominal.MaxX - dims.Nominal.MinX + 1;
ULONG modeHeight = dims.Nominal.MaxY - dims.Nominal.MinY + 1;
/* If dimensions differ to "much", try to get a better one via cybergfx calls */
if (modeWidth > width * 4 / 3 || modeHeight > height * 4 / 3)
{
displayID = BestCModeIDTags(
CYBRBIDTG_Depth, depth,
CYBRBIDTG_NominalWidth, width,
CYBRBIDTG_NominalHeight, height,
CYBRBIDTG_MonitorID, GetVPModeID( vp ) & MONITOR_ID_MASK,
TAG_DONE);
}
}
}
}
UnlockPubScreen( NULL, defscr );
} else displayID = INVALID_ID;
if (displayID == INVALID_ID)
{
displayID = BestModeID( BIDTAG_Depth,depth,
BIDTAG_NominalWidth, width,
BIDTAG_NominalHeight, height,
TAG_DONE);
}
return displayID;
}
STRPTR GetDisplayName(ULONG displayid)
{
STATIC struct NameInfo DisplayNameInfo;
STATIC char DisplayNameBuffer[256];
LONG i, v;
i = 0;
v = GetDisplayInfoData(NULL, (UBYTE *) &DisplayNameInfo, sizeof(DisplayNameInfo),
DTAG_NAME, displayid);
if(v > sizeof(struct QueryHeader))
{
for(; (i < sizeof(DisplayNameBuffer) - 1) && DisplayNameInfo.Name[i]; i++)
DisplayNameBuffer[i] = DisplayNameInfo.Name[i];
}
if(displayid == INVALID_ID)
strcpy(DisplayNameBuffer, "InvalidID"/*GetMessage(MSG_INVALID)*/);
else
{
if(i < sizeof(DisplayNameBuffer) - sizeof(" (0x00000000)"))
{
DisplayNameBuffer[i++] = ' ';
DisplayNameBuffer[i++] = '(';
DisplayNameBuffer[i++] = '0';
DisplayNameBuffer[i++] = 'x';
for(v = 28; (v >= 0) && (!((displayid >> v) & 0xf)); v -= 4);
if(v < 0)
DisplayNameBuffer[i++] = '0';
for(; (v >= 0); v -= 4)
{
if(((displayid >> v) & 0xf) > 9)
DisplayNameBuffer[i++] = ((displayid >> v) & 0xf) + 'a' - 10;
else
DisplayNameBuffer[i++] = ((displayid >> v) & 0xf) + '0';
}
DisplayNameBuffer[i++] = ')';
}
DisplayNameBuffer[i++] = 0;
}
return DisplayNameBuffer;
}
APTR FindUserData( struct Menu *menu, APTR userdata)
{
while(menu)
{
struct MenuItem *mi;
if(GTMENU_USERDATA( menu ) == userdata) return menu;
mi = menu->FirstItem;
while(mi)
{
struct MenuItem *smi;
if(GTMENUITEM_USERDATA( mi ) == userdata) return mi;
smi = mi->SubItem;
while(smi)
{
if(GTMENUITEM_USERDATA( smi ) == userdata) return smi;
smi = smi->NextItem;
}
mi = mi->NextItem;
}
menu = menu->NextMenu;
}
return NULL;
}
/**************************************************************************
...
**************************************************************************/
struct Library *OpenLibraryInterface(STRPTR name, int version, void *interface_ptr)
{
struct Library *lib = OpenLibrary(name,version);
struct Interface *iface;
if (!lib) return NULL;
iface = GetInterface(lib,"main",1,NULL);
if (!iface)
{
CloseLibrary(lib);
return NULL;
}
*((struct Interface**)interface_ptr) = iface;
return lib;
}
/**************************************************************************
...
**************************************************************************/
void CloseLibraryInterface(struct Library *lib, void *interface)
{
DropInterface(interface);
CloseLibrary(lib);
}
+41
View File
@@ -0,0 +1,41 @@
#ifndef _SUPPORT_H_
#define _SUPPORT_H_
#define InnerWidth(w) (w->Width - w->BorderLeft - w->BorderRight)
#define InnerHeight(w) (w->Height - w->BorderTop - w->BorderBottom)
/* Some MUI Support Functions */
#if 0
LONG xget(Object *obj,ULONG attribute);
char *getstr(Object *obj);
BOOL getbool(Object *obj);
Object *MakeLabel(STRPTR str);
Object *MakeLabel1(STRPTR str);
Object *MakeLabel2(STRPTR str);
Object *MakeLLabel(STRPTR str);
Object *MakeLLabel1(STRPTR str);
Object *MakeCheck(BOOL check);
Object *MakeButton(STRPTR str);
Object *MakeCycle(STRPTR *array);
Object *MakeString(STRPTR def, LONG maxlen);
Object *MakeImageButton(ULONG image);
Object *MakeLV(APTR pool);
ULONG DoSuperNew(struct IClass *cl,Object *obj,ULONG tag1,...);
#define nnsetstring(obj,s) nnset(obj,MUIA_String_Contents,s)
#endif
LONG StrLen( const STRPTR str);
STRPTR StrCopy( const STRPTR str );
STRPTR GetFullPath( STRPTR drw, STRPTR file);
STRPTR AddSuffix(const STRPTR name, const STRPTR suf);
ULONG GetBestID( ULONG width, ULONG height, ULONG depth );
STRPTR GetDisplayName(ULONG displayid);
APTR FindUserData( struct Menu *menu, APTR userdata);
struct Library *OpenLibraryInterface(STRPTR name, int version, void *interface_ptr);
void CloseLibraryInterface(struct Library *lib, void *interface);
#endif /* _SUPPORT_H_ */
+129
View File
@@ -0,0 +1,129 @@
/*
* unixfunc.c - only required for the Maxon compiler
*
* Copyright (c) 2000 Sebastian Bauer
* Copyright (c) 2000-2003 Atari800 development team (see DOC/CREDITS)
*
* This file is part of the Atari800 emulator project which emulates
* the Atari 400, 800, 800XL, 130XE, and 5200 8-bit computers.
*
* Atari800 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Atari800 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Atari800; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef __MAXON__
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <pragma/dos_lib.h>
#include <pragma/exec_lib.h>
int __open(const char *name, int mode,...)
{
BPTR fh;
if( mode & O_RDONLY )
{
fh = Open((STRPTR)name,MODE_OLDFILE);
} else
{
if(mode & O_WRONLY)
{
fh = Open((STRPTR)name,MODE_NEWFILE);
} else fh = Open((STRPTR)name, MODE_OLDFILE);
}
if(!fh) fh = (BPTR)-1;
return (int)fh;
}
int __close(int fh)
{
if(fh && fh != -1 ) Close((BPTR)fh);
return 0;
}
int __write(int fh, const void *buffer, unsigned int length)
{
return Write((BPTR)fh,(APTR)buffer,length);
}
int __read(int fh, void *buffer, unsigned int length)
{
int count;
if (fh == -1) return 0;
count = Read((BPTR)fh,buffer,length);
/* if(!count) count = - 1;*/
return count;
}
int unlink(const char *name)
{
DeleteFile((STRPTR)name);
return 0;
}
long lseek(int fh, long rpos, int mode)
{
long origin = mode;
Seek((BPTR)fh,rpos,origin);
return Seek((BPTR)fh,0,OFFSET_CURRENT);
}
char *strdup(const char *s)
{
char *p = malloc(strlen(s)+1);
if(p)
{
strcpy(p,s);
}
return p;
}
char *getcwd(char *b, int size)
{
struct Process *p = (struct Process*)FindTask(NULL);
NameFromLock(p->pr_CurrentDir, b, size);
return b;
}
int stat()
{
return -1;
}
int readdir()
{
return -1;
}
int closedir()
{
return -1;
}
int opendir()
{
return -1;
}
#endif