Page 1 of 1

first address read after Oric power on

Posted: Fri May 22, 2020 12:47 pm
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()


Re: first address read after Oric power on

Posted: Fri May 22, 2020 1:07 pm
by iss
goyo wrote:
Fri May 22, 2020 12:47 pm
What 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 pm
Also, 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.

Re: first address read after Oric power on

Posted: Fri May 22, 2020 1:51 pm
by goyo
Thanks a lot Iss! :D

Re: first address read after Oric power on

Posted: Fri May 22, 2020 5:31 pm
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 :)