Creating Oric software on OS X

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Creating Oric software on OS X

Post by Pengwin » Sat Jan 05, 2013 10:45 pm

I've been teaching myself 6502 assembly, using an Atari 800XL emulator, but I would also like to do some dev for Oric.

I am using OS X and have recompiled ATASM and MADS for my Atari development, but I would like to know which cross assembler people here would recommend for developing software for the Oric on the 6502.

I have a working copy of XA, but I am not sure what command switches/directives are needed to create an Oric program.

Any help would be appreciated.

User avatar
Dbug
Site Admin
Posts: 2388
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Creating Oric software on OS X

Post by Dbug » Sat Jan 05, 2013 11:18 pm

Take a look at the OSDK in http://osdk.defence-force.org/.

In the "bin/make.bat" file is the list of all tools being called to build an Oric program, including the XA parameters.

The source code of the OSDK components is available on the SVN server: http://miniserve.defence-force.org/svn/ ... ools/osdk/ and mmu_man has done some work to make the whole stuff portable so it should recompiler natively on macos without too many issues.

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Sun Jan 06, 2013 2:05 am

Dbug wrote:Take a look at the OSDK in http://osdk.defence-force.org/.

In the "bin/make.bat" file is the list of all tools being called to build an Oric program, including the XA parameters.

The source code of the OSDK components is available on the SVN server: http://miniserve.defence-force.org/svn/ ... ools/osdk/ and mmu_man has done some work to make the whole stuff portable so it should recompiler natively on macos without too many issues.
Thanks DBug, I'll look at the SDK.

I'll also have a look at the portable version of the OSDK, see if I can get it to compile here.

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Sun Jan 06, 2013 2:14 am

You'll have to excuse my ignorance. But, am I right in thinking that, for a single source file project, alI need to do is call

Code: Select all

xa source
or

Code: Select all

xa -o ouput source
to create an executable that I can then convert to a TAP file to load into the Oric emulator?

User avatar
Dbug
Site Admin
Posts: 2388
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Creating Oric software on OS X

Post by Dbug » Sun Jan 06, 2013 10:43 am

Pengwin wrote:You'll have to excuse my ignorance. But, am I right in thinking that, for a single source file project, alI need to do is call

Code: Select all

xa source
or

Code: Select all

xa -o ouput source
to create an executable that I can then convert to a TAP file to load into the Oric emulator?
That's correct, but he still needs to generate the correct header, would probably like to generate disk images, convert pictures, and would also probably benefit from having the library source code if only to know rom calls and things like that.

User avatar
polluks
Officer Cadet
Posts: 54
Joined: Tue Jun 05, 2012 10:09 pm
Location: Germany
Contact:

Re: Creating Oric software on OS X

Post by polluks » Sat Jan 12, 2013 3:41 pm

Hi!
You may also try ca65

Code: Select all

cl65 -t atmos hello.s -o hello.tap
http://wiki.cc65.org/doku.php?id=cc65:h ... tforms:osx
cc65 development
Oric Atmos + Cumulus
Acorn Electron

User avatar
Dbug
Site Admin
Posts: 2388
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Creating Oric software on OS X

Post by Dbug » Sat Jan 12, 2013 4:55 pm

polluks wrote:Hi!
You may also try ca65

Code: Select all

cl65 -t atmos hello.s -o hello.tap
http://wiki.cc65.org/doku.php?id=cc65:h ... tforms:osx
Before we settled on XA for the OSDK we did a quick review of the various assemblers, and ca65 appeared to be on the complex side of things: Designed as a back-end for a compiler, with object format for libraries, a not particularly simple or nice to use syntax either.

I would personally suggest to stick to XA if you plan to ask for help later on because most of the experienced Oric coders are using XA and are used to its qwirks. But then the choice is yours, just something to consider :)

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Sat Jan 12, 2013 11:51 pm

Ok, time to show my complete ignorance of things assembly.

I have a very simple program:

Code: Select all

			*=$400 	
			lda $65
			sta $a101
			rts
I use the following command for XA

Code: Select all

xa -o orictest.o orictest.asm
A hex dump of the resulting binary is:

Code: Select all

0000: A5 65 8D 01 A1 60
I understand that this is exactly the assembled code, but I have no idea where to go from there.
When I use an assembler for the Atari 8-bit (MADS and ATASM), the binary also includes the address of where the code is to be placed (as well as creating a complete disk image to use).
What I would like to know, first of all, how to turn this raw object code into an Oric executable, and also what is the best way to turn that into a .TAP image.

I did also try compiling the same source with CL65 (with the .ORG command), but I received the following errors:

Code: Select all

ld65: Warning: [builtin config](7): Segment `TAPEHDR' does not exist
ld65: Warning: [builtin config](8): Segment `STARTUP' does not exist
ld65: Warning: [builtin config](14): Segment `ZPSAVE' does not exist
So, I am assuming I am missing libraries for my CC65 installation.

Sorry for my ignorance, but I would like to start coding for Oric, in assembly, and I would rather do it on my Mac, rather than fire up a Windows emulator.

User avatar
Dbug
Site Admin
Posts: 2388
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Creating Oric software on OS X

Post by Dbug » Sun Jan 13, 2013 12:36 pm

Yes your executable is correct, and as you mentioned what is missing is the header information to tell the Oric where to load the file, that's the reason why I mentioned the OSDK in first place, it's because it has HEADER.EXE which adds correct loading information to a binary file to make it a valid tape file.

You can do that yourself, the header is not very complex, it's just a matter of adding the correct info at the start of the file.

You can find the source code of header on http://miniserve.defence-force.org/svn/ ... header.cpp, just patch the correct values for start and end addresses and you are good to go :)

Now that I'm thinking about it, it would probably be possible to make the header as the part of the assembly source code using a bunch of .byt, something like that:

Code: Select all

// Tape Header
	.byt $16	// 0 Synchro
	.byt $16	// 1
	.byt $16	// 2
	.byt $24	// 3

	.byt $00	// 4
	.byt $00	// 5

	.byt $80	// 6

	.byt $00	// 7  $80=BASIC Autostart $C7=Assembly autostart

	.byt $bf	           // 8  End address
	.byt $40	// 9

	.byt $a0	// 10 Start address
	.byt $00	// 11

	.byt $00	// 12 
	.byt $00	// 12
possibly computing the end address from a label at the start and label in the end of the source code.

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Sun Jan 13, 2013 3:43 pm

I feel like an idiot. Can't believe I didn't think of that myself.

What I can also do is write a quick and dirty console app for OS X that will attach the header for me, including the End Address which can be easily calculated.

Thank you DBug, you are a star!

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Sun Jan 13, 2013 5:11 pm

Just to expand on what you said DBug, I have had a little play and come up with this:

Code: Select all

//Header
			.byt $16,$16,$16,$24,$00,$00,$80
			
			.byt $00   // $80=BASIC Autostart $C7=Assembly autostart
			
			.byt >finish,<finish,>start,<start,$00 

//Program name
			.asc "TEST"
			.byt $00  
   
			*=$400 	
start		lda #65
			sta $a101
			rts
finish		.byt $00
By using the start and finish labels, there is no need to calculate the length of the executable. And by adding a final byte at the end (for the finish label), we can ensure that the entire program is loaded.
I noticed that the addresses for the start and finish are high byte first, which seems a bit odd, but it works, so doesn't matter.

Hope this helps anyone else who has trouble getting the OSDK working.

No on to trying to make something worthwhile :-)

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Mon Jan 14, 2013 8:43 am

Last post on this subject...honestly :-)

By using an include and some very simple conditional compiling, I have now worked out a way to make it even simpler:

I have an include file called "header.s" :

Code: Select all

//Header
			.byt $16,$16,$16,$24,$00,$00,$80
			
#ifdef AUTOSTART
			.byt $c7		
#else						
			.byt $00		
#endif						
						
			
			.byt >_finish,<_finish,>_start,<_start,$00 

//Program name
#ifdef PROGNAME
			.asc PROGNAME
#endif
			.byt $00 
So, now when I create a project, I need only start with:

Code: Select all

#define PROGNAME "TESTNAME"
#define AUTOSTART

#include "header.s"
   
			*=$400 	
_start		nop

_finish		rts
If I don't want to name, or autostart, the program, I can omit the respective #defines.

Sorry if this is teaching you all to suck eggs (I know this is old news to most of you), but I just thought it might be useful for anyone else starting out.

User avatar
ibisum
Squad Leader
Posts: 878
Joined: Fri Apr 03, 2009 8:56 am

Re: Creating Oric software on OS X

Post by ibisum » Mon Jan 14, 2013 8:46 am

Its been great to hear of your progress, don't ever think its boring to hear of these sorts of tricks! :)

User avatar
Dbug
Site Admin
Posts: 2388
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Creating Oric software on OS X

Post by Dbug » Mon Jan 14, 2013 8:29 pm

No need to be optimizing the number of messages.
It's not like you were spaming crap on all the forum :)

As long as it's interesting and does not propagate false information it's good to have that on the forum, if only because it will later appear in the google results if somebody is searching for something similar.

User avatar
Pengwin
Pilot Officer
Posts: 67
Joined: Sun Jan 07, 2007 11:03 pm
Location: Scotland
Contact:

Re: Creating Oric software on OS X

Post by Pengwin » Mon Jan 14, 2013 10:35 pm

Dbug wrote:No need to be optimizing the number of messages.
It's not like you were spaming crap on all the forum :)

As long as it's interesting and does not propagate false information it's good to have that on the forum, if only because it will later appear in the google results if somebody is searching for something similar.
I'm not concerned about my number of posts (Hell, I've been a member since 2007 and have under 50 posts).
I just didn't want to bore people with my obvious ignorance when it comes to these things.

But I know that I will have plenty more questions in the near future as I try to get to grips with the Oric.

Which actually brings me on to my next question... if my program is 100% machine code, can I use some of the zero pages locations that are normally utilised by BASIC, or should I just avoid them altogether?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests