Contiki on Oric Atmos?

This is the best place to discuss about the various Oric operating systems like Sedoric, Randos, FT-Dos, and others, as well as serious software, utilities, word processors, disassemblers, etc... that runs on oric computers.
User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Contiki on Oric Atmos?

Post by carlsson »

Most of you probably know about the operating system Contiki, which was developed primarily for Commodore 64. It has been ported to a lot of other 6502 based systems, as well as other CPUs. The operating system is written in C, tailored for the cc65 compiler. I know Oric developers may prefer a different C compiler though.

cc65 today has limited support for Oric Atmos. Simple programs can be compiled, but there is no true file I/O and a lot of other shortcomings in the library. There exists a high resolution graphics driver though.

While I played around with compiling the latest release of Contiki for VIC-20 (which I'm the port maintainer of), I decided to see how far an Oric port would go. Without file I/O, the dynamically loaded modules would have to be linked statically to the executable. In my attempts so far, I forgot to link the required modules, so when I start the system, almost nothing happens.. :oops:

From my experience with the VIC-20 port, it appears that about 40K of available RAM is the least required to get Contiki running with a basic window system and network support. The C64 can switch out the ROMs and get all 64K available. How much memory can I expect to squeeze out from a 48K Oric Atmos? Are there some special tricks, and would they be easy to apply from C?

Is anyone interested in Contiki? Is there some support (file I/O, other interesting library functions) in the OSDK that could be transferred to cc65? Which of the compilers generate the best code and is most complete, i.e. is it likely that Contiki would compile with lcc65? I know from attempts to run it on Z80 platforms, that both z88dk and sdcc were incompatible but after much tweaking there was an Amstrad CPC port last year.
Anders Carlsson
nodoid
2nd Star Corporal
Posts: 22
Joined: Tue Jan 17, 2006 1:34 am
Location: UK
Contact:

Re: Contiki on Oric Atmos?

Post by nodoid »

carlsson wrote: From my experience with the VIC-20 port, it appears that about 40K of available RAM is the least required to get Contiki running with a basic window system and network support. The C64 can switch out the ROMs and get all 64K available. How much memory can I expect to squeeze out from a 48K Oric Atmos? Are there some special tricks, and would they be easy to apply from C?
If you know the trick, another 16k is available above the 48k page limit. However, in general terms, it's about 46k.
Is anyone interested in Contiki? Is there some support (file I/O, other interesting library functions) in the OSDK that could be transferred to cc65?
Dunno. With luck, I'll have the OSDK this weekend so may be able to answer that. dbug probably can now if he's around.
Which of the compilers generate the best code and is most complete, i.e. is it likely that Contiki would compile with lcc65? I know from attempts to run it on Z80 platforms, that both z88dk and sdcc were incompatible but after much tweaking there was an Amstrad CPC port last year.
What did you do to the z88dk? I'm the rpm builder for it under Fedora Core Linux.
User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Post by carlsson »

I didn't do anything with z88dk - I have never touched a Z80 machine other than the broken ZX Spectrum I have in a drawer. ;-)

Kevin Thacker used a "heavily modified version" of sdcc. Dunno if any of the changes became part of the compiler distribution though.

Contiki: http://www.sics.se/~adam/contiki/

The default Oric Atmos memory configuration file that comes with cc65 suggests RAM from $0500 to $9300, which is 35.5K. From the memory map on this site, it seems free memory is up to $9800, and then follows another 7K of memory reserved for hires. That would make 43.75K, but obviously I'm a newbie on these matters, so many of you probably know this much better.
Anders Carlsson
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

Here is a rough memory map for the Oric:

page 0: variables, pointers, etc. used by the Microsoft Basic core
page 1: stack (you knew)
page 2: variables used by Tangerine's extensions to the Basic kernel
page 3: I/O page (hardware)
page 4: free if no disk controller is present, otherwise contains routines that allows to switch between the rom and the overlay ram

0500-... Basic program area

then it depends if you need the HIRES screen or not:

In HIRES mode:

9800-9FFF: two sets of character definitions (it really starts at 9900 for the SPACE character because ASCII characters below 32 don't have their bitmaps displayed)
A000-BF3F: the HIRES screen (200 lines of 40 cells)
BF40-BF67: free
BF68-BFDF: 3 TEXT lines under the HIRES screen
BFE0-BFFF: free

In TEXT mode:

B400-BB7F: the two sets of character definitions are now here (but the second one is not complete, it lacks 16 characters at the end)
BB80-BFDF: the TEXT screen (28 lines of 40 columns)
BFE0-BFFF: free

Then,

C000-FFFF: ROM (contains the Basic interpreter)

All 48K Orics actually have 64K of ram, the ram at addresses C000-FFFF is called "overlay ram" and can only be accessed when disabling the rom externally (from an add-on on the expansion port, like the disk controller).
But most disk operating systems load their code in this overlay ram...

Cheers,

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

Re: Contiki on Oric Atmos?

Post by Dbug »

Most of you probably know about the operating system Contiki, which was developed primarily for Commodore 64. It has been ported to a lot of other 6502 based systems, as well as other CPUs. The operating system is written in C, tailored for the cc65 compiler. I know Oric developers may prefer a different C compiler though.
Well, lcc65 is quite ANSI compliant.
If Contiki is cleanly writen, there's no reason it could not be compiled with the OSDK.

The fact that Oric developers prefer a different C compiler is not a general case. For example Jede has been using CC65 from the start, and started some basic standard library code.
cc65 today has limited support for Oric Atmos. Simple programs can be compiled, but there is no true file I/O and a lot of other shortcomings in the library. There exists a high resolution graphics driver though.
Well, we have most of the standard library working in the OSDK, thanks to the efforts of my predecessors. The parts that not have been implemented are mostly concerning the filesystem, and mostly because the Oric filesystem is very BASIC oriented, and does not have (for what I know) any concept of file handles or bufferisation.

IMO, in order to get that, the best way is to rewrite the DOS entirely. Keeping the fileformat is not necessary, but would make it possible to deal with existing floppies. Of course it's probably possible to do like on the Amiga, and get a standard default filesystem that can be extended later to support other formats.
While I played around with compiling the latest release of Contiki for VIC-20 (which I'm the port maintainer of), I decided to see how far an Oric port would go. Without file I/O, the dynamically loaded modules would have to be linked statically to the executable. In my attempts so far, I forgot to link the required modules, so when I start the system, almost nothing happens.. :oops:
Yep, can understand that.
From my experience with the VIC-20 port, it appears that about 40K of available RAM is the least required to get Contiki running with a basic window system and network support. The C64 can switch out the ROMs and get all 64K available. How much memory can I expect to squeeze out from a 48K Oric Atmos? Are there some special tricks, and would they be easy to apply from C?
The advantages is that if we rewrite the DOS, we can get a lot of free memory. We don't need most of what is present in the DOS. A big part of it is just a bunch of code that extend the basic, there's also all the builtin commands to display the directory, stuff like this.

What we need (imo), is just 3 layers of code:
- a hardware level to detect drives, detect disc changes, read and write sectors and format disk. This part could be implemented differently on Jasmin and Microdisc drives.
- a file and disc manager, that understand the concept of files, directory, and disc mapping.
- an implementation of the c standard library, file access (open, read, seek, close), directory acess (opendir, stats),, ...

Correctly done, this would probably use only a fraction of the 16k of overlay memory.
Is anyone interested in Contiki? Is there some support (file I/O, other interesting library functions) in the OSDK that could be transferred to cc65? Which of the compilers generate the best code and is most complete, i.e. is it likely that Contiki would compile with lcc65? I know from attempts to run it on Z80 platforms, that both z88dk and sdcc were incompatible but after much tweaking there was an Amstrad CPC port last year.
All the libraries of the OSDK are available as source code directly in the "lib" folder. Just download and check.

Considering code quality/size, it may be interesting to do some comparisons, and I guess that compiling some parts of Contiki may be a very good idea :)
User avatar
kamelito
Flying Officer
Posts: 182
Joined: Sun Jan 08, 2006 6:34 pm
Location: Nantes, France

Euphoric and RAM Overlay

Post by kamelito »

>Then,

>C000-FFFF: ROM (contains the Basic interpreter)

>All 48K Orics actually have 64K of ram, the ram at addresses >C000-FFFF is called "overlay ram" and can only be accessed >when disabling the rom externally (from an add-on on the >expansion port, like the disk controller).
>But most disk operating systems load their code in this overlay >ram...

Hi Fabrice,

Is it possible to simulate this hardware trick under Euphoric without loading any disk controller ? (how?)

Does the Oric drive I gave you is functionnal ?

What is the latest version of the Euphoric source code ?

Cheers
Kamel
/kml
skype pseudo : kamelitoloveless
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

>All 48K Orics actually have 64K of ram, the ram at addresses >C000-FFFF is called "overlay ram" and can only be accessed >when disabling the rom externally (from an add-on on the >expansion port, like the disk controller).
>But most disk operating systems load their code in this overlay >ram...

Hi Fabrice,

Is it possible to simulate this hardware trick under Euphoric without loading any disk controller ? (how?)

Does the Oric drive I gave you is functionnal ?

What is the latest version of the Euphoric source code ?

Cheers
Kamel
Hello Kamel,

no there's no trick in Euphoric to activate this external signal without plugin a disk controler, it wouldn't be faithful to the real thing, would it ?

Sorry, I didn't reply to your mail because I haven't had any free time to do anything (Oric-related). Just tried to plug it on my Telestrat but have not been able to insert a floppy in it (it is blocked at mid-insertion), I have yet to see what is blocking...

Are you refering to the latest version that was both Linux and Dos compatible ? 0.99b if I remember correctly...

How is the baby ? :-)

Cheers,

Fabrice
User avatar
kamelito
Flying Officer
Posts: 182
Joined: Sun Jan 08, 2006 6:34 pm
Location: Nantes, France

Baby :)

