4 ms·
I am reminded of writing Java "Midlets", (J2ME - Java 2 Micro Edition) back in the early 2000's. These ran on the then-common flip-phones and candy bar phones.
by DannyB2 9y ago
I am reminded of writing Java "Midlets", (J2ME - Java 2 Micro Edition) back in the early 2000's. These ran on the then-common flip-phones and candy bar phones. Predating smart phones and esp. iPhone.
I made my own "asteroids" game. Real Java code, written using Eclipse. The Java had some limitations. No floating point was the most notable. So there were some widely circulated Java libraries that did Trig and related functions using integers, offset by some decimal fraction so that about half the bits were right of decimal point. I simply drew vector graphics on each update frame of the game. An asteroid, for example, was a center point with a number of random points around it, connected by lines. Thinking of these points as r-theta instead of x,y made it simple for the asteroids (and the ship!) to rotate using simple sin/cos to convert the r-theta points into x,y for rendering the frame.
The whole thing compiled to a midlet of 21 K bytes. It ran pretty universally on flip phones of the time. The 1 and 4 keys on keypad controlled ship rotation. The 3 key was to fire.
No sound.
Now, how unrealistic is it that today's micro controllers could run a version of Java. Especially if a few J2ME type limitations were imposed.
- derefr 9y agoIt's not even unrealistic for early-2000s microcontrollers. The https://en.wikipedia.org/wiki/Java_Card https://en.wikipedia.org/wiki/Java_Card JVM profile is running on the microcontrollers in both your phone's SIM card and your credit card's chip.
- mitchty 9y agoThey even gave out a ring that ran java iButton (I say we can blame java for the iSTUFF prefix Apple ran with just because): https://www.javaworld.com/article/2076641/learn-java/an-introduction-to-the-java-ring.html https://www.javaworld.com/article/2076641/learn-java/an-intr... https://www.slideshare.net/abhishekabhi1023/java-ring-new https://www.slideshare.net/abhishekabhi1023/java-ring-new
- microcolonel 9y ago> offset by some decimal fraction so that about half the bits were right of decimal point. Seems weird not to use binary fixpoints. Can't really see the point of using a decimal point instead of a binary point/radix.
- vidarh 9y agoPrecision / rounding requirements is often the reason for this. E.g. last time I implemented VAT rounding on a billing system (no I'm not suggesting I'd use trig functions for that; it's just an example of why precision matters) our financial controller was hovering over me with a copy of the HMRC rules for VAT rounding, and while we certainly could do it with floats or binary fixed point if we took some care, doing it with decimal fixed points made it a lot easier to demonstrate to our financial controller that I wasn't doing anything that'd make him liable for tax evasion. Different representations works best for different things, but you better understand the tradeoffs.
- sehugg 9y agoI think they're talking about an implied decimal point, i.e. fixed point math.
- vidarh 9y agoYes, but the question is in part why use an implied decimal point instead of an implied binary point. You can do fixed binary point just by treating everything past a given bit as the fraction - it's simpler. The main reason would be differences in expected precision/rounding behavior depending on how many bits you use past the binary/decimal point. E.g. if you use 4 bits past the point, you can represent 1/10's in decimal but 1/16's in binary. But while the binary representation offers more precision, it allows you to represent different values. If you e.g. want to represent 0.2, a single decimal represented in 4 bits will allow you to do that, but with 4 bits past a binary decimal point means you'll need to round down to 0.1875 (3/16) or up to 0.25 (4/16).
- valarauca1 9y agoif your dealing with currencies you can’t use fractions. Unrepresentative decimal values (.33, .34, .66) are non trivial without many bits of fraction space. Your IEEE standard for floating points has a lot of complex rules and standard binary layouts to ensure these values are represented. You end up needing a lot more space and rules than just diving by 10^3
- bri3d 9y agoThere was also TinyVM/leJOS, which ran on a Renesis H8 with 32K (quite generous for the time, and even today for an 8-bit!) of RAM. You could program your Lego Mindstorms with Java and I remember it being quite mind-blowing for the time.
- mooreds 9y agoAh, midlets. I wrote up an entire presentation (using docbook) on networked j2me applications, based on lessons learned from a startup that built a j2me application that allowed consumers to search for homes (in 2004): http://www.mooreds.com/midp/midp.html http://www.mooreds.com/midp/midp.html Good times, good times.