User Tools

Site Tools


oric:software:orics_compatibility

To have a code working on the 3 machines : Generic rules

- Don't call any ROM routines or see bellow

- Don't call sedoric routines

- Don't call Microdisc eprom : you don't have eprom on telestrat, telestrat boot on the floppy from a cardridge. It means that the cardridge (mainly stratoric or stratsed) reads boot sector. On the atmos/microdisc, eprom on floppy controller override internal rom to read the boot sector.

- If you use overlay RAM, you have to detect if you are on an oric -1/atmos or telestrat. To switch to ram overlay on the telestrat, you have to set bit 0, bit 1, bit 2 to 0 on the port A of the second via ($320) on the telestrat (Don't forget to SEI and set IRQ vectors).

- For Telestrat : if you have to manage IRQ (CPU receives an IRQ in the code), you should stop IRQ from VIA2. It can generate IRQ from VIA2 timers (or others stuff). If you don't inhibits this second via, you could received some IRQ from this via which could crash your code. Telemon (telestrat) does not have the same IRQ vectors than atmos, please load irq vector with CPU irq vector !

How can i do a code which works on telemon and atmos

You have to do 2 versions, but you can have one source code (you can detect telestrat, to have one object). You could do one version, but it means that any routine have to be in RAM

You have to know that

  • Telemon has a different IRQ vectors than atmos (atmos : $244/$245/$246 telemon : $2fa,$2fb,$fc)
  • hires routines does not have the same calls (telemon : brk $1a/Atmos : jsr $ec33)
  • if you redirect irq vectors for telemon all brk calls won't work. you have to restore irq vectors each time you need to call roms on telemon
  • Zero page : if you want to restore telemon after your program, you should use “#define VARAPL $D0” to use all zero page bytes (44) after $d0
  • via6522 : Telemon initialize VIA1 differently than atmos rom. For example, T2 timer is enabled. If you have in your code : “lda VIA_T1CL” , you should do also “lda VIA_T2CL” : You can also disable T2 timer.

Tutorial

  • Download here https://github.com/jedeoric/4kkong/tree/master/include (“macro_basic1_1_compat.h”,“macro_telemon_compat.h”,“routine_compat_telemon.s”)
  • create in your project a “include” folder, put “macro_basic1_1_compat.h”,“macro_telemon_compat.h”,“routine_compat_telemon.s” in this folder

Sample to have different version of rom (telemon/atmos) these sample does not work if you redirect IRQ vectors except if you finished by a jmp ! :


#ifdef TARGET_TELEMON
#include "include\macro_telemon_compat.h"
#else
#include "include\macro_basic1_1_compat.h"
#endif
    
CALL_TEXT ; Macro it's in macro_telemon_compat.h and macro_basic1_1_compat.h

; setup IRQ   (works for telemon, atmos and oric-1
#define source $d0
  
; **************** setup IRQ and keep old IRQ for telemon vectors !
sei
lda $FFFE
sta source
lda $FFFF
sta source+1
ldy #00

lda #$4C
sta (source),y
iny
lda (source),y ; save old vector
sta keep_telemon_vectors_IRQ_BRK+1
lda #<IRQDriver
sta (source),y
iny
lda (source),y ; save old vector high
sta keep_telemon_vectors_IRQ_BRK+2
lda #>IRQDriver
sta (source),y
cli
 
; **************** Read keyboard from telemon vectors ! 
; I want to read keyboard 
#ifdef TARGET_TELEMON
wait_key
CALL_READKEYBOARD ; macro from compat header
cmp #" "  ; space ? Acculator A contains ascii of the 
bne wait_key
#endif  
rts
IRQDriver
keep_telemon_vectors_IRQ_BRK ; in this case all BRK calls for telemon works
     jmp $0000
     rti
end_of_code
#ifdef TARGET_TELEMON
routine_compat_telemon.s
#endif

—-

Detect the machine

It's a bit hard to detect if you are on a telestrat, here are some tips

- The telestrat has a second via. You can detect if you have a second via (You can test timers or any others things), it's not the best way to detect a telestrat

oric/software/orics_compatibility.txt · Last modified: 2016/09/26 17:31 by jede