Post by kamelito »

>How is the baby ? :-)

Hi Fabrice,

Elliot is fine thanks, he now walk (since 2 days) :)
I think that he's already addicted to computers, he types on the keyboard and play with the mouse :)

Regards
Kamel
PS any advice to avoid having another computer addict in the house is welcome :)
/kml
skype pseudo : kamelitoloveless
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Contiki on Oric Atmos?

Post by Dbug »

carlsson wrote:From my experience with the VIC-20 port, it appears that about 40K of available RAM is the least required to get Contiki running with a basic window system and network support.
Can Contiki works purely in a 40x28 characters video text mode ?

If yes, then well that's easy, all the memory from $500 to $B3FF is free, that's about 44 KB.
User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Post by carlsson »

Sure, the ctk-conio subsystem is text based. It would look like this:

http://www.cbm.sfks.se/files/oric-contiki.tap (18378 bytes)

That is an early pre-release (March 4th, 2003) and doesn't do much:

Cursor keys to move around. Enter to select. ESC to reach menus, DEL to toggle between windows.

(The C64/VIC version uses F1 for menus and F3 to toggle windows, but Oric lacks function keys and I didn't come up with any better alternatives. On the good side, I found out which key codes the cursor keys generate, so I could contribute some more stuff to the Oric Atmos library of cc65)

I looked into compiling the most recent release, but it is very dependant on a working file I/O so loadable drivers and modules can be used. I've tried to figure out how to link a loadable driver directly onto the binary and use some fake loading, but I know too little about Contiki's inner workings to make it work. Theoretically, I suppose Contiki would be able to load its drivers off tape too, if the TAP file is created in such way that each file is stored in the right order. Is general tape I/O more easy to implement on the Atmos than general disk I/O?
Anders Carlsson
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

For a crappy tape loading routine, please check here:

http://forum.defence-force.org/viewtopic.php?p=228#228
User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Post by carlsson »

Ok, maybe some day.. by the way, did you like the executable? Apart from running it in a console window on some Unix systems (yes, it has been done), Oric may be one of the Contiki capable computers which offers the largest number of rows on a text screen.
Anders Carlsson
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

Yep, so far there is not much things to do with it, but at least it works :)

I guess we could also probably try to find a way to draw nice window borders instead of + = and | :lol:

And yes, with 28 usable lines the Oric is definitively one of the machines that can display the most things.
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

Hello Kamel,

Sorry, I didn't reply to your mail because I haven't had any free time to do anything (Oric-related). Just tried to plug it on my Telestrat but have not been able to insert a floppy in it (it is blocked at mid-insertion), I have yet to see what is blocking...
It was just a bit gripped :-) Now it works fine, a bit noisy when moving the head, but great !
Thanks a lot again, Kamel !
Post Reply