How to detect the Oric's CPU speed from within the BASIC prg

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.
JamesD
Flight Lieutenant
Posts: 358
Joined: Tue Nov 07, 2006 7:38 am

Re: Summary:

Post by JamesD »

Brana wrote:
Chema wrote:
It is the ULA who does the work of making it flash based on the attribute in the video memory, but that memory remains unchanged.
Re.. Ouch! :(
Which pretty much puts it back on some machine code. It could be embedded in BASIC though.
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re:

Post by Chema »

Brana wrote: But STILL I get all 1, 1, 1, 1, 1, in the memory after it!
First of all you need to activate the "Connect SYNC to TAPE-IN" option in Euphoric (through the F1 configuration screen).

But as soon as you do this, the program ceases to work and it never ends. Try (just as a test) to include some prints to see where it seems to get hung.

However not executing line 0 (try RUN1) does work. In fact, as a quick test, just do

20 PRINT PEEK(#30D):GOTO20

If the SYNC to TAPE-IN is deactivated you will see zeroes. Activate the option and you will see 16's appearing. The program is slow, as Twi said, so you will see several 16's followed by 1-2 zeroes.

Duplicate the CPU speed (f4) and see how the number of consecutive zeroes increases.

Anyway I am not clearing address #300 and all the IRQs are active, so I am not quite sure what we are seeing. Certainly it will serve to detect if the CPU is running at higher speeds.

Now that I mention it... what you intend to do? I don't see the utility of detecting the CPU speed when all Orics have the same... or don't they?

Regards,
Brana
Flying Officer
Posts: 169
Joined: Fri Nov 30, 2007 8:30 pm
Contact:

Re

Post by Brana »

Well, I was thinking that the detection of the speed of the (emulated) Oric CPU under Euphoric could be done in a rather-simple way... (Boy, was I wrong!! ) :)


Of course, all Oric computers have their CPU at the same speed, but I use Euphoric on a several PC computers connected locally trough the LAN connection at the same time so that TAP files are "shared".


By using Oric BASIC I have developed several applications such as for tracking money - expenses, calculating the amount of salary based on the hours spend at work, and even a cash-register program (this one is still under development because Euphoric have difficulties when it comes to "reading" the bar codes of the articles at such high speed!).


So, I use several Euphorics as EXE application which then load TAP file from the local hard disk, which then instructs the emulator to load another TAP file from the LAN (network)!

Example

CLOAD"HELLO.TAP"
And in the HELLO.TAP file is the line of the program that will load something like this:

CLOAD"\\server\data.tap"

On the computer named "Server" the Euphoric Emulator is set at 10 or 20 Mhz speed for the Oric CPU.


On all other computers, their Euphoric Emulators are set at 5 or 10 Mhz speed for the Oric CPU.


But when loading a TAP file that contains (my) BASIC program, then (my) program needs to know the following:

- is it run on the machine named SERVER, or
- is it run on any other machine?


Since the Server computer have the Euphoric emulator set at higher CPU then I thought that I could "solve" this "problem" by detecting the speed of the CPU of the emulated Oric!


If the speed of the CPU is higher than (example) 5 MHz then the program is run at "SERVER".

Since the detection of the CPU speed isn't so simple as I hoped, I will try to "work around" it by thinking the "alternative" method! :(


P.S. I do not know how to post pictures on to this forum?


I think that the posting of the pictures directly on to the forum is not possible, but only the linking the pictures to the forum that are already posted somewhere on the Web?

I would like (if anyone is interested) to share screenshots of the applications mentioned above with any one of you (again - if anyone is interested) only - one problem - the software mentioned above is written NOT on English but on Serbian language...


But, if interested, I could rather easily "translate" them on to English (as a BMP pictures?)

Best regards
Brana
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

Ah I understand now.

Well pics about this project would be very nice indeed! Sure Dbug can store them on the server.

For the detection of the server... well check if the loop I told you can detect the difference (double speed should be noticed as much more 0s between consecutive 16s). Else there are other options.

Can't you have a small file on the hosts machines which could be different for server and clients? In that case the RECALL command could read data (array variables) which could be different in both... Or much easier, create a file with just one byte containing a 0 or a 255 at a given (unused) address (Using a POKE and a CSAVE with the correct address and length). CLOAD it from within your prog and PEEK to see the value.

And there could be other more intelligent solutions by configuring the hardware of the Oric on the server to have something "extra" and detect iths pressence by prog... Maybe disk drive is not a possibility for you , but what about detecting the pressence of a printer, serial port, real-time clock, joystick or something like that? That should be possible.

Because the simplest thing of configuring server and clients as Oric-1 and ATMOS respectively would maybe affect your program (due to the different BASICs).

Cheers
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

Here a source I found about the Calculation of Clock Frequency of a 6502

http://www.6502.org/source/general/clockfreq.htm
This, of course, does not work on Euphoric...
Post Reply