Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B as the primary programming language #71

Open
Triang3l opened this issue May 29, 2012 · 3 comments
Open

B as the primary programming language #71

Triang3l opened this issue May 29, 2012 · 3 comments

Comments

@Triang3l
Copy link

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.

@Triang3l
Copy link
Author

main() should be at 0x0000.

@Blecki
Copy link
Contributor

Blecki commented Jul 9, 2012

My DCPUC ( https://github.com/Blecki/DCPUC ) is very much an implementation of B. It's not complete, nor is it exactly like B, but it works the same way (everything is a word, etc).

@ghost
Copy link

ghost commented Jul 23, 2012

What's wrong with simply using C? The programming language is meant to be an abstraction from the architecture, so why do we need things like "everything is just a word"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants