Page 1 of 1

ROM 1.0 / 1.1 compatible programming trick?

Posted: Tue Nov 06, 2018 10:53 pm
by Symoon
By trying to make a code as compact as possible and Oric-1/Atmos compatible, I came with this idea: when I need to change a specific variable in memory that has a different address in ROM 1.0 and ROM 1.1, I can use an indexed instruction, and set an index with the right value according to the ROM. So I don't have to write the whole code twice with different addresses.

For instance, in page 2, the address to jump to the IRQ routine is in $0229 (ROM 1.0) or $0245 (ROM 1.1). The difference $245 - $229 = $1C.
If I want to change this address, I can code
STA $0229,Y
having pre-loaded Y with 0 or $1C according to the ROM I'm using. Which means I must test the ROM before...

Except that there are ROM locations, for instance $FF47, which hold the value $00 in ROM 1.0, and $1C in ROM 1.1!
Such specific ROM locations will allow to directly set the right value, no matter the ROM version.

So to change the IRQ routine address on Oric-1 or Oric-Atmos, I should simply have to write:

Code: Select all

AC 47 FF  LDY $FF47    ;ROM 1.1: add 1C to the interrupt address; ROM 1.0: add zero to interrupt address
A9 50     LDA #$50      ;redirectinq IRQ
99 29 02  STA $0229,Y  ;to $0150
A9 01     LDA #$01     ;ROM1.0: 229-22A ; ROM 1.1: 245-246
99 2A 02  STA $022A,Y
(not tested yet).
I wonder if such trick has been used before?
PS: it won't work if the difference is larger than 255 bytes (maximum Y value).

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Wed Nov 07, 2018 7:16 am
by Symoon
Ok, one drawback is that any ROM modification puts the program in jeopardy - but just as any program actually.
To make it more reliable, I'm looking for a dump of the 1st Oric Atmos ROM V1.1, the one that produced many "Errors Found".

Does anyone know if it's available to download somewhere?
Thanks

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Wed Nov 07, 2018 11:30 am
by romualdl
Well I have some roms at home, what checksum are you looking for (or not looking).
If needs be I also still have a dozen atmos at home, I can dump the rom if one fits your criteria (any way to check which rom you are looking for/revision board etc).

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Wed Nov 07, 2018 9:53 pm
by Symoon
Thanks. I have absolutely no idea of checksum values! Anyway, don't worry, L'Oric A Nu gives useful information: only the area $E4B6 - $E4D1 differs between the two versions of the ROM 1.1
So I'll just avoid this area to pick "double values".

I'm currently working on an simple Excel file holding ROM 1.0 and ROM 1.1 bytes values at the same address, and the difference between the two.

PS: good to have you back Romu ;)

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Thu Nov 08, 2018 2:15 pm
by Chema
I am sure Fabrice has dumps of most ROMs... in fact he sent me (us?) once a file with the checksum value of all the roms...

I have it here:

Code: Select all

CRC32   	Identification


Roms 256 octets:

0C82F636	Eprom pour controleur disquette Pravetz 8D


Roms 2 Ko:

37220E89	Eprom Jasmin
ACB2DD34	Eprom contrôleur Cumana 1


Roms 8 Ko:

94358DC6	Telematic originale
A9664A9C	Eprom Microdisc originale
227529C2	Eprom Microdisc modifiée (8 Ko): démarrage sur le Basic si boot disquette échoue.
19D5BB01	Eprom Microdisc modifiée (8 Ko): démarrage sur disque dur IDE si boot disquette échoue (prototype)


Roms 16 Ko:

F18710B4	Basic 1.0 original
A65D6CED	Basic 1.1 original première mouture, appelé aussi Basic 1.1a
C3A92BEF	Basic 1.1 original deuxième mouture, appelé Basic 1.1b (ne compte pas les erreurs K7 pendant la bande amorce, et n'empêche pas le démarrage en cas d'erreur K7)
08E06953	Basic 1.1b modifié fourni avec Sedoric 1.0: au reset, n'autorise les interruptions qu'après l'installation des vecteurs
9FD687C7	Basic 1.1b modifié : utilisation du vecteur $0238 pour l'affichage.
6995DD24	Basic 1.1b modifié : PB5 préservé, chargement d'un programme Basic depuis la 2e rom (PB5Lib d'André)
72B14D15	Basic 1.1b modifié : avec indicateur de banque Telestrat (et affichage copyright)
603B1FBF	Basic 1.1b modifié : routine de clavier français (gestion AltGr, et chiffres avec SHIFT en mode CAPS)
1752DF63	Basic 1.1b modifié : routine de clavier français FR2 (gestion AltGr, et chiffres sans SHIFT en mode CAPS)
28B26D35	Basic 1.1b modifié : vecteurs d'interruption 65816, caractères compressés (tournés), routine clavier FR2
5F368A13	Basic 1.1b modifié : attributs 60 Hz.

303370D1	Basic 1.1b modifié : routine de clavier UK (gestion AltGr)
A71523AC	Basic 1.1b modifié : routine de clavier suédois (gestion AltGr)
47BF26C7	Basic 1.1b modifié : routine de clavier espagnol (gestion AltGr)
65233B2D	Basic 1.1b modifié : routine de clavier allemand (gestion AltGr)

DC4F22DC	Basic 1.2 (P. Leclerc) : 1.1b corrigée, RESTORE n, minuscules acceptées
47A437FC	Basic 1.2 avec routine de clavier français (chiffres avec SHIFT en mode CAPS)
00FCE8A6	Basic 1.2 avec routine de clavier UK
100ABE68	Basic 1.2 avec routine de clavier suédois
70DE4AEB	Basic 1.2 avec routine de clavier espagnol
F5F0DD52	Basic 1.2 avec routine de clavier allemand

0A2860B1	Basic 1.21 (P. Leclerc) : 1.2 + amélioration de la commande DRAW
E683DEC2	Basic 1.21 avec routine de clavier français (chiffres avec SHIFT en mode CAPS)
75AA1AA9	Basic 1.21 avec routine de clavier UK
E6AD11C7	Basic 1.21 avec routine de clavier suédois
87EC679B	Basic 1.21 avec routine de clavier espagnol
94FE32BF	Basic 1.21 avec routine de clavier allemand

5EF2A861	Basic 1.22 (P. Leclerc) : 1.21 + symbole Euro à la place de la Livre Sterling
370CFDA4	Basic 1.22 avec routine de clavier français (chiffres avec SHIFT en mode CAPS)
9865BCD7	Basic 1.22 avec routine de clavier UK (garde Livre Sterling mais renumérotation 1.22 et mise à jour de l'année)
E7FD57A4	Basic 1.22 avec routine de clavier suédois
9144F9E0	Basic 1.22 avec routine de clavier espagnol
9A42BD62	Basic 1.22 avec routine de clavier allemand

7F10F07F	Basic Evolution v1.0
EC11A8CE	Basic Evolution v1.0 avec clavier français (chiffres avec SHIFT en mode CAPS), version beta
FF87A38C	Basic Evolution v1.0 avec clavier français (chiffres avec SHIFT en mode CAPS)

F8D23821	Pravetz 8D

5BA27A7D	Telemon 2.3 original
AA727C5D	Telemon 2.4 original
6F1E7857	Telemon 2.4 avec suppression de la temporisation de désactivation de la RS232
CDA92497	Telemon 2.4 avec routine de clavier français (gestion AltGr)
B9830BED	Monitor (Telemon modifié) pour Oric PB5, avec gestion ACIA
B07B442B	Monitor (Telemon modifié) pour Oric PB5-Strobe
952DDDE3	Monitor (Telemon modifié) pour Oric PB5, sans gestion ACIA

1D96AB50	Hyperbasic 2.0B original pour cartouche avec TeleAss
31B10476	Hyperbasic 2.0B original pour cartouche sans TeleAss
83E9B9C9	HyperBasic modifié pour Oric PB5

D8C635B2	Teleforth v1.1 original
BC729530	Teleforth v1.2 : bugs corrigés par Thierry Bestel

68B0FDE6	TeleAss original
84F0A4ED	TeleAss modifié pour Oric PB5

491C3839	Telematic dupliqué (2x 8Ko)
E0FB199A	Telematic modifié (16 Ko) pour Oric PB5

21FE20D8	Stratoric 1.0
13B696A4	Stratoric 3.0
EF232DD9	Eprom Microdisc modifiée pour Stratos/Telestrat (boote OricDos/Randos/Sedoric sur disquette, ou disque dur (prototype))

88C3E656	Banque 1 de la cartouche Adresstel
87835947	Banque 2 de la cartouche Adresstel
E933C288	Banque 3 de la cartouche Adresstel
B488C801	Banque 4 de la cartouche Adresstel

1726B182	Rom diagnostic v1

But I am quite sure in the sold Orics there were only 1.1 original (the once called 1.1a, I have this one with the correct checkum check, which generates a lot of Errors found) and the 1.1b (with the check completely removed, so no errors even if there were errors :shock: ).

While developing skooldaze we had a nice discussion about ROMs and error checking. Fabrice said:
About the differences between 1.1a and 1.1b, the routine E4AC has been
modified starting from E4B6 in order to insert that STX 02B1 as you
mentioned, and the conditional branches after the two tests for 02B1
have been replaced by NOPs, that's all...

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Fri Nov 09, 2018 7:39 am
by Symoon
Thanks Chema. I recalled there was a list somewhere but couldn't locate it anymore.

I realised that, since JMP or JSR are not using indexed addressing, the trick is rather limited finally.

Re: ROM 1.0 / 1.1 compatible programming trick?

Posted: Tue Nov 27, 2018 6:41 am
by NekoNoNiaow
Symoon wrote: Tue Nov 06, 2018 10:53 pm By trying to make a code as compact as possible and Oric-1/Atmos compatible, I came with this idea: when I need to change a specific variable in memory that has a different address in ROM 1.0 and ROM 1.1, I can use an indexed instruction, and set an index with the right value according to the ROM. So I don't have to write the whole code twice with different addresses.
[snip]
Except that there are ROM locations, for instance $FF47, which hold the value $00 in ROM 1.0, and $1C in ROM 1.1!
Such specific ROM locations will allow to directly set the right value, no matter the ROM version.
I love it! This is really neat.
Regarding your point about crashing for new ROMs versions: you might also have ROM validation code which computes a basic checksum over the ROM that you run at the beginning of your program and guarantees that your tricks will be working. Once that is verified you can use as many ROM-tricks as you want with very high safety.

Note that this trick has a few extensions: in some way the ROMs contain a lot of random data so the chances that they do contain data that you might be interested in is rather high, from small pieces of data to small pieces of code there is a lot of stuff to be reused in some way.

Richard Garriott had to do something similar when trying to fit the Ultima programs in the Apple II memory: he was scurrying the ROM in order to find code that was similar enough to his own code so that he could call it directly even if it was not originally an actual function entry point. ;)
(For the curious, he mentions it in this podcast: