5

Following in the line of this question How can you measure time using BASIC on Atari XL computers?

I'd like to ask how can you do the same (measuring time, with a resolution of frames or better if possible, on an Oric Atmos 48K. There is no TIME or TIMER function as I can see, and I haven't had much luck finding a list of system variables.

So I tried reading the Oric ROM disassmbly searching for clues (available here: http://www.defence-force.org/ftp/oric/documentation/v1.1_rom_disassembly.pdf ), and I've reached this:

EDFC 29 7F      AND #$7F      This section sets up the 6522
EDFE 09 40      ORA #$40      to generate interrupts from
EE00 8D 0B 03   STA $030B     timer 1 every 10mS (in its
EE03 A9 C0      LDA #$C0      free running mode).

A while after, in a code section titled as "IRQ handler", I've come to this code:

EE39 A0 00      LDY #$00      This section decrements each
EE3B B9 72 02   LDA $0272,Y   of the three 16 bit counters
EE3E 38         SEC           in page 2 by 1.
EE3F E9 01      SBC #$01
EE41 99 72 02   STA $0272,Y
EE44 C8         INY
EE45 B9 72 02   LDA $0272,Y
EE48 E9 00      SBC #$00
EE4A 99 72 02   STA $0272,Y
EE4D C8         INY
EE4E C0 06      CPY #$06
EE50 D0 E9      BNE $EE3B

So I thought there was a 10ms free running timer which caused a 16-bit counter located at $0272 to decrement by 1. I tried to PEEK that location (626 in decimal) to see if it changes, but it doesn't. It may be a hardware counter located in a CIA or something. I'm not sure.

After all this, I'm in the same point as I started, so... does anyone know how to measure time from BASIC in a Oric Atmos 48K? Thanks!

3

It turns out that the information about system variables were at the end of the disassembly document. This is an excerpt from it:

$272,$273    Keyboard timer.
$274,$275    Cursor timer.
$276,$277    Spare counter — also used by WAIT (and printer in V1.0).

And the argument for the WAIT command is a multiple of 10 ms, so WAIT 100 waits for 1 second.

So the resolution of the spare counter used by WAIT is 10 ms. More than enough for me!

To get the current value of this spare counter, which is a 16 bit number, I have to use the DEEK function, a variant of PEEK to retrieve a 16-bit number from memory, like this: DEEK(#276) #276 is an hexadecimal number.

Counters in the Oric Atmos computer count backwards, so the number retrieved when the measurement starts will be greater than the one retrieved when the measurement ends.

So, this is the SAXPY benchmark applied to the Oric Atmos 48K:

enter image description here

  • 1
    In general, to prevent some delay from calculating the backward counting time difference I would suggest to save the ending timestamp first into a variable and do all calculations afterwards (similar like this: TE=DEEK(#276):PRINT "TIME IN SECONDS: ";(T-TE)/100. For sure, in this case the floating point expression evaluation in line 90 is negligible, but for comparable results on different devices without suffering from delays caused by the timing procedure this might be taken into consideration. – Johann Klasek May 2 '16 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.