Testing Emulators.

Emulator and emulator development specific topics
Mike
Posts: 52
Joined: Sun May 11, 2008 5:38 pm

Re: Testing Emulators.

Post by Mike »

Hi Andy.

Here's the programs I used fairly regularly to get EO reasonably correct:

http://www.chuntey.com/testsuit.zip

You've done most of them, but I noticed you haven't tried Xtricator. It uses a completely different pseudo-hires routine to most programs. The Z80s IM2 mode is used to redirect the display away from the ROM routine.

Mike
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Testing Emulators.

Post by Andy Rea »

Thanks for that Mike, i haven't even implemented im mode 2 so i'll take a look at it and see what i can do.

regards Andy

Additionally a Question.

is the ZX81 databus always $FF when idle and expecting part of the interupt vector on it in IM2 ?

Thanks.

Well that was easy, IM2 now implemented...

QSDEF enda how long are those Vsync's !!!!
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Testing Emulators.

Post by Andy Rea »

Whooey i finally worked out how to make a standalone !!! its only took me a few days.

anyhows here it is

http://dl4u.savefile.com/f165c0a854d78b ... 8/AR81.rar

or here

http://www.savefile.com/files/1568013

So the quick instructions, unrar into a folder of your choice and run the exe. after a few seconds yu should get the familiar inverted K. For now i only load P files and they have to be in the same folder as the exe, to load a P file just type LOAD "25THANNI" without the .P for example to load 25thanni.p , there are a few things you can play with, F3 will pause and un-pause the emulation, un-pause always goes into freerun (i.e will not stop at breakpoints) you can pause/unpause via control menu also. in control menu is cpu reset too.
view menu brings up 2 other windows, debug and mem-view(mem view is in a very flakey state of affairs at the moment but give me an idea of what i was after, would love the zx chars in there), on to the debugger which visually is quite heavilly based on Mikes layout on the top left is the disasemmbly pane which is of most use when single stepping the current instruction (the one that will be excuted when you click single step) is in the middle hi-lighted(an asterisk immediatly after the address means its probably a force nop and not the instruction shown), instruction above it are the past instructions and instrcution below are the upcoming instructions (no attempt is made to follow branches in the upcomming instruction [good idea ? worth inplementing?]) under that is a dicky breakpoint editor up to 16 breakpints at this time, either hex ($ffff or 0xffff) or decimal numbers can be entered 1 per line. next to that is three buttons and a couple of check boxes, teh disassembly check will show continous disassemble whilst running till next break (but not in free run) the mem update will update the memory view window in real time (noticable slow down in the emulation is apparent here) the buttons speak for them selves. you might by now have noticed that there are 2 full sets of registers been displayed the top set is the current values, and the bottom set is what will happen on the next instruction with the differences highlighted. (IM has 3 digits after it the first digit is the IM mode, second IFF1, third IFF2).

believe it or not, other than the almost obligatory 'Hello World' program this is the first 'C' program i have ever written, its flakey and needs throttling cuz it'll just sit there and use 99% CPU. oh and its single threaded cuz i don't know how to do threading yet ! Maybe some kind peeps onm here would like to give me some Lessons ? I'm not sure how far i will take this emulator it might go the way that many of my idea's go that is once i prove to myself that ' I can do it ' i kinda loose interest if you know what i mean. i remeber a zx81 prog i wrote took me nearly a year with a 11 month gap inbetween ! LOL

Regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
Mike
Posts: 52
Joined: Sun May 11, 2008 5:38 pm

Re: Testing Emulators.

Post by Mike »

Hi Andy.

It's a great start to an emulator. Now all you need to do is the boring stuff... loading/saving, peripherals etc.

I wouldn't worry to much about multi-threading - EO isn't multi-threaded either, though I did once consider it and there's some threading code commented out in the source. On this laptop, your emulator never hits more than about 35% CPU time anyway.

Oh and the most important thing... change it so it displays black when the Vblank is being displayed ;)

Mike
User avatar
gus
Posts: 177
Joined: Fri May 16, 2008 10:18 pm
Location: Buenos Aires. Argentina
Contact:

Re: Testing Emulators.

Post by gus »

Hi Andy,
It's good to have a new emulator in progress !!! i'm at the office right now, but when I arrives to home this night I will take a look a the AR81 mainly to the Debugger facilities :)
Keep us informed of your progress !!!
Thanks,
Gus
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Testing Emulators.

Post by Andy Rea »

It's here Code Rewind :mrgreen: upto 255 steps of backtracking allowing you to change register contents and step through the same code again and again, Once the memory editor is complete this could be a really useful feature (i hope). basiccaly everything else is the same as before to modify a register the emulator must be paused, just click on the register you want to edit and a little window pops up for you to enter a new value, code Rewinding can only be used in conjuntion with single stepping, so whenever you Freerun or Run till next break Code rewind is cancelled. when paused check the enable rewind checkbox and then every single-step will remeber the state of everything, including any memory bytes that where modified, up to 255 steps, you can continue to single step past the 255 limit but you will loose step 0 and everything rolls down (so you only keep the last 255 steps), to rewinf just click the rewind button (which also shows how many steps are left in the rewind buffer).

Find it here

http://www.savefile.com/files/1570922

or here
http://dl1u.savefile.com/bc11ba425886cc ... c/AR81.rar

regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Testing Emulators.

Post by sirmorris »

Are you sure this is your 1st C program? I think you're pulling our legs ;P

Congrats - this is an awesome achievement!



P.S. I'll be nicking your code later ;)
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Testing Emulators.

Post by Andy Rea »

Yes it's my first 'C' program (but i do tinker with idea's in a temporary project before putting it in) ,althought i have programmed in the past many dialects of Basic (bbc, sinclair, qbasic, gwbasic, commodore), 6502 assembler, Z80 assembler (i used to code my first programs by hand using lookup tables),All self taught from erm 81 :mrgreen: onwards so 27 years experience helps, i think it helps having a logical mind and been able to 'See' how a piece of code works and then easily adapt it to my own needs. I'm sure that if you look at the source you'll see it's a bit all over the place and probably not very 'C' like although i have tried to matain some sort of common layout thoughtout.

how the Rewinder works, i have a array of structs, each struct hold a full copy of the registers (it was easier than doing just the changing registers), the hardware states at that time, and finally upto 4 memory addresses and there corisponding old values (4 because of the ghosting which i do at memory write time, instead of at memory read). So it doesn't use up too much more memory.

BTW how did you get those ZX chars in your memory viewer ? i'm still struggling trying to get real time viewer updates working at an acceptable speed.

Regards Andy

p.s. would you believe English is my native language? Grammer what's that then?
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Testing Emulators.

Post by Andy Rea »

Got a techincal question regarding tape emulation, More specifically TZX format, reading the TZX format specification it has an example of the generalized data block for ZX81, that seems to be using 3.5Mhz timing however earlier on in the rules and definitions its quite clearly states that timing should be in Z80 clock ticks, but then contradicts itself by saying that 1 tick = 1/3500000 Sec (only on a spectrum !!!) Also the example generalized data block (if we assume was meant to be using 3.5Mhz timing) the rest between pulse chains is too short and should be 5246 (not 4689)i have measured this and assuming my clock cycles counts are accurate its 4872 t states on a real ZX81 (4872 *(1/3250000)) = 0.001499) as close as it gets to the 1500uS it should be.

anyhows the question is this should i base my Timing model in the tzx handler on 3.5Mhz or the real ZX81 3.25Mhz, not that its really going to matter much because i'll probably skip to the accutal data to load a into the emulator, but what if my created tzx are used in annother app?? do all other apps stick to the 3.5Mhz timing?

regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
Mike
Posts: 52
Joined: Sun May 11, 2008 5:38 pm

Re: Testing Emulators.

Post by Mike »

All timing in a TZX file should be relative to a 3.5MHz clock.

I have a #define in my TZX file code:

#define TZXSCALE(x) (((float)x)/(((float)3500000)/((float)machine.clockspeed)))

Then when I load a file in, all values are put through scaling.

Mike
Post Reply