OSDK Understanding Question

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
coco.oric
Squad Leader
Posts: 720
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

OSDK Understanding Question

Post by coco.oric »

Hi, i'm "searching" the best way to make some code with OSDK.
May be the best solution is a mix between C and 6502 code.
In this way, is it the memory map i can use (in hires mode) :

from 0 to $4F : ok
from $50 to $FF : depending on C function call
from $400 to $4ff : ok if i'm not using the disk libraries
from $500 to $97ff : ok
from $9800 to $9bff : char set
from $9c00 to $9fff : alt set
from $a000 to $bfdf : hires screen
from $bfe0 to $bfff : ok

i understand that the start of the code is on the osdk_config.bat
(SET OSDKADDR=$800
SET OSDKLINK=-B
SET OSDKNAME=HWADVANCED
SET OSDKFILE=main print)
in this case $800.

so can i :
- put this start adress to $500
- setting different adresses of code with
- align a page with : ".dsb 256-((*+256-$80)&255)"


and about sedoric :
- how to make function calls like loading a file.dat at a specific place in memory ?
- how to make a DSK with osdk ?


By advance Thanks.
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK Understanding Question

Post by Chema »

Hi, let's see if I can help with some of these...
coco.oric wrote: May be the best solution is a mix between C and 6502 code.
Sure, that is quite easy. Remember that you can always access variables and routines written in asm (put an underscore before the C name, such as _printf, or _counter). For passing parameters remember the convention: SP points to the parameter list, so (sp),y to access them. They are stored as two byte, despite their type, so lda (sp),y with y=0 loads the low byte of the first parameter, with y=1 the high byte (if the param is a char or byte, this can be ignored), and y=2,3 for the second and so on.

Returned result uses register x and a for low and high bytes.
In this way, is it the memory map i can use (in hires mode) :
I think that is basically correct. Just as a side note, unless you really need zero page vars in a huge amount, use the directives in asm to set them and forget about where they lie on:

Code: Select all

.zero
onezpvar .byt 00
.text
....

.zero
azppointer .word 00
.text
...
i understand that the start of the code is on the osdk_config.bat
(SET OSDKADDR=$800
SET OSDKLINK=-B
SET OSDKNAME=HWADVANCED
SET OSDKFILE=main print)
in this case $800.

so can i :
- put this start adress to $500
- setting different adresses of code with
- align a page with : ".dsb 256-((*+256-$80)&255)"
Yep. The min address where code can start is $500. The second one, I don't understand. The third... don't understand either, but the usual way to align code to a page is .dsb 256-(*&255)
and about sedoric :
- how to make function calls like loading a file.dat at a specific place in memory ?


Ok, there is no file handling in the C library. There is a hack (sort of) to invoke sedoric commands, though, using the function "sedoric". It is there in the lib folder, but apparently not in the *.h, for what I see here. Clearly it needs the command to run as a pointer to string.

Other ways of accessing the dos or the oric ROM are via CALL or using the shriek sign "!". Two C functions do this (sys/oric.h).

Code: Select all

void call(int address);
void bang(char *command);
- how to make a DSK with osdk ?[/b]
Now it is easier than ever. I just have this in my osdk_config.bat

Code: Select all

:: List of files to put in the DSK file.
:: Implicitely includes BUILD/%OSDKNAME%.TAP
SET OSDKTAPNAME="TINE"
SET OSDKDISK=oobj3d\overlay.tap  
SET OSDKDNAME=" -- 1337 --"
SET OSDKINIST="PAPER 0:INK 0:HIRES:TINE.COM"
Not sure how to put just the tap file in the dsk (not sure about why do this anyway), but you can include the files you need, give a name and even set the Init statement (INIST).

Hope this helps

Cheers
User avatar
coco.oric
Squad Leader
Posts: 720
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Post by coco.oric »

Thanks a lot.
I'm trying to upgrade my understanding of OSDK, using the mixed c example.

with SET OSDKADDR=$500 in the osdk_config.bat
and modifying the print.s by insert *=$9000 at the start

the label are good
map is :
Adress Size Name
$500 17 osdk_start
...
$9000 28 ScreenAdressLow
$901c 28 ScreenAdressHigh
$9038 39 _AdvancedPrint

but the TAP doesn't work. A lot with ORIC EXPLORER shows me that the code of the print.s isn't in the TAP program made by OSDK.
is it a bug or i've made a mistake.
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

Same thing occured to me in 1337. I asked Dbug and the answer is quite straightforward, really.

XA does not support what you are trying to do. Basically it does not support code splits like that. Code should be generated, with all the addresses correctly set as if it were in $9000 but will be appended at $500. You need to copy it manually (inside your program).

Else you need to generate different tap files and load them separately. XA won't fill the gap inside. In fact I think Dbug told me that it was not XA but that there is not an Oric format which supports that.

You can fill the gap manually using something like

Code: Select all

.dsb $9000-*
or just set your start address at $9000.

If you tell what you are exactly trying to do, we would be able to be more specific.

Regards
User avatar
Nox
Officer Cadet
Posts: 36
Joined: Wed Feb 24, 2010 2:49 pm
Location: Berlin
Contact:

Post by Nox »

Ah, that was some very useful information for me, too.
So that is the thing called "Overlay", making an extra .tap and loading it to $a000?
Does the C-Compiler/assembler/linker "stop" at $97ff, throwing an out of memory-error or anything like that?
Or does it just overwrite charset, altcharset, hires-screen...?
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

Nox wrote:Ah, that was some very useful information for me, too.
So that is the thing called "Overlay", making an extra .tap and loading it to $a000?
Does the C-Compiler/assembler/linker "stop" at $97ff, throwing an out of memory-error or anything like that?
Or does it just overwrite charset, altcharset, hires-screen...?
Not really. Overlay ram is only accessible when using a disk drive. What you can do is either use it for large buffers (uncompressing pics for instance or generating tables), or load parts from disk there, as I do. I am not sure if the osdk currently provides mechanisms for managing overlay in such way in a direct manner. What I am doing is:
1 load main program ($500-upwards up to $9fff where hires starts).
2 call a routine inside the program which:
3 activates overlay ram (that depends on the disk drive or you can use a vector in page 4 to do that).
4 use sector based access to disk data (posted somewhere else) to load code into $c000 and upwards.

If anybody needs this, we can open another thread and post details about how this can be achieved step by step.

For what I know the compiler does not stop at any address. I think it can even produce a file so large that cannot be loaded into the Oric.

An osdk program might load from $500 to $bfff ($c000 is start of ROM), I think.
Post Reply