OSDK 1.7

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
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

OSDK 1.7

Post by Dbug »

Hello.

I did not fix all the known issues, but there was a bunch of changes I promised to release regarding FloppyBuilder, so there it is.

You can get the latest OSDK as usual on the OSDK download page.

Regarding the fixed issues, these are done:

Issue #2: Reported by Chema the Fri 20th February 2015
Tap2DSK: Missing INIST and DiskName options
Details: Fabrice's version has two options, -i and -n, that can be used to set the INIST startup string and the name of the disk. The version of the OSDK does not have these options.The issue is actually that MAKE.BAT does not pass the parameters: Replacing the call to Tap2DSk by '%OSDK%\bin ap2dsk.exe -n%OSDKDNAME% -i%OSDKINIST% %OSDKDISK% build\%OSDKNAME%.tap build\%OSDKNAME%.dsk' fixes the issue.
Issue #10: Reported by Dbug the Tue 14th July 2015
FloppyBuilder: Add command to reserve space in description file
Details: It would be nice to be able to reserve a certain number of sectors without having to add a file. That would be particularly useful to reserve space for saving data in a game for example.
As usual, please test it and report any problem you may find.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: OSDK 1.7

Post by iss »

Thanks for update - OSDK 1.7 works perfect for me :).

Here are some details about FloppyBuilder, IMHO, interesting and useful:
- bug in sector_2-microdisc.asm in the relocator code line 75:

Code: Select all

  ldy #0
copy_loop
  lda ($00),y  
  sta FINAL_ADRESS,y
  iny
  cpy _END_-_BEGIN_     <---- this should be: cpy #(_END_-_BEGIN_)
  bne copy_loop
Actually it works and it's clear why it does, but .... it's bug and must be Dbug'ged ;).

- in script file 'AddFile loader $XXXX' - specifying load address for loader is useless now,
because the real value is #define'd in disk_info.h as 'location_loader'. I had the idea to remove
this #define from disk_info.h, and put it in generated 'floppy_description.h', but this will not work
because 'location_loader' must be defined before #include "floppy_description.h" :(
Generating one more 'floppy_locations.h' file which contains only: #define location_loader $XXXX
will solve the problem.

- make ZP usage movable to not conflict with C compiler - actually it can be 'AddDefine location_zp $XX' value which is written to same generated 'floppy_locations.h' file (because of the same reason as above).

- make disk_buffer movable (i.e. not fixed at $200) - the same as ZP.

And some 'nice to have' things are:
- make 'switch to hires' to depend on 'AddDefine' value - this will allow easy to select hires or text during boot.
- make possible to declare 'AddDefine' before 'AddFile' - just for better script readability.
- add command line option to FloppyBuilder tool: -DOPTION=VALUE to overload 'AddDefine'.

Additionally:
I succeeded with 'writing to pre-allocated space'. I didn't used the code from 'disk.s' - it helped me only to find bug in my witting code, which looks just like the 'reading' code. In regard of writing I found very handy to make pre-allocating with simple: 'AddFile dummy_file.bin $XXXX', where 'dummy_file.bin' is an empty file with desired size, than I can access this space for writing exactly as for reading - with the 'FileIndex'. The limitations are clear: fixed file size, the whole file is read/written at once and only uncompressed data - but this is totally OK for 'high-score' or 'save-game' usage :)
So, 'ReserveSectors' seems to me bit useless now, but may be just because I don't know how to use it.

Jasmin booting works now too - it was bit tricky.

I extended the Loader API, here is my 'loader_api.h' - all functions are self explained and working:

Code: Select all

#ifndef __LOADER_API_H__
#define __LOADER_API_H__

void LoadFile(int entryindex);
void LoadFileAt(int entryindex, void* addr);
void LoadFileRun(int entryindex, void* addr);

void SaveFile(int entryindex);
void SaveFileAt(int entryindex, void* addr);

void LoadIndOn(void);
void LoadIndOff(void);

