1st instruction on boot ?

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
Symoon
Archivist
Posts: 2310
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

1st instruction on boot ?

Post by Symoon »

I was wondering what is the 1st instruction exectuded in ROM when the Oric boots? Is it on #C000 ? I tried to change the ROM in Euphoric by doing a JMP#C000 in C000, but everything booted normally.
:?
jede
Flying Officer
Posts: 191
Joined: Tue Mar 14, 2006 11:53 am
Location: France

Re: 1st instruction on boot ?

Post by jede »

Symoon wrote:I was wondering what is the 1st instruction exectuded in ROM when the Oric boots? Is it on #C000 ? I tried to change the ROM in Euphoric by doing a JMP#C000 in C000, but everything booted normally.
:?
I don't understand, you mean "Where is the first instruction ?"

6502 starts at NMI vectors (ie $fffa).

If you want to do a ROM here is the code i use to do my own ROM in an EEPROM :

Xa syntax :

Code: Select all

*=$c000
_start
 rts
_end_rom

.dsb $ffff-_end_rom-5,0	
; NMI
*=$fffa
.byt <_start
.byt >_start
; RESET	
*=$fffc
.byt <_start
.byt >_start
; IRQ
*=$FFFE
.byt <_start
.byt >_start
If you want a sample code and a .rom, i can sent it.
User avatar
Symoon
Archivist
Posts: 2310
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

Well I wanted to know the 1st instruction read by the Oric, in other words the 1st adress the Oric reads in ROM when it boots.
You're right, the idea was to know how to make my own ROM: if I want to make it, I'll have to start my code somewhere ;-)

Thanks, seems #FFFA works, I just made an infinite loop there (JMP#FFFA) and the Oric hangs when I boots, so it seems good!

Thanks for your code sadly I don't understand it. I have never learnt to code in assembler, I directly code op-codes in hexadecimal (yes, I know :roll: ). I don't know "XA", from what I've already read in this forum I guess it's a way to code in assembler?
jede
Flying Officer
Posts: 191
Joined: Tue Mar 14, 2006 11:53 am
Location: France

Post by jede »

Symoon wrote:Well I wanted to know the 1st instruction read by the Oric, in other words the 1st adress the Oric reads in ROM when it boots.
You're right, the idea was to know how to make my own ROM: if I want to make it, I'll have to start my code somewhere ;-)

Thanks, seems #FFFA works, I just made an infinite loop there (JMP#FFFA) and the Oric hangs when I boots, so it seems good!

Thanks for your code sadly I don't understand it. I have never learnt to code in assembler, I directly code op-codes in hexadecimal (yes, I know :roll: ). I don't know "XA", from what I've already read in this forum I guess it's a way to code in assembler?
You can download xa, (osdk). You put my code in a txt file, and in command line :

xa MYFILE.ASM

You will have a a.o65, you can rename it to toto.rom and it will work in any emulator.

Don't forget to clean video RAM when you do your own rom, and don't forget to put a charset in your rom (and copy it in charset address)
highwayman
Flying Officer
Posts: 148
Joined: Fri Oct 12, 2007 8:08 pm

Post by highwayman »

it's not that simple,

get yourself a manual for the 6502 cpu.

there are 3 vectors,
fffa
fffc
and fffe

one is reset - aka the startup address, the others are IRQ & NMI

if you arent carefull the interupts will crash your code.
the first instruction should be $78 if i remember right,
to block interupts from pulling the cpu out of your code loop.

you can re-enable them once your ready.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Post by Godzil »

Symoon wrote:Well I wanted to know the 1st instruction read by the Oric, in other words the 1st adress the Oric reads in ROM when it boots.
You're right, the idea was to know how to make my own ROM: if I want to make it, I'll have to start my code somewhere ;-)

Thanks, seems #FFFA works, I just made an infinite loop there (JMP#FFFA) and the Oric hangs when I boots, so it seems good!

Thanks for your code sadly I don't understand it. I have never learnt to code in assembler, I directly code op-codes in hexadecimal (yes, I know :roll: ). I don't know "XA", from what I've already read in this forum I guess it's a way to code in assembler?
No you're wrong,

the 6502 when it reset read the two bytes at #FFFC and #FFFD, they will give it the start function address, i.e. i will do at start a

jmp ($FFFC)

so to make a rom, you need to decide a start address for your code, and change the value at $FFFC/D to point on your start address.

Don't hesitate to ask me in French in you want, it could be easier to explain sometimes ;)
User avatar
kenneth
Squad Leader
Posts: 516
Joined: Fri Nov 26, 2010 9:11 pm
Location: France PdD
Contact:

Post by kenneth »

Hello.
(the same in french)
Le 6502 demarre en lisant l adresse contenue en FFFC et FFFD, le contenu de ses deux adresses est l' adresse de la première instruction du programme qui initialise la machine. La mise sous tension de la machine équivaut a un saut indirect absolu. (les deux octets de l'adresse intermédiaire qui indique l'adresse finale).
Si tu crée une ROM fait attention de bien inhiber les deux autres vecteurs d interruption, sinon ton programme risque de planter.
:wink:
User avatar
Symoon
Archivist
Posts: 2310
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

Thanks to all for the replies !
Seems clearer to me now.
Igotafro
Officer Cadet
Posts: 47
Joined: Tue Feb 05, 2008 3:42 pm

Re: 1st instruction on boot ?

Post by Igotafro »

Can you connect a ROM on the expansionport somehow? Many other computers used games on cartridges, did Oric ever have those?
The Microdisc ROM works like this in a way, doesn't it?
highwayman
Flying Officer
Posts: 148
Joined: Fri Oct 12, 2007 8:08 pm

Re: 1st instruction on boot ?

Post by highwayman »

easy,
just map it to the adreess you want and use /ROMDIS to disable the internal rom.


better yet,
use a ferro-ram or battery-backed ram,
set it so the romdis signal and the /OE signal on the ram can be fliped on & off.

then you can power your oric & do something like.
for a = $c000 to $ffff
x = peek a
poke a,x
next

for something like that - not used basic in decades!
that should copy your internal rom to your external device.
then change the jumper/switch and your running from it.
then you can patch it on the fly.
Post Reply