Re: [hatari-devel] WinUAE CPU core cycle-exact option impact for 68000

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


While trying to do some benchmarks for EmuTOS, i currently have a strange problem with cycle-exact mode. The attached program gives different results on my machine: 39 loops when cycle-exact is off, 30 when cycle-exact is on. It is a simple test that just does a vr_recfl() on the whole screen, running for 5 seconds. According to Christian, 39 is the correct value on real HW, and on his machine he gets the same result in Hatari, independent of the cycle-exact setting.

 

The tests were done with a current snapshot version of 256k EmuTOS. The behaviour is the same with current Hatari, and official 2.2.1 release. Any idea what is causing this? I also tried the windows version, but that just crashes with a segmentation fault in VirtualBox...

 

 

 

 

Attachment: vrrecfl.prg
Description: application/wine-extension-prg

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <aes.h>
#include <vdi.h>
#include <tos.h>
#include <ext.h>

static _WORD xworkout[57];
_WORD vdi_handle;
_WORD phys_handle;
_WORD gl_wchar, gl_hchar;
static GRECT screen;
static MFDB screen_mfdb;
int orig_mblit;
int curr_mblit;


void screen_init(void)
{
	_WORD dummy;
	_WORD workin[11];
	_WORD workout[57];
	int i;
	_WORD pxy[4];

	orig_mblit = curr_mblit = Blitmode(-1) & 1;
	
	phys_handle = graf_handle(&gl_wchar, &gl_hchar, &dummy, &dummy);
	wind_get(0, WF_WORKXYWH, &screen.g_x, &screen.g_y, &screen.g_w, &screen.g_h);
	wind_get(0, WF_CURRXYWH, &screen.g_x, &screen.g_y, &screen.g_w, &screen.g_h);
	
	vdi_handle = phys_handle;
	for (i = 0; i < 10; i++)
		workin[i] = 1;
	workin[10] = 2;
	v_opnvwk(workin, &vdi_handle, workout);

	vswr_mode(vdi_handle, MD_REPLACE);

	vst_color(vdi_handle, BLACK);
	vst_alignment(vdi_handle, 0, 5, &dummy, &dummy);
	vst_effects(vdi_handle, 0);
	vst_rotation(vdi_handle, 0);

	vsf_perimeter(vdi_handle, 0);
	vsf_interior(vdi_handle, FIS_SOLID);
	vsf_style(vdi_handle, 0);

	vsl_width(vdi_handle, 1);
	vsl_color(vdi_handle, BLACK);
	vsl_ends(vdi_handle, 0, 0);
	vsl_type(vdi_handle, SOLID);
	
	vsm_height(vdi_handle, 1);
	vsm_type(vdi_handle, 1);

	pxy[0] = screen.g_x;
	pxy[1] = screen.g_y;
	pxy[2] = screen.g_x + screen.g_w - 1;
	pxy[3] = screen.g_y + screen.g_h - 1;
	vs_clip(vdi_handle, 0, pxy);

	screen_mfdb.fd_w = screen.g_w;
	screen_mfdb.fd_h = screen.g_h;
	screen_mfdb.fd_wdwidth = screen.g_w >> 4;
	screen_mfdb.fd_nplanes = xworkout[4];
	screen_mfdb.fd_stand = 0;
	screen_mfdb.fd_addr = 0;
}
	


void screen_exit(void)
{
	if (vdi_handle > 0)
	{
		v_clsvwk(vdi_handle);
		vdi_handle = 0;
	}
	Blitmode(orig_mblit);
	form_dial(FMD_FINISH, screen.g_x, screen.g_y, screen.g_w, screen.g_h, screen.g_x, screen.g_y, screen.g_w, screen.g_h);
}


int main(void)
{
	clock_t start, end;
	unsigned long loops;
	_WORD color;
	_WORD pxy[4];
	char buf[100];
	
	appl_init();
	screen_init();

	graf_mouse(BUSYBEE, NULL);

	wind_update(BEG_UPDATE);
	wind_update(BEG_MCTRL);
	graf_mouse(ARROW, NULL);
	graf_mouse(M_OFF, NULL);

	start = clock();
	end = start + 5 * 200;
	loops = 0;
	color = 0;
	pxy[0] = 0;
	pxy[1] = 0;
	pxy[2] = screen.g_w - 1;
	pxy[3] = screen.g_h - 1;

	do {
		vsf_color(vdi_handle, color);
		vr_recfl(vdi_handle, pxy);
		loops++;
		color = (color + 1) & 0x0f;
	} while (clock() < end);
	
	wind_update(END_MCTRL);
	wind_update(END_UPDATE);

	screen_exit();
	graf_mouse(M_ON, NULL);
	sprintf(buf, "[1][%lu loops|Blitter: %d][OK]", loops, curr_mblit);
	form_alert(1, buf);
	
	appl_exit();
		
	return 0;
}
[Log]
sLogFileName = stderr
sTraceFileName = stderr
nTextLogLevel = 3
nAlertDlgLogLevel = 1
bConfirmQuit = FALSE
bNatFeats = TRUE
bConsoleWindow = FALSE

