Oricutron 1.0 (EDIT: Now 1.2)

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Godzil »

iss wrote:In my opinion Oricutron should behave as the real Oric. Dos-8D and some other nice software are using illegal instructions and all works perfectly in current version of Oricutron.
Else, maybe the best will be to have run-time option which enables/disables switch to debug mode on illegal instruction.
I like adding 6502, 65c02 and 65816 to emulation - actually I need it right now ;)...
That mean that Dos-8D will never work if someone replace the 6502 with a CMOS version, clever!
The Apple II users learn that the hard way when Apple switched (and some user too) from the NMOS 6502 to the CMOS 65C02 version.
Using undocumented things, how appealing they are, has never been a good idea as they can broke at anytime (and it happen on the 6502 a certains number of time, even in the NMOS version)

--

I understand what you mean by emulating the quirks should be done, but not as the expense of using the emulator as a debug tool.
Executing "non existant" opcode should generate a warning or jump to debug, if the emulator is configured for that, there is on simple reason for that, detect when the emulated system start to run random code (like jumping somewhere it shouldn't, or like what happened to Chema, being shifted by one or two bytes, a trap on the unknown opcode would have saved Chema a lot of time. Of course the two mention bugs are not necessarily catch by such a feature, because sometimes, you could be unlucky enough to jump somewhere where only valid opcode are present, and it would be un-detected, but at least the debugger must have an option to "enter debug when non official opcode are to be executed"

On other CPU trying to execute a non existing Opcode would trigger a specific interrupt, this mechanism does not exist on the 6502 of course, but it's also a debug feature (Look at the Illegal Instruction trap from the 68000)

Chema: who knows, maybe one day a real new Oric with a 65C816 may appear???.... :D
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Chema »

I see your point Godzil, but I don't completely agree. If Dos-8D uses any kind of illegal opcodes it is up to the programmers. The fact that some users now replace the micro of their Orics is not reason to make Oricutron fail running that code. I would not use any undocumented opcodes in my programs if that means that some Oric user today cannot run it, but that is my decision. For the same reason I would not use instructions that need a 65C816, because that means no unmodified Oric can run it.

But again that is me (I never used undocumented opcodes, btw). I *may* use some undocumented feature in the processor, ULA or AY, for instance, if: 1/ it is valid for *all* the Orics at that time to ensure as much compatibility as possible, and 2/ creates some effect or makes my program do something that else is not possible. And very low in my priority would be if it runs on modern modified ROMS, or with twin ROM Orics.

In any case, it is not my decision, but at least make it an option, so I can select in the configuration file if I want Oricutron to warn or halt on illegal opcodes or run them as my old Oric would do.

And let me say again that, what is an issue is that Oricutron behaves differently than a real Oric, what is what happened here, because finding the bug was argh... But the same would happen if some opcode is run as correct because Orictutron is emulating a 65C816 and not a 6502...
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Symoon »

I can't recall in which exactly, but I'm pretty sure Dom found "illegal" opcodes in some tape protection routine.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Godzil »

Hopefully that Tangerine/OPI didn't live long enough to switch to 65C02 or the 65C816 :)

Chema, I know, for pure emulation I can understand, but as a debug tool, I would expect it to have a way to trigger an exception in that case
User avatar
Xeron
Emulation expert
Posts: 426
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Xeron »

That mean that Dos-8D will never work if someone replace the 6502 with a CMOS version, clever!
Depends on the instructions used. Some are the same on 65c02.
The Apple II users learn that the hard way when Apple switched (and some user too) from the NMOS 6502 to the CMOS 65C02 version.
But the Oric never did change.
Using undocumented things, how appealing they are, has never been a good idea as they can broke at anytime
But people did use undocumented things, and they got away with it because Oric never switched to 65c02.

I understand what you mean by emulating the quirks should be done, but not as the expense of using the emulator as a debug tool.
Oricutron is first and foremost an Emulator. It is a debug tool second.
Executing "non existant" opcode should generate a warning or jump to debug
Not by default. Oricutron is trying to emulate an Oric computer and run Oric software. Some of it uses illegal instructions.
if the emulator is configured for that, there is on simple reason for that, detect when the emulated system start to run random code (like jumping somewhere it shouldn't,
In its default state, Oricutron should behave the same way a stock Oric does.
or like what happened to Chema, being shifted by one or two bytes,
That is a bug in Oricutron. The intention in Oricutron is to emulate illegal instructions correctly.
a trap on the unknown opcode would have saved Chema a lot of time.
Indeed, but such a trap should be an option, and not the default option. Most users of Oricutron are not developers, they just want to run Oric games on the whole.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Godzil »

So we agree, it should be an option (I was maybe a bit unclear about that)
jede
Flying Officer
Posts: 191
Joined: Tue Mar 14, 2006 11:53 am
Location: France

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by jede »

Hello,

Telestrat emulation crashes :
1) at command linue
2) when i select telestrat from menu

Does Telestrat emulation works ?
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by iss »

@jede: Probably you are using the binary version of Oricutron 1.2.
Telestrat mode is already fixed - you can compile recent sources from https://github.com/pete-gordon/oricutron.
Else, you can use attached file to replace the executable. I hope this helps ;).
oricutron.zip
Oricutron - only executable, 32bit for Windows
(500.64 KiB) Downloaded 649 times
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Dbug »

Regarding CPU emulation (yeah I know I arrive a bit late :D), here is my take on the subject:
- Users wants something that works magically for them, so being ultra tolerant and accepts even broken software or non standard stuff and give a valid result is just fine.
- Developers needs to make sure that the code they write does work on real machines, so they need to be able to define strictly the type of hardware their software is supposed to work on, with tight timings, restricted cpu opcodes, correctly handled access violations, etc...

That's more or less two opposed goals, but that's the best way to ensure that we don't develop software that work only on (some) emulators, which for me means that switches is probably a good solution for that:

I can make sure that the next version of the OSDK will be set-up with an Oricutron that restricts to what a normal Oric/Pravetz would accept.

Now, question: Has anyone actually tested all the known 6502 invalid opcodes and checked what they did on the 6502 we have in Orics and Pravetz?

I wonder if it's possible to write a program that would test them and show the results on screen, and run that say on some first generation Oric 1, and some late models of Oric Nova 64, Telestrats and Pravetz, just to make sure they all actually support the same subset of opcodes with the same behavior :)
User avatar
coco.oric
Squad Leader
Posts: 720
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by coco.oric »

That's a very good idea.
So we'll be able to use them in 6502 code.
In fact, does someone knows if different versions of the 6502 are in our orics ?
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga
jede
Flying Officer
Posts: 191
Joined: Tue Mar 14, 2006 11:53 am
Location: France

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by jede »

@iss : Telestrat works with the binary you sent. Thanks !
User avatar
polluks
Pilot Officer
Posts: 76
Joined: Tue Jun 05, 2012 10:09 pm
Location: Germany
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by polluks »

SDL joystick finally works!
After six years I've fixed the reset of joystick down.
Maybe it's time for a release of version 1.3?

Greetings,
Stefan
cc65 development
Oric Atmos + Cumulus
Acorn Electron
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by iss »

Hi, all! I just committed in Oricutron's repository following changes:

1. List with many breakpoints can be loaded from command line.
Use default switches -r or --breakpoint, but instead of address specify a filename prefixed with ':'. The file is plain text file, which contains desired breakpoint-addresses - one per line using the same syntax as in the monitor. Breakpoints can be set with absolute addresses or with symbols (loaded with command line switches -s / --symbols). Example:

Code: Select all

oricutron -s myproject.sym -r :myprojectbp.txt
where 'myprojectbp.txt' should exist and contain list with breakpoints:

Code: Select all

bs 1234
bs $abcd
bs _main
2. Like Memory breakpoints, the CPU breakpoints can have 'flags', which are:
bs 1234 z - when CPU step on address 1234 the cycles counter will be reset (i.e. set to zero)
bs 1234 c - continue execution, i.e. like 'disabled' break point.
Both flags can be combined and this is their actual purpuse - to measure precisely CPU cycles 8)
If you load (as described above) a breakpoint file:

Code: Select all

bs 1000 zc
bs 2000
then by execution on address 1000 the cycles counter will be reset and on address 2000 Oricutron will switch to monitor showing how many cycles where counted - making programmers life easier!

3. Timings related to correct emulation of VSync-hack are fixed, so Oricutron behaves like real hardware.
I'll post details about VSync in another topic. :)
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by iss »

... some pictures of breakpoints usage.
This program is assembled with OSDK from address #1000:

Code: Select all

.text
_start
        nop
        nop
        nop
        nop
        nop
_stop
        rts
Symbol file contains:

Code: Select all

1000 _start
1005 _stop
Breakpoint file contains:

Code: Select all

bs _start zc
bs _stop
Then on _start cycles are reset:
on_start.jpg
... and on _stop you have 10 cycles counted (5xNOP=10cycles :))
on_stop.jpg
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Oricutron 1.0 (EDIT: Now 1.2)

Post by Chema »

This is great! A step towards a profiler :)

I have used cycle counting before, and this sounds as a good advance in automating things. I guess it supports symbols....

I have a couple of requests, if I may :)

1- Video capturing does not include the current video mode. I mean, even if I set the rendering with the correct aspect ratio, my video still has the 1:1 aspect.
2- Any chance one day the app could have a listening socket so an external application could issue requests for the emulation status? The memory contents between two addresses, for instance?

Nothing too complex, something such as if I send a text string "M data_start data_end\r\n\r\n" (using the web request format, could be any other) where data_start and data_end are two symbols or addresses, it answers back with the raw memory contents. Other commands may get other information.

That would make many things easier for developers :)
Post Reply