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.
I was doing some tests for my Joystick implementation in Encounter/OSDK, and I realized that calling the Telestrat reading code on an Atmos was resulting in a non working keyboard.
;
; The Telestrat (unlike all its predeccesors) had two joystick Ports positioned on either side of the machine.
; Both were powered and both supported a second fire button. The Joystick (and second fire) was supported by Pulsoids.
; Both joysticks were connected to Port B of the second VIA of the Telestrat whilst the second fire was connected to
; Port A of the Second VIA (Location $032F)
;
; - B7 Select Right Joystick
; - B6 Select Left Joystick
; - B5 -
; - B4 Up (Inverted)
; - B3 Down (Inverted)
; - B2 Fire (Inverted)
; - B1 Left (Inverted)
; - B0 Right (Inverted)
;
; Note that the order is identical to what the IJK joystick interface returns
;
_joystick_read_telestrat
.(
lda #%01000000 ; Select Left Joystick port
sta VIA2_PORTB
lda VIA2_PORTB ; UDFLR
and #%00011111
eor #%00011111
sta _OsdkJoystick_0 ; store to variable
lda #%10000000 ; Select Right Joystick port
sta VIA2_PORTB
lda VIA2_PORTB ; UDFLR
and #%00011111
eor #%00011111
sta _OsdkJoystick_1 ; store to variable
rts
.)
Basically I need to either have this code not break the keyboard inputs, or I need a way to detect that there is a second VIA with joystick support - I believe the Twilighte card supports that - so the selection menu does not ends up failing.
Any idea on how to do that efficiently and reliably?
There migh be a different type of failsafe way of detecting what platform you are running on, like checking certain ROM bytes etc. This is more direct probing on page 3.
The challenge with unexpanded Oric-1/Atmos machines is the incomplete decode of Page 3, which means the normal VIA will have the registers shadow mapped at every 16 bytes aligned slot in this page, 16 times. So you can probably do a two stage check.
1. Keyboard hang avoidance - Once on setup, when writing a VIA read/write register (i.e. not the ports), read it back before and after from a shadow location. If it tracks your write, you have VIA replication going on.
2. Probe for the VIA2 joystick. This should now be safe(er).
*=$500
sta _machine_type
and #$80
bmi init_telestrat
I have no idea why reg A comes with bit 7 set to 1 in a Telestrat after boot, but might give a clue. Maybe it is due to STRATORIC initializing the second VIA or simply due to different boot code.
Dbug wrote: ↑Sun Mar 09, 2025 7:31 pm
Check if I have the sames values in $306+16 and $307+16, if yes then it's an standard Oric and disable the Telestrat detection.
Indeed! I was thinking the same , also to be sure you can check that at #324/325 is a decrementing timer too.