Detecting Operating System
Detecting Operating System
How do we detect whether the currently running application is on an Oric1, Oric Atmos or Oric Telestrat?
Here's how Loriciels does to detect Oric-1 or Atmos...
For the Telestrat, I have no docs, so no idea.
(thanks to Thierry Bestel for having explained this in the CEO Mag!)
Cheers
Simon
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)
Cheers
Simon
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...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
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
Fabrice
Good question, this has to be thought thoroughly...However is their a better way to detect the Telestrat apart from the Second VIA?
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
-
- Flight Lieutenant
- Posts: 322
- Joined: Thu Sep 21, 2006 7:45 pm
- Location: 26000 Valence, FRANCE
- Contact:
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).
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).
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?
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?
I think i've worked out the best methoid of detecting at least all current versions of emulators..
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
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
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