Re: [hatari-devel] add support for TT ram ? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On torstai 20 marraskuu 2014, Nicolas Pomarède wrote:
> Le 19/11/2014 23:07, Eero Tamminen a écrit :
> > Attached patch implements the config & option handling + GUI stuff,
> > hopefully it helps in testing the actual TT-ram implementation. :-)
> >
> > What kind of amounts of TT-RAM there can be? In GUI I used 4MB
> > step (to speed changing it), on command line the amount can be
> > specified in MBs.
>
> thanks for the patch, looks complete to me.
>
> The TT can have up to 256 MB. As for the falcon, it depends on the board
> used (CT2, CT30, CT60, ...), but 256 MB is certainly enough for most
> cases (note that a basic falcon can't handle more than 14 MB due to its
> limited 24 bit addressing, which was certainly not Atari's greatest idea
> ...)
Attached is an updated patch after recent changes.
I'm eagerly awaiting TT-RAM to do some Quake testing with Douglas. ;-)
(Cycle counter & NatFeats should be fixed first though, otherwise
profiling doesn't work & native debug output from awkward places
is more awkward than it needs to be.)
- Eero
diff -r d5d4a5daa92b doc/hatari.1
--- a/doc/hatari.1 Mon Dec 08 23:58:28 2014 +0100
+++ b/doc/hatari.1 Wed Dec 10 00:12:20 2014 +0200
@@ -271,7 +271,10 @@
Load memory snap-shot <file>
.TP
.B \-s, \-\-memsize <x>
-Set amount of emulated RAM, x = 1 to 14 MiB, or 0 for 512 KiB
+Set amount of emulated ST RAM, x = 1 to 14 MiB, or 0 for 512 KiB
+.TP
+.B \-s, \-\-ttram <x>
+Set amount of emulated TT RAM, x = 0 to 256 MiB (in 4MB steps)
.SH "ROM options"
.TP
diff -r d5d4a5daa92b src/change.c
--- a/src/change.c Mon Dec 08 23:58:28 2014 +0100
+++ b/src/change.c Wed Dec 10 00:12:20 2014 +0200
@@ -151,6 +151,8 @@
/* Did change size of memory? */
if (current->Memory.nMemorySize != changed->Memory.nMemorySize)
return true;
+ if (current->Memory.nTTRamSize != changed->Memory.nTTRamSize)
+ return true;
/* MIDI related IRQs start/stop needs reset */
if (current->Midi.bEnableMidi != changed->Midi.bEnableMidi)
diff -r d5d4a5daa92b src/configuration.c
--- a/src/configuration.c Mon Dec 08 23:58:28 2014 +0100
+++ b/src/configuration.c Wed Dec 10 00:12:20 2014 +0200
@@ -260,6 +260,7 @@
static const struct Config_Tag configs_Memory[] =
{
{ "nMemorySize", Int_Tag, &ConfigureParams.Memory.nMemorySize },
+ { "nTTRamSize", Int_Tag, &ConfigureParams.Memory.nTTRamSize },
{ "bAutoSave", Bool_Tag, &ConfigureParams.Memory.bAutoSave },
{ "szMemoryCaptureFileName", String_Tag, ConfigureParams.Memory.szMemoryCaptureFileName },
{ "szAutoSaveFileName", String_Tag, ConfigureParams.Memory.szAutoSaveFileName },
@@ -552,6 +553,7 @@
/* Set defaults for Memory */
ConfigureParams.Memory.nMemorySize = 1; /* 1 MiB */
+ ConfigureParams.Memory.nTTRamSize = 0; /* disabled */
ConfigureParams.Memory.bAutoSave = false;
sprintf(ConfigureParams.Memory.szMemoryCaptureFileName, "%s%chatari.sav",
psHomeDir, PATHSEP);
@@ -904,6 +906,7 @@
MemorySnapShot_Store(ConfigureParams.Rom.szCartridgeImageFileName, sizeof(ConfigureParams.Rom.szCartridgeImageFileName));
MemorySnapShot_Store(&ConfigureParams.Memory.nMemorySize, sizeof(ConfigureParams.Memory.nMemorySize));
+ MemorySnapShot_Store(&ConfigureParams.Memory.nMemorySize, sizeof(ConfigureParams.Memory.nTTRamSize));
MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskFileName[0], sizeof(ConfigureParams.DiskImage.szDiskFileName[0]));
MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskZipPath[0], sizeof(ConfigureParams.DiskImage.szDiskZipPath[0]));
diff -r d5d4a5daa92b src/gui-sdl/dlgMemory.c
--- a/src/gui-sdl/dlgMemory.c Mon Dec 08 23:58:28 2014 +0100
+++ b/src/gui-sdl/dlgMemory.c Wed Dec 10 00:12:20 2014 +0200
@@ -12,6 +12,7 @@
#include "memorySnapShot.h"
#include "file.h"
#include "screen.h"
+#include "options.h"
#define DLGMEM_512KB 4
@@ -20,22 +21,32 @@
#define DLGMEM_4MB 7
#define DLGMEM_8MB 8
#define DLGMEM_14MB 9
-#define DLGMEM_FILENAME 13
-#define DLGMEM_SAVE 14
-#define DLGMEM_RESTORE 15
-#define DLGMEM_AUTOSAVE 16
-#define DLGMEM_EXIT 17
+#define DLGMEM_TTRAM_LESS 11
+#define DLGMEM_TTRAM_TEXT 12
+#define DLGMEM_TTRAM_MORE 13
+#define DLGMEM_FILENAME 17
+#define DLGMEM_SAVE 18
+#define DLGMEM_RESTORE 19
+#define DLGMEM_AUTOSAVE 20
+#define DLGMEM_EXIT 21
+/* String for TT RAM size */
+static char sTTRamSize[4];
+
+#define TTRAM_STEP 4
+#define TTRAM_MIN 0
+#define TTRAM_MAX 256
+
static char dlgSnapShotName[36+1];
/* The memory dialog: */
static SGOBJ memorydlg[] =
{
- { SGBOX, 0, 0, 0,0, 40,22, NULL },
+ { SGBOX, 0, 0, 0,0, 40,24, NULL },
- { SGBOX, 0, 0, 1,1, 38,7, NULL },
+ { SGBOX, 0, 0, 1,1, 38,9, NULL },
{ SGTEXT, 0, 0, 15,2, 12,1, "Memory setup" },
{ SGTEXT, 0, 0, 4,4, 12,1, "ST-RAM size:" },
{ SGRADIOBUT, 0, 0, 18,4, 9,1, "_512 KiB" },
@@ -44,16 +55,20 @@
{ SGRADIOBUT, 0, 0, 29,4, 7,1, "_4 MiB" },
{ SGRADIOBUT, 0, 0, 29,5, 7,1, "_8 MiB" },
{ SGRADIOBUT, 0, 0, 29,6, 8,1, "14 _MiB" },
+ { SGTEXT, 0, 0, 4,8,12,1, "TT-RAM size:" },
+ { SGBUTTON, 0, 0, 18,8, 1,1, "\x04", SG_SHORTCUT_LEFT },
+ { SGTEXT, 0, 0, 20,8, 3,1, sTTRamSize },
+ { SGBUTTON, 0, 0, 24,8, 1,1, "\x03", SG_SHORTCUT_RIGHT },
- { SGBOX, 0, 0, 1,9, 38,10, NULL },
- { SGTEXT, 0, 0, 12,10, 17,1, "Memory state save" },
- { SGTEXT, 0, 0, 2,12, 20,1, "Snap-shot file name:" },
- { SGTEXT, 0, 0, 2,13, 36,1, dlgSnapShotName },
- { SGBUTTON, 0, 0, 8,15, 10,1, "_Save" },
- { SGBUTTON, 0, 0, 22,15, 10,1, "_Restore" },
- { SGCHECKBOX, 0, 0, 2,17, 34,1, "_Load/save state at start-up/exit" },
+ { SGBOX, 0, 0, 1,11, 38,10, NULL },
+ { SGTEXT, 0, 0, 12,12, 17,1, "Memory state save" },
+ { SGTEXT, 0, 0, 2,14, 20,1, "Snap-shot file name:" },
+ { SGTEXT, 0, 0, 2,15, 36,1, dlgSnapShotName },
+ { SGBUTTON, 0, 0, 8,17, 10,1, "_Save" },
+ { SGBUTTON, 0, 0, 22,17, 10,1, "_Restore" },
+ { SGCHECKBOX, 0, 0, 2,19, 34,1, "_Load/save state at start-up/exit" },
- { SGBUTTON, SG_DEFAULT, 0, 10,20, 20,1, "Back to main menu" },
+ { SGBUTTON, SG_DEFAULT, 0, 10,22, 20,1, "Back to main menu" },
{ -1, 0, 0, 0,0, 0,0, NULL }
};
@@ -65,7 +80,7 @@
*/
bool Dialog_MemDlg(void)
{
- int i;
+ int i, memsize;
int but;
SDLGui_CenterDlg(memorydlg);
@@ -96,6 +111,8 @@
memorydlg[DLGMEM_14MB].state |= SG_SELECTED;
break;
}
+ memsize = ConfigureParams.Memory.nTTRamSize;
+ sprintf(sTTRamSize, "%3i", memsize);
File_ShrinkName(dlgSnapShotName, ConfigureParams.Memory.szMemoryCaptureFileName, memorydlg[DLGMEM_FILENAME].w);
@@ -111,6 +128,15 @@
switch (but)
{
+ case DLGMEM_TTRAM_LESS:
+ memsize = Opt_ValueAlignMinMax(memsize - TTRAM_STEP, TTRAM_STEP, TTRAM_MIN, TTRAM_MAX);
+ sprintf(sTTRamSize, "%3i", memsize);
+ break;
+ case DLGMEM_TTRAM_MORE:
+ memsize = Opt_ValueAlignMinMax(memsize + TTRAM_STEP, TTRAM_STEP, TTRAM_MIN, TTRAM_MAX);
+ sprintf(sTTRamSize, "%3i", memsize);
+ break;
+
case DLGMEM_SAVE: /* Save memory snap-shot */
if (SDLGui_FileConfSelect("Save memory snapshot:", dlgSnapShotName,
ConfigureParams.Memory.szMemoryCaptureFileName,
@@ -148,6 +174,7 @@
else
ConfigureParams.Memory.nMemorySize = 14;
+ ConfigureParams.Memory.nTTRamSize = memsize;
ConfigureParams.Memory.bAutoSave = (memorydlg[DLGMEM_AUTOSAVE].state & SG_SELECTED);
return false;
diff -r d5d4a5daa92b src/includes/configuration.h
--- a/src/includes/configuration.h Mon Dec 08 23:58:28 2014 +0100
+++ b/src/includes/configuration.h Wed Dec 10 00:12:20 2014 +0200
@@ -118,6 +118,7 @@
typedef struct
{
int nMemorySize;
+ int nTTRamSize;
bool bAutoSave;
char szMemoryCaptureFileName[FILENAME_MAX];
char szAutoSaveFileName[FILENAME_MAX];
diff -r d5d4a5daa92b src/options.c
--- a/src/options.c Mon Dec 08 23:58:28 2014 +0100
+++ b/src/options.c Wed Dec 10 00:12:20 2014 +0200
@@ -118,6 +118,7 @@
OPT_IDEMASTERHDIMAGE,
OPT_IDESLAVEHDIMAGE,
OPT_MEMSIZE, /* memory options */
+ OPT_TT_RAM,
OPT_MEMSTATE,
OPT_TOS, /* ROM options */
OPT_PATCHTOS,
@@ -327,6 +328,8 @@
{ OPT_HEADER, NULL, NULL, NULL, "Memory" },
{ OPT_MEMSIZE, "-s", "--memsize",
"<x>", "ST RAM size (x = size in MiB from 0 to 14, 0 = 512KiB)" },
+ { OPT_TT_RAM, NULL, "--ttram",
+ "<x>", "TT RAM size (x = size in MiB from 0 to 256)" },
{ OPT_MEMSTATE, NULL, "--memstate",
"<file>", "Load memory snap-shot <file>" },
@@ -1444,6 +1447,12 @@
bLoadAutoSave = false;
break;
+ case OPT_TT_RAM:
+ memsize = atoi(argv[++i]);
+ ConfigureParams.Memory.nTTRamSize = Opt_ValueAlignMinMax(memsize+3, 4, 0, 256);
+ bLoadAutoSave = false;
+ break;
+
case OPT_TOS:
i += 1;
ok = Opt_StrCpy(OPT_TOS, true, ConfigureParams.Rom.szTosImageFileName,
diff -r d5d4a5daa92b src/statusbar.c
--- a/src/statusbar.c Mon Dec 08 23:58:28 2014 +0100
+++ b/src/statusbar.c Wed Dec 10 00:12:20 2014 +0200
@@ -471,6 +471,9 @@
end = Statusbar_AddString(end, "0.5");
}
}
+ if (ConfigureParams.Memory.nTTRamSize) {
+ end += sprintf(end, "/%i", ConfigureParams.Memory.nTTRamSize);
+ }
end = Statusbar_AddString(end, "MB ");
/* machine type */