Libraries

Description

The OSDK contains a decently complete standard library, and also some Oric specific functionalities.

Most other SDK are based on binary library files, and the right functions are included in the final executable during the link phase. This SDK works differently because the library is made of source code that is included in the main program by the linker before the final assembly pass.

This method is interesting because it's possible to easily add functions, and correct bugs.

Include folder

The OSDK\INCLUDE folder contains all the header files. If you add a function in the library, you will have to add a function declaration in one of the header files. LIB.H is a good choice for that operation.

LIB folder

The OSDK\LIB folder contains a bunch of assembly code source file, as well as a LIBRARY.NDX file.

The LIBRARY.NDX file simply is a list of all source files with the exported functions it contains.

The source files simply are normal assembly code functions and declarations. Please note that only function that starts by a underscore ("_") symbol will be accessible from C source code.



Known issues


Reported by RetrOric the Fri 1st February 2019


Issue #31: OSDK libraries should be system agnostic
Details: At the moment the OSDK libraries only work with 1.1 ROM, running programms that call the ROM will crash on Oric 1 or Telestrat. It would be nice to have some form of compatibility. (See: topic)


Reported by Waskol the Sun 2nd September 2018


Issue #26: Random generator conflicts
Details: When including lib.h, two defines exposing the 32 bit random generator conflicts with the RND function from the ROM, resulting in corrupted results. (See: topic)


Reported by Waskol the Tue 28th August 2018


Issue #28: Additional BASIC functions
Details: Some users would like to have additional functions, similar to BASIC, like PLOT, SCRN, etc... added to the OSDK. (See: topic)




Resolved issues


Reported by RetrOric the Fri 15th February 2019
Fixed in OSDK 1.15


Issue #32: Syntax error in include/sys/sound.h
Details: The "#define NOTE_C-SHARP 2" uses an invalid "-" symbol that does not compile, should have been an underscore instead.


Reported by Badger the Tue 28th August 2018
Fixed in OSDK 1.13


Issue #29: Link error when calling the Sedoric function
Details: For some reason calling the Sedoric() function results in a link error. (See: topic)


Reported by Fra the Sat 21st July 2018
Fixed in OSDK 1.12


Issue #24: scanf and sscanf do not assemble correctly
Details: When trying to use the 'scanf' functions from the OSDK libraries, XA complains with multiple syntax errors.


comments powered by Disqus
Coverity Scan Build Status
History
Version OSDK 2.0
  • The dynamic allocator was repaired. malloc overwrote its own length limit in the "no next block" case, so the heap end bound was never enforced, which fired on the very first allocation. free null checked the C stack instead of the pointer it was given, and its 16 bit descriptor decrement corrupted the high byte once there were 129 or more live blocks. realloc was broken in every path
  • Several string functions were fixed. strchr(s,0) returned NULL although C89 counts the terminator as part of the string. strstr never rewound the haystack after a partial match. strcspn and strspn skipped the first character of every 256 byte page. strrchr returned an address too high by the number of pages crossed. strtok produced empty tokens on consecutive delimiters. memccpy failed to link at all
  • sprintf never wrote the terminating NUL, so reusing a buffer showed stale tails. This is a behaviour change: strings produced by sprintf may now be shorter than they were
  • file_unpack_raw added the unpacked size to the destination with the carry in whatever state the caller had left it, writing one byte past the end when it was set
  • The runtime int to float conversion called the wrong ROM entry point
  • sedoric() corrupted the C runtime by clobbering TXTPTR
  • Added the ctype family, and converted the small hot functions to __fastcall so they take their argument in a register
  • The C runtime startup was slimmed down by nearly 400 bytes, and uninitialized statics are now reserved in .bss rather than stored in the executable as zeros, which the runtime clears at startup only when a module actually reserves any
  • Ships the common portable C headers (stdint.h, types.h, compat.h) so third party C code has a better chance of compiling unmodified
Version 1.14
  • Fixed a problem with itoa not correctly processing negative numbers (the '-'' was overwritten by the number printing routine). Also took the opportunity to optimize the code (removed the jsr itoa / rts as well as an unnecessary x register clearing (it's set to zero when we are back from udiv10)
  • Added support for %u to printf