[Debugger]
nNumberBase = 10
nSymbolLines = -1
nMemdumpLines = -1
nDisasmLines = -1
nBacktraceLines = 0
nExceptionDebugMask = 515
nDisasmOptions = 15
bDisasmUAE = FALSE
bMatchAllSymbols = FALSE
bSymbolsAutoLoad = TRUE

[Screen]
nMonitorType = 1
nFrameSkips = 5
bFullScreen = FALSE
bKeepResolution = TRUE
bResizable = TRUE
bAllowOverscan = FALSE
nSpec512Threshold = 1
nForceBpp = 0
bAspectCorrect = TRUE
bUseExtVdiResolutions = FALSE
nVdiWidth = 1280
nVdiHeight = 960
nVdiColors = 2
bMouseWarp = TRUE
bShowStatusbar = TRUE
bShowDriveLed = FALSE
bCrop = FALSE
bForceMax = FALSE
nMaxWidth = 1280
nMaxHeight = 960
bUseSdlRenderer = TRUE
nRenderScaleQuality = 0
bUseVsync = FALSE
bHostMouseSync = TRUE

[Joystick0]
nJoystickMode = 0
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = -1
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Joystick1]
nJoystickMode = 1
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = 0
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Joystick2]
nJoystickMode = 0
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = -1
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Joystick3]
nJoystickMode = 0
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = -1
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Joystick4]
nJoystickMode = 0
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = -1
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Joystick5]
nJoystickMode = 0
bEnableAutoFire = FALSE
bEnableJumpOnFire2 = FALSE
nJoyId = -1
kUp = Up
kDown = Down
kLeft = Left
kRight = Right
kFire = Right Ctrl

[Keyboard]
bDisableKeyRepeat = FALSE
nKeymapType = 2
szMappingFileName = /home/sebilla/.hatari/keymap.cfg

[KeyShortcutsWithMod]
kOptions = O
kFullScreen = F
kBorders = B
kMouseMode = M
kColdReset = C
kWarmReset = R
kScreenShot = G
kBossKey = I
kCursorEmu = J
kFastForward = X
kRecAnim = A
kRecSound = Y
kSound = S
kPause = Pause
kDebugger =
kQuit = Q
kLoadMem = L
kSaveMem = K
kInsertDiskA = D
kSwitchJoy0 = F1
kSwitchJoy1 = F2
kSwitchPadA = F3
kSwitchPadB = F4

[KeyShortcutsWithoutMod]
kOptions = Pause
kFullScreen =
kBorders =
kMouseMode =
kColdReset =
kWarmReset =
kScreenShot =
kBossKey =
kCursorEmu =
kFastForward =
kRecAnim =
kRecSound =
kSound =
kPause =
kDebugger =
kQuit =
kLoadMem =
kSaveMem =
kInsertDiskA =
kSwitchJoy0 =
kSwitchJoy1 =
kSwitchPadA =
kSwitchPadB =

[Sound]
bEnableMicrophone = TRUE
bEnableSound = TRUE
bEnableSoundSync = FALSE
nPlaybackFreq = 44100
nSdlAudioBufferSize = 0
szYMCaptureFileName = /home/sebilla/.hatari/hatari.wav
YmVolumeMixing = 2

[Memory]
nMemorySize = 14336
nTTRamSize = 0
bAutoSave = FALSE
szMemoryCaptureFileName = /home/sebilla/.hatari/hatari.sav
szAutoSaveFileName = /home/sebilla/.hatari/auto.sav

[Floppy]
bAutoInsertDiskB = FALSE
FastFloppy = FALSE
EnableDriveA = TRUE
DriveA_NumberOfHeads = 2
EnableDriveB = FALSE
DriveB_NumberOfHeads = 2
nWriteProtection = 0
szDiskAZipPath =
szDiskAFileName = /home/sebilla/.stonx/new_disk.st
szDiskBZipPath =
szDiskBFileName =
szDiskImageDirectory = /home/sebilla/.stonx/

