GithubHelp home page GithubHelp logo

mzattera / b2fj Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 2.0 69.74 MB

Back to the Future Java (b2fJ) aims at bringing the power of Java to 8-bit home computers of the '80s. This project provides a toolchain to cross-compile Java programs under Windows.

License: Other

Batchfile 0.10% HTML 54.95% CSS 0.13% Assembly 1.62% C++ 0.57% Pascal 1.87% PHP 1.85% C 23.78% Makefile 0.39% Java 14.05% HolyC 0.56% Shell 0.13%
8-bit java jvm toolchain

b2fj's People

Contributors

barbeque avatar eahumada avatar mzattera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

eiroca eahumada

b2fj's Issues

Implement Garbage Collector

Implement simple serial mark-sweep based Garbage Collector on NXJ 0.5 on memory.c sources, work in progress in forked project https://github.com/eahumada/b2fJ

It is a classic mark and sweep implementation. The garbage collection triggers automaticly only after runing out of memory or by a java gc method invocation. Thus, if a program is a "well behaving" one, the garbage collector remains dormant. It consumes about 1000 bytes of code and about 1800 bytes of ram. Although the algorithm used is simple, it's pretty fast. A typical single gc run should take no more then 10 ms to complete. Besides, the presence of garbage collector does not impair the speed of program execution. There is no reference tracing on writes and no stack or object size increase. Potential problems: long linked list may cause processor stack overflow due to recursion.

This code should be able to run without issues with infinite iterations on the 8-bit machines:

public static void main(String[] args) throws InterruptedException {
	int i=0;
	try {
		while (true) {
			Integer integer = new Integer(i);
			String output="Strings:"+helloWorld+"->"+String.valueOf(i);
			out.println(output);
			i++;
		}
	} catch(Throwable e) {
		out.println('*');
		out.println(i);
		throw e;
	}


}

GarbaggeCollectorRunning

Improve jtools

Have Java tools put the java_code.h in the right folder, instead of copying it later from within the batch file used for compilation.

Read user input

Hey Massimiliano,

Just today I had a look at your b2fj project, which I found really cool. Good news is that I can tell you that the output prg file actually does run on a physical c64!
Now, I tweaked a little bit with the API, but so far I could not find a way to read user input from the keyboard. Could you please give me some hints?

Thanks in advance,
Tamas

Improve Reader

java.io.Reader does not support reading into a Charset

Improvments to C source

  • Decide whether verify_struct.c is still needed, what checks it should do and where to put its code.
  • Check that b2fJ compiles with GCC (__PACKED)
  • __TWOBYTE_BITFIELD is probably not needed and can be removed.
  • Fix all warnings about type conversion

Do NOT use final String

Each time b2fJ VM executes ldc bytecode, it creates a new String.

This means each time you access a String that has been declared final, a new instance of the string is created.

For the time being DO NOT use final modifier with Strings.

Make arrayCopy() native

arrayCopy() methods in java.lang.System use loops to copy array. These should all use fast native code instead.

Atari800 platform and emulator support

I'm Eduardo Ahumada from Chile. I'm a programmer and retro computing hobbyist. After some time reviewing the project Lejos and yours, I think that you did a really great Job bringing Java to the old 8-bits computers, thank you for your work. Started some work to bring b2fJ to linux and mac os x world.

I have forked the project, created some scripts and makefiles to be able to create and run binary 8-bit images on linux and osx. I added support for 8-bit Atari Home Computer and also you can create an executable and run b2fJ on Linux and debug it with GDB.

These scripts are lightweight, and all dependencies and 3rd party requirements can be installed using brew on mac or apt-get on Ubuntu, then it does not impact your repository size.

Suggestions are welcome from the community before make pull request in the future once the scripts are finished.

Currently my contributions are located and isolated in the following directories:

https://github.com/eahumada/b2fJ/tree/master/distr/lib
https://github.com/eahumada/b2fJ/tree/master/dev/test/b2fJ/test/atari
https://github.com/eahumada/b2fJ/tree/master/distr/src/platform/atari
https://github.com/eahumada/b2fJ/tree/master/distr/src/platform/linux

https://github.com/eahumada/b2fJ/blob/master/dev/test/b2fJ/test/atari/PlayerMissileTest.png

Video with B2FJ compiling code and running on Atari800 emulator:

https://youtu.be/jQllSZyGrjI

Regards,
Eduardo.

SpriteDemo

HelloWorldAtariTest

DebuggingB2FJLinux

Encoding when reading and printing

Platforms such as Commodore 64 have their own encoding of characters (e.g. PETSCII). Therefore printing/reading from/into Java Strings does not work for all characters.
As added complexity, cc65 already translates strings in C sources into the right platform encoding.
A general solution (probably using Encoding from Java?) needs to be put in place.

Floating point math implementation need fixes

Currently, for the C64 platform, Java floating point math is disabled (as it is not supported by cc65 anyway).
There should be some work done to enable and test it, as least for platforms like Windows where float is provided.
Notice the code assuments float fits a STACKWORD, which might or might not be the case.
Probably some code should b provided for float math operation which is agnostic about how floats are implemented on the target platform.

Improvements to batch files & build process

  • Change .bat file so it stops on a compilation error.
  • b2jf should be able to take a .jar and its main class (or a runnable jar) as input and link it...now it works with a single file
  • document how to setup Eclipse so you can develop a whole java project (using correct java version and lang classes).

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.