#endif /* __LOADER_API_H__ */
Dbug, because I don't want to make forks of OSDK, I'll be happy to send you my modified code and if you decide to merge it - I'll be happy twice ;).

Sorry for the long post and thanks again for the OSDK release!
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK 1.7

Post by Chema »

Thank for the new update!

As I already told on the OASIS forum, I had an error when trying to use the ReserveSector options (it was not recognized and FloppyBuilder stopped).

I also commented on the location of the zero page variables on that thread. I'd go for making their location movable with a define, as I'd prefer (for example) to have them at the end of zero-page.

EDIT: Sorry, sorry... I was calling the wrong version of osdk... I had two osdk folders around... Ignore the report!
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

Regarding ReserveSectors, all it does is to let you write somewhere that some sectors should be skipped and you get the track/sector/length somewhere in the list of data.
It's basically the same thing as providing a placeholder file, except you don't have to provide a file. Nothing more :)
I extended the Loader API, here is my 'loader_api.h' - all functions are self explained and working:
Hmm, not sure about "self explained" because I have no idea what LoadIndOnand LoadIndOffare supposed to do :)
- in script file 'AddFile loader $XXXX' - specifying load address for loader is useless now,
because the real value is #define'd in disk_info.h as 'location_loader'. I had the idea to remove
this #define from disk_info.h, and put it in generated 'floppy_description.h', but this will not work
because 'location_loader' must be defined before #include "floppy_description.h" :(
Generating one more 'floppy_locations.h' file which contains only: #define location_loader $XXXX
will solve the problem.
Indeed the idea is to specify this value in the description script, possibly should have a dedicated instruction "SetLoader" that would automatically generate the values for the loader track, sector and load address in the generated header file.

Regarding the order, I've not checked the code, so just thinking out loud.

Making the zp and sector buffer defined in the description file seem like a good idea as well.
I guess by default it could use $50 and $200 by default.

For the rest, would be nice if you could send me the changes you made, including your loader, loader api, etc...
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

So, I started updating Oric Tech with the changes we have discussed, the full changes will be done step by step so everybody can agree on them, I'm not going to add the new include files or anything like that right now, so all the changes are compatible with the existing OSDK and set of files.

Here is what I have at the moment:

Added the missing defines to disc_infos.h
disk_info.h wrote: #define loader_zp_start $80 ; Location of the first zero page address used during the loading
#define loader_sector_buffer $200 ; Location of the 256 bytes buffer used to load the sectors
And modified loader.asm to use the values
loader.asm wrote: *=loader_zp_start
(...)
loop_copy
lda loader_sector_buffer,y ; Load the byte from the sector buffer
__auto_write_address
(...)
sta loader_sector_buffer,x ; Store the byte in sector buffer
I fixed the missing # in sector_2-microdisc.asm
disk_info.h wrote: copy_loop
lda ($00),y
sta FINAL_ADRESS,y
iny
cpy #(_END_-_BEGIN_)
bne copy_loop
I now have loader_api.s and loader_api.h with the following content:

Code: Select all

//
// FloppyBuilder/Loader system
// Compatible with both C and Assembler modules
//
#include "floppy_description.h"

#ifdef ASSEMBLER    // 6502 Assembler API
#define SetFileAddress(fileIndex,address)      ldx #fileIndex:lda #<address:ldy #>address:jsr $fff4
#define LoadFile(fileIndex)                    ldx #fileIndex:jsr $fff7
#define LoadFileAt(fileIndex,address)          ldx #fileIndex:lda #<address:ldy #>address:jsr $fff4:jsr $fff7

#else               // C Compiler API
extern unsigned char LoaderApiEntryIndex;
extern unsigned char LoaderApiAddressLow;
extern unsigned char LoaderApiAddressHigh;
extern void* LoaderApiAddress;

extern void SetLoadAddress();
extern void LoadFile();

#define SetFileAddress(fileIndex,address)      LoaderApiEntryIndex=fileIndex;LoaderApiAddress=address;LoaderApiSetLoadAddress();
#define LoadFile(fileIndex)                    LoaderApiEntryIndex=fileIndex;LoaderApiLoadFile();
#define LoadFileAt(fileIndex,address)          LoaderApiEntryIndex=fileIndex;LoaderApiAddress=address;LoaderApiSetLoadAddress();LoaderApiLoadFile();

#endif

Code: Select all

; 
; Small code to implement the loading of data while a program is running.
; What it does is to call the loader module, it abstracts the actual loader implementation 
;
	.text

_LoaderApiEntryIndex	.byt 0

_LoaderApiAddress
_LoaderApiAddressLow	.byt 0
_LoaderApiAddressHigh	.byt 0

_LoaderApiLoadFile
	ldx _LoaderApiEntryIndex
_LoaderApiLoadFileRegister	
	jmp $fff7					; _LoadFile

_LoaderApiSetLoadAddress
	lda _LoaderApiAddressLow
	ldy _LoaderApiAddressHigh
	ldx _LoaderApiEntryIndex
_LoaderApiSetLoadAddressRegister	
	jmp $fff4					; SetLoadAddress


; x: file index
; a: Low part of address
; y: High part of address
_LoaderApiLoadFileAtAddressRegister
	jsr $fff4					; SetLoadAddress
	jmp $fff7					; _LoadFile
After all these changes, here is what the code looks like now when we want to load files.
From a C program:

Code: Select all

	// Load the cloud picture
	LoadFileAt(LOADER_CLOUD,CloudPicture);

	// Load the rain drop picture
	LoadFileAt(LOADER_RAINDROP,RainDropPicture);

	// Load the VIP scroll stuff
	LoadFileAt(LOADER_VIP_LOGO,VipLogoPicture);

	// Load the Long Scroller
	LoadFileAt(LOADER_LONG_SCROLLER,LongScrollerPicture);

	// Load the sound warning picture
	LoadFileAt(LOADER_SOUND_WARNING,SoundWarningPicture);
From a 6502 assembler program:

Code: Select all

	// Load the 6x8 font
	LoadFile(LOADER_FONT_6x8)

	// Load the VIP scroll stuff (HAS TO BE BEFORE _BufferCharset30x40)
	LoadFileAt(LOADER_VIP_SCROLL,_BufferCharset)
When the FloppyBuilder will be able to parse the symbol files, the LoadFileAt instruction will basically become more or less unnecessary because you will be able to specify directly a label in the description file.

So there it is, what I have at the moment.

The updated Oric Tech project is available on the SVN depot at http://miniserve.defence-force.org/svn/ ... /OricTech/

ISS: To add the other instructions of the API I will probably need to know how you implemented them :)
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: OSDK 1.7

Post by iss »

fbs.zip
(15.01 KiB) Downloaded 534 times
This is my modified code.
About the added 'Ind...' functions - actually this idea is yours too :)
I changed the functions to be more practical:

Code: Select all

/*
 * Redefine alternative charset symbols
 * to display 2x2 chars R/W activity indicator
 * in the bottom right corner
 * Params:
 * 
 *  mode: 0 = text (alt chars definitions start at $b900)
 *        1 = hires (alt chars definitions start at $9c00)
 * 
 *  offset: 0..76 offset in the alt charsdet table,
 *                2x2=4 consecutive characters are used
 * 
 *  ptr: pointer to 4x8=32 bytes array with character definitions
 * 
 */

void IndDefine(char mode, char offset, void* ptr);
void IndSet(char enable);

#define IndEnable()     IndSet(1)
#define IndDisable()    IndSet(0)

And this code shows 2x2 characters rectangle at right bottom corner during disk operations

Code: Select all

static char indpic[] = {
  0x3f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
  0x3f,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
  0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3f,
  0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3f,
};
void main(void)
{
  IndDefine(0,0,&indpic);
  IndEnable();
  // Do some Load / Save operations to see indicator
  // in the right bottom corner

}
I hope my modifications will not make big troubles to you ;).
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

iss wrote:About the added 'Ind...' functions - actually this idea is yours too :)
I did not realize that was about the loading message :)

I now see why my loading code did not work on Jasmin, forgot to change the FDC commands :p

So, regarding your changes, imo there's a number of things we could do.

1) Since the Jasmin and Microdisc boot sectors are now in charge of setting the values to use, there's no real reason for keeping the #ifdef MICRODISC_LOADER and #ifdef JASMIN_LOADER sections in the disk_info.h, they should just go in their respective files.

2) For generic purposes it's important to keep the loader api as small as possible, I will think about it, but I have some ideas on how to get something generic that the user can implement if they want a display while loading

3) Still for practicality, if we have some room remaining in the boot sectors, we should probably have the init_via_defaults moved into the boot sectors instead of having stay in the loader file.

The rest of your changes mostly make sense, one note regarding size optimization, when you have a jsr followed by a rts, jump put a jmp instead :)

Code: Select all

    jsr WaitCompletion
    rts
--> jmp WaitCompletion
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: OSDK 1.7

Post by iss »

I'm glad that my modifications are accepted.
jsr+rts=jmp - of course that's clear :). but I was so happy that writing worked and simply forgot for code cleanup and optimization. btw, maybe to leave such thing the reason is that I removed some sei/cli pairs. I know that these sei/cli were in the code to allow (for instance) music playback during disk operations, but without them was easy to me to solve Jasmin booting problems.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

What I'm going to do is to try to integrate your change optimally in my existing demos, and see if I can get them to run on Jasmin.
Then you can review the code and see if it goes ok for you.

The reason why I implemented the loader api as defines is that it makes it easy to dynamically enable/disable what we want at compile time, so the user pays only for what he uses.
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK 1.7

Post by Chema »

Great work guys!
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK 1.7

Post by Chema »

Just one small note. I guess you want to target the Telestrat too. Are you aware the there is a bug in that machine which makes the normal Microdisc code fail? It was discovered by Fabrice when he helped me with the routines in 1337 (in Space1999 and Pinforic we used the code in page 4). This bug does not happen in the emulators.

He wrote an article in CEO mag about it, but the result was that accesses to FDD registers should be done with code alligned at a specific address, depending on the page3 address of he register.

I had to put things like these in the disk code in 1337 (http://miniserve.defence-force.org/svn/ ... INE/disk.s)

Code: Select all

.dsb (($0313&3)-((*+3)&3))&3,$ea
   sta $0313 
To insert the correct number of nop instructions each time a register was accessed, or the code did not work on a real Telestrat.

I think I posted something about this on the 1337 thread.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

Chema wrote:He wrote an article in CEO mag about it, but the result was that accesses to FDD registers should be done with code alligned at a specific address, depending on the page3 address of he register.
If anyone can point me to the original article, I will take that into consideration.
Of course want to support as many machines as possible, and that's the whole point of trying to get the FloppyBuilder/loader system to work for everybody: If we fix a bug or add a feature, it's just a matter of rebuilding the project with the new version.
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK 1.7

Post by Chema »

Sorry, I can't remember the number, but the posts about this in the 1337 forum (including some explanations) is here:

http://forum.defence-force.org/viewtopi ... &start=420

And simply adding those assembler directives did the trick and the code worked not in a telestrat and normal Orics with Microdisc.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OSDK 1.7

Post by Dbug »

Chema wrote:Sorry, I can't remember the number, but the posts about this in the 1337 forum (including some explanations) is here:
http://forum.defence-force.org/viewtopi ... &start=420
And simply adding those assembler directives did the trick and the code worked not in a telestrat and normal Orics with Microdisc.
Ok, I see, that's going to increase the size of the code even more :)
Damn it :p

I've been thinking a bit more about the loader code, technically it's totally possible to make it in two parts: One part that can be overwritten, which can be used for the setup, initialization of VIA, clearing the screen, etc... followed by the rest of the code that remains in memory.

That would of course make sense only if the loader is kept in highmemory.
Post Reply