[HardDisk]
nGemdosDrive = 0
bBootFromHardDisk = TRUE
bUseHardDiskDirectory = TRUE
szHardDiskDirectory = /home/sebilla/.hatari/drives
nGemdosCase = 0
nWriteProtection = 0
bFilenameConversion = FALSE
bGemdosHostTime = FALSE

[ACSI]
bUseDevice0 = FALSE
sDeviceFile0 = /home/sebilla/.stonx/tos.dsk
nBlockSize0 = 512
bUseDevice1 = FALSE
sDeviceFile1 = /home/sebilla/atari/freemint.org/freemint
nBlockSize1 = 512
bUseDevice2 = FALSE
sDeviceFile2 = /home/sebilla/atari/freemint.org/freemint
nBlockSize2 = 512
bUseDevice3 = FALSE
sDeviceFile3 = /home/sebilla/atari/freemint.org/freemint
nBlockSize3 = 512
bUseDevice4 = FALSE
sDeviceFile4 = /home/sebilla/atari/freemint.org/freemint
nBlockSize4 = 512
bUseDevice5 = FALSE
sDeviceFile5 = /home/sebilla/atari/freemint.org/freemint
nBlockSize5 = 512
bUseDevice6 = FALSE
sDeviceFile6 = /home/sebilla/atari/freemint.org/freemint
nBlockSize6 = 512
bUseDevice7 = FALSE
sDeviceFile7 = /home/sebilla/atari/freemint.org/freemint
nBlockSize7 = 512

[SCSI]
bUseDevice0 = FALSE
sDeviceFile0 = /home/sebilla/atari/freemint.org/freemint
nBlockSize0 = 512
bUseDevice1 = FALSE
sDeviceFile1 = /home/sebilla/atari/freemint.org/freemint
nBlockSize1 = 512
bUseDevice2 = FALSE
sDeviceFile2 = /home/sebilla/atari/freemint.org/freemint
nBlockSize2 = 512
bUseDevice3 = FALSE
sDeviceFile3 = /home/sebilla/atari/freemint.org/freemint
nBlockSize3 = 512
bUseDevice4 = FALSE
sDeviceFile4 = /home/sebilla/atari/freemint.org/freemint
nBlockSize4 = 512
bUseDevice5 = FALSE
sDeviceFile5 = /home/sebilla/atari/freemint.org/freemint
nBlockSize5 = 512
bUseDevice6 = FALSE
sDeviceFile6 = /home/sebilla/atari/freemint.org/freemint
nBlockSize6 = 512
bUseDevice7 = FALSE
sDeviceFile7 = /home/sebilla/atari/freemint.org/freemint
nBlockSize7 = 512

[IDE]
bUseDevice0 = FALSE
nByteSwap0 = 2
sDeviceFile0 = /home/sebilla/.stonx/tos.dsk
nBlockSize0 = 512
nDeviceType0 = 0
bUseDevice1 = FALSE
nByteSwap1 = 2
sDeviceFile1 = /home/sebilla/atari/hatari-1.9.0
nBlockSize1 = 512
nDeviceType1 = 0

[ROM]
szTosImageFileName = /home/sebilla/.hatari/etos256us.img
bPatchTos = TRUE
szCartridgeImageFileName =

[LILO]
Args = root=/dev/ram video=atafb:vga16 load_ramdisk=1
Kernel = /usr/local/share/hatari/vmlinuz
Symbols =
Ramdisk = /usr/local/share/hatari/initrd
HaltOnReboot = TRUE
KernelToFastRam = TRUE
RamdiskToFastRam = TRUE

[RS232]
bEnableRS232 = FALSE
szOutFileName = /dev/modem
szInFileName = /dev/modem
bEnableSccB = FALSE
sSccBOutFileName = /dev/modem

[Printer]
bEnablePrinting = FALSE
szPrintToFileName = /home/sebilla/.hatari/hatari.prn

[Midi]
bEnableMidi = FALSE
sMidiInFileName = /dev/snd/midiC1D0
sMidiOutFileName = /dev/snd/midiC1D0
sMidiInPortName = Off
sMidiOutPortName = Off

[System]
nCpuLevel = 0
nCpuFreq = 8
bCompatibleCpu = FALSE
nModelType = 2
bBlitter = TRUE
nDSPType = 0
bPatchTimerD = TRUE
bFastBoot = TRUE
bFastForward = FALSE
bAddressSpace24 = TRUE
bCycleExactCpu = TRUE
n_FPUType = 0
bSoftFloatFPU = FALSE
bMMU = FALSE
VideoTiming = 3

[Video]
AviRecordVcodec = 2
AviRecordFps = 0
AviRecordFile = /home/sebilla/.hatari/hatari.avi


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/