Skip to content

B as the primary programming language #71

@Triang3l

Description

@Triang3l

Many systems have their primary high-level programming language: C on Unix, Objective-C on NeXTSTEP/iOS, Java on Android, C# on Windows Phone. I think DCPU-16 may have one, and for me the best PL would be B.

Why B?

  • Typeless: everything is a machine word, just like in DCPU-16 assembly.
  • You don't have to include lots of useless functions, variables and other stuff, you can use extern to include specific things.
  • It's easy to learn for C and C derivative programmers.

Problems with B.

  • There's no difference between signed and unsigned numbers.

Possible additions to B.

  • Inline assembly.
  • Inline functions/macros.
  • Inline register access functions written in inline assembly (indirect, like div(dividend, divisor, *excess) - for direct access, use inline assembly).
  • Inline signed/unsigned functions written in inline assembly.

Some inline functions.

  • putchar(char, color) // Color includes blinking
  • puts(length, color) // String itself starts right after length
  • Arithmetic functions with excess.
  • int(address, interrupt)
  • hwi(address, interrupt)

What do you think?

B reference manual.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions