Coder Social home page Coder Social logo

mlib's Introduction

mlib

The goal of mlib is to create a clean and nice nonstandard C library for MikeOS that respects the cdecl calling convention. mlib is a C wrapper for all of the MikeOS APIs and it's completely written in assembly (nasm). Currently, the project has finally been finished but it's still maintained. This library should only be used with programs running on MikeOS 4.6.1 and up.

Building

Before you get started, you'll need to have NASM installed on your system. To build mlib, simply run the build script. If you're using Windows, run build-win.bat. If you're using Linux, run build-linux.sh. The output should be an object file, mlib.a, in the root directory of mlib. Use mlib.h in .\include and include mlib.a with your program when compiling. SmallerC is a great compiler for MikeOS.

Example

A small hello world program looks like this:

#include "mlib.h"

int main(int argc, char *argv[]) {
    print_string("Hello, world!\r\n");
    return 0;
}

Contributing

Any kind of contributing is greatly appreciated and submitting an issue or suggestion is also helpful! A list of contributers can be found here.

Licensing

This project is licensed under "Simplified BSD" and can be found in the LICENSE file.

Dependencies

mlib's People

Contributors

i8087 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mlib's Issues

os_input_string size limit

MikeOS 4.6 will require an additional parameter for the function os_input_string. This should be implement soon as it's a quick fix.

long_int_negate

The MikeOS function long_int_negate takes and returns a 32-bit value held in DX:AX Unfortunately, SmallerC doesn't support long types, so a special structure should be used and implemented like the one below.

typedef struct b_int {
    int low;
    int high;
} b_int;

Mikedev Variables

Would probably be desirable to put the mikedev.inc defined keywords into mlib.h for use at the C level.

string_parse

The function string_parse returns multiple strings. A simple solution to the problem would be to create a structure that points to all of the strings.

args

argc and argv aren't handled properly in crt0.asm.

Documentation error in Disk API

I have found another error in the MikeOS documentation.

All disk functions use the carry flag to report a disk error, except os_get_file_list which returns a blank string. However, the MikeOS documentation fails to mention that os_create_file and os_remove_file use the carry flag to indicate an error.

I checked your implementation and found your 'load_file', 'create_file' and 'remove_file' functions do not handle the carry flag. Additionally, in 'get_file_size' you return zero as the file size if a disk error occurs, which may be misleading.

Todo List

Finish adding all of the functions for the following categories:

  • Disk
  • Keyboard
  • Math
  • Misc
  • Ports
  • Screen
  • String
  • Sound
  • BASIC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.