Categories
Uncategorized

Let’s Code MS DOS 0x13: VGA Mode X Fast(er) Blitting

Today we continue on our quest to make a small VGA game. So far we learned how to initialize Mode X and use some of its nice features. Copying images from system memory was painfully slow though. So let’s make it faster with a small trick!

Categories
Uncategorized

Let’s Code ESP8266 0x02: CO2 sensor CCS811

Categories
Uncategorized

Let’s Code MS DOS 0x07: Game Over!

Categories
Uncategorized

Let’s Code MS DOS 0x04: Make It Move!

Categories
Uncategorized

Let’s Code MS DOS 0x02: The Keyboard

Categories
Uncategorized

Let’s Code MS DOS 0x01: Hello World!

Categories
Uncategorized

Indexed Java 8 enums with gaps

This is an example enum for Java 8 that supports gaps in its indices is relatively fast for enums with a large amount of values:

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

public enum TestEnum {
   VALUE1( 0 ),
   VALUE2( 2 ),
   VALUE3( 50 );
   
   private final Integer id_;
   private static Map< Integer, TestEnum > values_ = 
      Arrays.stream( TestEnum.values() ).collect( Collectors.toMap(e -> e.id_, e -> e) );;
   
   private TestEnum( int i ) { id_ = i; }
   public static TestEnum fromInteger( int i )
   {
      return values_.get( i );
   }
   
}