Detecting Operating System

If you want to ask questions about how the machine works, peculiar details, the differences between models, here it is !
How to program the oric hardware (VIA, FDC, ...) is also welcome.
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Detecting Operating System

Post by Twilighte »

How do we detect whether the currently running application is on an Oric1, Oric Atmos or Oric Telestrat?
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

Here's how Loriciels does to detect Oric-1 or Atmos...
For the Telestrat, I have no docs, so no idea.

Code: Select all

AD F9 FF  LDA $FFF9      ($FFF9)=#01 on Atmos, #C4 on Oric-1
C9 01     CMP #$01       test Atmos/Oric-1 
D0 xx     BNE $xx        if Oric-1, jump to $xx 
Else... (Atmos)
(thanks to Thierry Bestel for having explained this in the CEO Mag!)

Cheers
Simon
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

One way to detect The Telestrat is to detect the second VIA by sampling the counter of timer1 two times and looking for a difference.

Code: Select all

lda $0324
cmp $0324
bne Telestrat
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

Symoon wrote:Here's how Loriciels does to detect Oric-1 or Atmos...
I guess we could say distinguish between ROM 1.0 and ROM 1.1.
Also for this to works, overlay memory has to be disabled, as well as additional eproms of disc drives.
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

One way to detect The Telestrat is to detect the second VIA by sampling the counter of timer1 two times and looking for a difference.

Code: Select all

lda $0324 
cmp $0324 
bne Telestrat 
This won't work, Jon. On the Oric-1/Atmos, reading location $0324 will indeed read timer1 of the first VIA: you will detect it decrements and conclude there's a second VIA when in fact you read the first VIA...

If you want to detect the second VIA (which will not absolutely mean you have a Telestrat, because some people have built 2nd-VIA extensions for the Oric-1/Atmos), you can successively write two different values on the first VIA and test if you have a different value on the hypothetical 2nd VIA...

For example:

Code: Select all

lda #$55
sta $0306  ; T1 low-order latch
cmp $0326
bne twoVias
asl
sta $0306
cmp $0326
bne twoVias
 ; if equal, only one VIA
Cheers,

Fabrice
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

Point taken, i forgot this mirroring thing. However is their a better way to detect the Telestrat apart from the Second VIA?
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

However is their a better way to detect the Telestrat apart from the Second VIA?
Good question, this has to be thought thoroughly...
Detecting the ACIA instead of the 2nd VIA wouldn't be a definitive answer, because some serial extensions on the Oric also have an ACIA at the same address range...

I think the definitive answer would be to differentiate the Microdisc controller of the Oric, and its ULA implementation in the Telestrat: some bits of the Microdisc electronics have not been implemented in the Telestrat's second ULA (e.g eprom select, interrupt gate...).

Or... another technical way would be to check if the 2nd VIA allows to switch the memory banks (for example, accessing bank 0 which is the "overlay" ram)...

Cheers,

Fabrice
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

What about detecting Euphoric?
I know their was the VIA Shift Register thing that is not supported, but what about CB2 Pulsemode?
I have just written a fast keyboard read routine that utilises this CB2 pulsemode to avoid having to toggle CB2 manually.
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

In my port of LUnix I check the specific pattern in DDRA in the 2nd VIA, and if it's different than the 1st (usually all output).

lda VIA2_DDRA
cmp #%00010111
bne nottelestrat
cmp VIA1_DDRA
bne nottelestrat
; we have one... or at least a 2nd VIA.
nottelestrat:

The cons is it won't work if someone has changed VIA2_DDRA, though it's unlikely as it controls important hardware including banks.
The pro is it doesn't change anything.

As for Atmos vs 1 I check the "1" at $EDAD from the "... v1.1" string in the ROM, not sure it's reliable though.

Have a look at kernel/oric/reset.s for detection of Jasmin and microdisc hardware (not the DOS, I don't care as I'll have to write floppy support from scratch for lunix, as it takes over everything and the code must be reentrant anyway).
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Actually I only tested that in euphoric but it doesn't use any trick so should work.
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Hmm the telestrat test might not be accurate though, as I intend to make a compatible extention for my atmos with joystick/mouse/acia and maybe more ram. but then it would not be far away from a telestrat... except for the jasmin drive :D
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

I believe the problem with detecting between Atmos and Oric-1 is the mere fact they are identical apart from different ROMs (Which can be swapped) and the extra function key on the Atmos.

I assume that specifically reading the function key column/row on an Oric-1 will return the same up state as having a function key?
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

I think i've worked out the best methoid of detecting at least all current versions of emulators..

Code: Select all

#DEFINE VIA_T2LL $0308
#DEFINE VIA_T2CH $0309
#DEFINE VIA_SR   $030A
#DEFINE VIA_ACR  $030B

Code: Select all

     SEI
     LDA #00
     STA VIA_T2LL
     STA VIA_T2CH
     LDA #%01010100
     STA VIA_SR
     STA VIA_ACR
     NOP
     LDA #%01000000
     STA VIA_ACR
     CLI
     LDA VIA_SR
     CMP #%01010100
     BEQ Emulator
Its not been tested but this is how it should work..

We set T2 to 0 so that it times out every cycle. We then write a value to the Shift register and one that is unlikely to come back the same.
We can actually use the same value to set up the ACR. This value sets the Shift register to shift out the data in the shift register onto CB2 every t2 timeout. We then pretty much read back the value again from the shift register and compare to the original.
We also disable the shift register so that it won't adversly affect any future AY access.

If someone could test this on the real machine it would be very much appreciated. I have just tested on Euphoric and it works by displaying "EUPHORIC!" at the top of the screen. On the real machine it will display "REAL MACHINE!".

The tap is available here..
http://www.defence-force.org/ftp/forum/ ... ric/de.tap
Post Reply