first address read after Oric power on

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
User avatar
goyo
Officer Cadet
Posts: 52
Joined: Sat Jan 12, 2019 10:16 am

first address read after Oric power on

Post by goyo »

Hi !

I would not to learn a bit more about Oric Emulation and working.

What is the first address that Oric 6502 execute in memory after cpu power on? is it 0x1000 ?

Also, witch compiler is requiered to compile Oricutron , is it gcc ?

Code: Select all

from py65emu.cpu import CPU
from py65emu.mmu import MMU

f = open("program.rom", "rb")  # Open your rom

# define your blocks of memory.  Each tuple is
# (start_address, length, readOnly=True, value=None, valueOffset=0)
m = MMU([
        (0x00, 0x200), # Create RAM with 512 bytes
        (0x1000, 0x4000, True, f) # Create ROM starting at 0x1000 with your program.
])

# Create the CPU with the MMU and the starting program counter address
# You can also optionally pass in a value for stack_page, which defaults
# to 1, meaning the stack will be from 0x100-0x1ff.  As far as I know this
# is true for all 6502s, but for instance in the 6507 used by the Atari
# 2600 it is in the zero page, stack_page=0.
c = CPU(mmu, 0x1000)  # first address ?

# Do this to execute one instruction
c.step()

User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: first address read after Oric power on

Post by iss »

goyo wrote: Fri May 22, 2020 12:47 pmWhat is the first address that Oric 6502 execute in memory after cpu power on?
After power-on i.e. after RESET the CPU reads address stored at location $FFFC and $FFFD and jumps to that address.
For instance in Atmos ROM v1.1b: at $FFFC is 8F and at $FFFD is $F8, so the CPU will start at $F88F. You can use:

Code: Select all

CALL#F88F
from BASIC to check the result :)
goyo wrote: Fri May 22, 2020 12:47 pmAlso, witch compiler is required to compile Oricutron , is it gcc ?
GCC is OK for Oricutron compilation but it's not the only option. Actually the source is very close to the ANSI-C standard so you should be able to use any standard C compiler depending on the platform on which the compiled binary will be executed.
User avatar
goyo
Officer Cadet
Posts: 52
Joined: Sat Jan 12, 2019 10:16 am

Re: first address read after Oric power on

Post by goyo »

Thanks a lot Iss! :D
User avatar
mikeb
Flight Lieutenant
Posts: 282
Joined: Wed Sep 05, 2018 8:03 pm
Location: West Midlands, UK
Contact:

Re: first address read after Oric power on

Post by mikeb »

@iss answer is technically correct, but a real 6502 spends at least the first few cycles groping around in the dark until the internal reset has completed. So there could be a few rather odd accesses before it reads from #FFFC/#FFFD and then outputs the address it finds there for the first read.

Although this is not an Oric, Ben Eater has been snooping on what a 6502 gets up to, you can see some of this behaviour in his videos from
“Hello, world” from scratch on a 6502 — Part 1 forward. If there's power, and a clock, the processor just gets going, and once reset happens, it continues bumbling along for a few cycles.

https://www.youtube.com/user/eaterbc/vi ... _polymer=1

I don't think any emulators bother with this pre-reset step :)
Post Reply