Hi Michal,

Here's the default paging setup in SAM BASIC:

0000-3FFF: ROM0 (underneath is RAM page 31)
4000-7FFF: RAM page 0, some of which is system variables
8000-BFFF: RAM page 1 (first free page)
C000-FFFF: RAM page 2

BASIC addresses beyond 64K just extend into the remaining RAM pages, so
65536 is the start of page 3, 81920 is page 4, etc.   Running code from
addresses 0 to 65535 keeps the paging setup as described above when
entering your code.  Running from beyond the 64K limit pages the
required page into the upper 32K and runs it from there.  So, CALL 65536
will give you page 3 at &8000 and page 4 at &C000 when your code is
entered.  The final 2 RAM pages contain the display memory, which is
pages 30+31 on a 512K machine.

SimCoupe's data import/export give the choice of using BASIC addresses
(as described above) or a raw page+offset in main memory.  It sounds
like you may have imported to page 0 offset 16384, which is equivalent
to page 1 offset 0, or 32768 as seen from BASIC.  If you really want
your code at BASIC address 16384, enter it using the BASIC Address
option when importing the data.  Be aware that you might only have a
couple of K free at that address before you start to run into system
buffers -- I'd recommend starting from 32768 (page 1, offset 0) instead.

I've released code for some of my SAM programs
(https://github.com/simonowen), though some are fairly specialist!  I
think all use Andrew Collier's pyz80 assembler
(http://www.intensity.org.uk/samcoupe/pyz80.html), which assembles
directly to a SAM disk image (optionally bootable).  If you haven't
already got it, be sure to download the SAM Coupe Technical Manual for
general hardware information: 
ftp://ftp.nvg.ntnu.no/pub/sam-coupe/docs/manuals/software/SAM%20Coupe%20Technical%20Manual.zip

Si

On 02/12/2012 00:06, Michal Jurica wrote:
> Hello!
>
> I'm new one here. I'm a spectrum coder and I want to play with Sam
> Coupe. And here comes troubles with running my code. The idea is that
> I prepare binary file with my code, load it into simcoupe (key F4) and
> run it with RANDOMIZE USR xxx. Problem is that I don't understand
> relation between basic adressing (for USR function) and physical
> addressing. If I load binary code at basic adress 16384, it appear at
> physical address 32768, but when I run RANDOMIZE USR 16384 it jump at
> 16384.
>    How do you run your machine code programs? Exists some examples?
>
> Thanks for answers and keep coding,
>
> mike/zeroteam

Reply via email to